Hi All,
I figured i’d pass this on to anyone also interested. I put this together using elements from another article I found online and it’s been great. I recently installed a Reolink NVR for our patio downstairs so we could monitor our two dogs more closely and it’s great but unfortunately at times we would leave in other positions such as checking dogs are in bed or under house etc but really wanted it to monitor the large Patio space so I built this to revert back to Patio “if” it was moved otherwise it won’t do anything.
[{"id":"a224372a097197ed","type":"tab","label":"Reolink","disabled":false,"info":"","env":[]},{"id":"f1fed66a3ab4d103","type":"http request","z":"a224372a097197ed","name":"","method":"POST","ret":"obj","paytoqs":"ignore","url":"http://YOURREOLINKNVRIP/cgi-bin/api.cgi?cmd=PtzCtrl&token=null","tls":"","persist":false,"proxy":"","authType":"","senderr":false,"credentials":{},"x":570,"y":100,"wires":[["a5d82acefe4304ef"]]},{"id":"d78cb23a322f2fed","type":"inject","z":"a224372a097197ed","name":"run every 60mins","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"3600","crontab":"","once":true,"onceDelay":0.1,"topic":"","payloadType":"date","x":130,"y":100,"wires":[["32c741df4e50d82d"]]},{"id":"32c741df4e50d82d","type":"change","z":"a224372a097197ed","name":"login to Reolink NVR","rules":[{"t":"set","p":"payload","pt":"msg","to":"[{\"cmd\":\"Login\",\"action\":0,\"param\":{\"User\":{\"userName\":\"admin\",\"password\":\"YOURREOLINKNVRPASSWORD\"}}}]","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":360,"y":100,"wires":[["f1fed66a3ab4d103"]]},{"id":"e8bf1a7dee772603","type":"comment","z":"a224372a097197ed","name":"Collect Reolink token for PTZ commands","info":"","x":180,"y":60,"wires":[]},{"id":"a5d82acefe4304ef","type":"string","z":"a224372a097197ed","name":"Strip reolinktoken","methods":[{"name":"delRightMost","params":[{"type":"str","value":""}]}],"prop":"payload.0.value.Token.name","propout":"reolinktoken","object":"msg","objectout":"flow","x":770,"y":100,"wires":[[]]},{"id":"62d060d5f71f8b1b","type":"change","z":"a224372a097197ed","name":"set reolinktoken & Patio (default) (id1) ","rules":[{"t":"set","p":"reolinktoken","pt":"msg","to":"reolinktoken","tot":"flow"},{"t":"set","p":"argument","pt":"msg","to":"1","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":410,"y":200,"wires":[["906d6bab4e7f83b6"]]},{"id":"906d6bab4e7f83b6","type":"template","z":"a224372a097197ed","name":"PTZ","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"curl -s POST \"http://YOURREOLINKNVRIP/cgi-bin/api.cgi?cmd=PtzCtrl&token={{reolinktoken}}\" -d '[{\"cmd\":\"PtzCtrl\",\"action\":0,\"param\":{\"channel\":5,\"op\":\"ToPos\",\"speed\":10,\"id\":{{argument}}}}]'\n","output":"str","x":650,"y":200,"wires":[["5ab050a97d25eb36"]]},{"id":"5ab050a97d25eb36","type":"exec","z":"a224372a097197ed","command":"","addpay":"payload","append":"","useSpawn":"false","timer":"","winHide":false,"oldrc":false,"name":"Curl","x":790,"y":200,"wires":[[],[],[]]},{"id":"6e634e109c22c717","type":"comment","z":"a224372a097197ed","name":"Reset Reolink PTZ to position 1 (default) every 10mins","info":"","x":220,"y":160,"wires":[]},{"id":"01b659a14247b435","type":"inject","z":"a224372a097197ed","name":"run every 10mins","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"600","crontab":"","once":false,"onceDelay":0.1,"topic":"","payloadType":"date","x":130,"y":200,"wires":[["62d060d5f71f8b1b"]]},{"id":"01305849fd60f25d","type":"comment","z":"a224372a097197ed","name":"Manually set Reolink PTZ flow to required position","info":"","x":210,"y":260,"wires":[]},{"id":"99908c5754d915be","type":"change","z":"a224372a097197ed","name":"set reolinktoken & Backyard (id2)","rules":[{"t":"set","p":"reolinktoken","pt":"msg","to":"reolinktoken","tot":"flow"},{"t":"set","p":"argument","pt":"msg","to":"2","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":340,"y":300,"wires":[["906d6bab4e7f83b6"]]},{"id":"6f31d9fbd45ed1fa","type":"change","z":"a224372a097197ed","name":"set reolinktoken & Dogbed (id3)","rules":[{"t":"set","p":"reolinktoken","pt":"msg","to":"reolinktoken","tot":"flow"},{"t":"set","p":"argument","pt":"msg","to":"3","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":330,"y":360,"wires":[["906d6bab4e7f83b6"]]},{"id":"a295b6fbb69883fa","type":"change","z":"a224372a097197ed","name":"set reolinktoken & Ground (id4)","rules":[{"t":"set","p":"reolinktoken","pt":"msg","to":"reolinktoken","tot":"flow"},{"t":"set","p":"argument","pt":"msg","to":"4","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":330,"y":420,"wires":[["906d6bab4e7f83b6"]]},{"id":"85da58819a2ea9ae","type":"change","z":"a224372a097197ed","name":"set reolinktoken & Side (id5)","rules":[{"t":"set","p":"reolinktoken","pt":"msg","to":"reolinktoken","tot":"flow"},{"t":"set","p":"argument","pt":"msg","to":"5","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":320,"y":480,"wires":[["906d6bab4e7f83b6"]]},{"id":"f06549421e397fa0","type":"inject","z":"a224372a097197ed","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":100,"y":300,"wires":[["99908c5754d915be"]]},{"id":"832419a77a3661e6","type":"inject","z":"a224372a097197ed","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":100,"y":360,"wires":[["6f31d9fbd45ed1fa"]]},{"id":"6eefb450e31d1968","type":"inject","z":"a224372a097197ed","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":100,"y":420,"wires":[["a295b6fbb69883fa"]]},{"id":"ee9c37530b17c363","type":"inject","z":"a224372a097197ed","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":100,"y":480,"wires":[["85da58819a2ea9ae"]]}]