Hikvision PTZ preset control
This flow allows the user to aim a PTZ from Hikvision to a preset. Which is already made in the PTZ menu.
The method used is HTTP PUT from the Hikvisoin ISAPI.
You need to put the follow details of the PTZ or NVR:
IP (either of the NVR or from the PTZ itself) Port (usually 80) Password (PTZ / NVR password) User (PTZ / NVR user) Channel (1 for PTZ, for the NVR depending on which channel you want to control) Preset (the preset number you want to call)
[{"id":"e308df9c84a9999b","type":"tab","label":"PTZ Control hikvision","disabled":false,"info":"THis flow will send the Hik PTZ to a preset which is \nalready configured in the hikvision PTZ using the below HTTP PUT\n\n//HTTP PUT command:\n//http://<user>:<password><IP>:<Port>/ISAPI/PTZCtrl/channels/<NVR channel>/presets/<preset number>/goto","env":[]},{"id":"a2374bb44a04a8cd","type":"ui_text_input","z":"e308df9c84a9999b","name":"","label":"Username","tooltip":"Set username voor Hikvision device","group":"1c94b8ec141b8dd3","order":5,"width":0,"height":0,"passthru":true,"mode":"text","delay":"0","topic":"User","topicType":"str","x":420,"y":360,"wires":[["7dc3e6779f7b740b","c4486a7f4593c10a"]]},{"id":"9bc758abd89358d4","type":"ui_text_input","z":"e308df9c84a9999b","name":"","label":"Password","tooltip":"Set password for hik device","group":"1c94b8ec141b8dd3","order":1,"width":0,"height":0,"passthru":true,"mode":"text","delay":"0","topic":"Password","topicType":"str","x":420,"y":400,"wires":[["48bc25d591a1cf89","c4486a7f4593c10a"]]},{"id":"eef08bd7e9b475d0","type":"ui_text_input","z":"e308df9c84a9999b","name":"","label":"Channel","tooltip":"Set Channel for PTZ (if no NVR is used, channel = 1)","group":"1c94b8ec141b8dd3","order":2,"width":0,"height":0,"passthru":true,"mode":"text","delay":"0","topic":"Channel","topicType":"str","x":420,"y":440,"wires":[["d628e3e9050d42e6","c4486a7f4593c10a"]]},{"id":"0fad2c2fbdea972c","type":"ui_text_input","z":"e308df9c84a9999b","name":"","label":"IP","tooltip":"Set IP for Hik Device","group":"1c94b8ec141b8dd3","order":3,"width":0,"height":0,"passthru":true,"mode":"text","delay":"0","topic":"IP","topicType":"str","x":430,"y":280,"wires":[["085ad3636ec21e38","c4486a7f4593c10a"]]},{"id":"9061ac67dd17abc5","type":"ui_text_input","z":"e308df9c84a9999b","name":"","label":"Port","tooltip":"Which port for HTTP (usually 80)","group":"1c94b8ec141b8dd3","order":4,"width":0,"height":0,"passthru":true,"mode":"text","delay":"0","topic":"Port","topicType":"str","x":430,"y":320,"wires":[["45f46face1648bc4","c4486a7f4593c10a"]]},{"id":"085ad3636ec21e38","type":"ui_text","z":"e308df9c84a9999b","group":"b0377a28a0e7e96f","order":3,"width":0,"height":0,"name":"","label":"IP","format":"{{msg.payload}}","layout":"row-spread","x":770,"y":280,"wires":[]},{"id":"45f46face1648bc4","type":"ui_text","z":"e308df9c84a9999b","group":"b0377a28a0e7e96f","order":4,"width":0,"height":0,"name":"","label":"Port","format":"{{msg.payload}}","layout":"row-spread","x":770,"y":320,"wires":[]},{"id":"7dc3e6779f7b740b","type":"ui_text","z":"e308df9c84a9999b","group":"b0377a28a0e7e96f","order":5,"width":0,"height":0,"name":"","label":"Username","format":"{{msg.payload}}","layout":"row-spread","x":790,"y":360,"wires":[]},{"id":"48bc25d591a1cf89","type":"ui_text","z":"e308df9c84a9999b","group":"b0377a28a0e7e96f","order":1,"width":0,"height":0,"name":"","label":"Password","format":"{{msg.payload}}","layout":"row-spread","x":780,"y":400,"wires":[]},{"id":"d628e3e9050d42e6","type":"ui_text","z":"e308df9c84a9999b","group":"b0377a28a0e7e96f","order":2,"width":0,"height":0,"name":"","label":"Channel","format":"{{msg.payload}}","layout":"row-spread","x":780,"y":440,"wires":[]},{"id":"c4486a7f4593c10a","type":"function","z":"e308df9c84a9999b","name":"set flow variables","func":"var flowdata = msg.payload;\nvar flowname = msg.topic;\nflow.set(flowname,flowdata);\n\nmsg.payload = flowname + \";\" + flowdata\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":810,"y":480,"wires":[["05e2a07f4af89302"]]},{"id":"0739e46aa1da8c29","type":"ui_numeric","z":"e308df9c84a9999b","name":"","label":"Preset number","tooltip":"Select preset number","group":"f03f4af79d794fa8","order":0,"width":0,"height":0,"wrap":false,"passthru":true,"topic":"Preset","topicType":"str","format":"{{value}}","min":0,"max":10,"step":1,"x":420,"y":480,"wires":[["c4486a7f4593c10a"]]},{"id":"05e2a07f4af89302","type":"debug","z":"e308df9c84a9999b","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":990,"y":480,"wires":[]},{"id":"ceb5f963ac445221","type":"function","z":"e308df9c84a9999b","name":"Make HTTP string","func":"var Port = flow.get(\"Port\");\nvar User = flow.get(\"User\");\nvar Channel = flow.get(\"Channel\");\nvar Password = flow.get(\"Password\");\nvar IP = flow.get(\"IP\");\nvar preset = flow.get(\"Preset\")\n\nvar http = \"http://\" + User + \":\" + Password + \"@\" + IP + \":\" + Port + \"/ISAPI/PTZCtrl/channels/\" + Channel + \"/presets/\" + preset + \"/goto\";\n\nmsg.payload = http;\nmsg.url = http;\nreturn msg\n\n//HTTP PUT command:\n//http://<user>:<password><IP>:<Port>/ISAPI/PTZCtrl/channels/<NVR channel>/presets/<preset number>/goto","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":810,"y":560,"wires":[["474df359ea4f248c","015fbbfdcb90ca20"]]},{"id":"288da082a48f2be4","type":"ui_template","z":"e308df9c84a9999b","group":"1c94b8ec141b8dd3","name":"","order":5,"width":0,"height":0,"format":"Press enter after setting the value. If value shows on the \"check\" tab the variable is stored","storeOutMessages":true,"fwdInMessages":true,"resendOnRefresh":true,"templateScope":"local","x":370,"y":560,"wires":[[]]},{"id":"27c50f2fc6da5b06","type":"ui_button","z":"e308df9c84a9999b","name":"","group":"1c94b8ec141b8dd3","order":6,"width":0,"height":0,"passthru":false,"label":"Send preset","tooltip":"","color":"","bgcolor":"","icon":"","payload":"","payloadType":"str","topic":"topic","topicType":"msg","x":580,"y":540,"wires":[["ceb5f963ac445221"]]},{"id":"474df359ea4f248c","type":"debug","z":"e308df9c84a9999b","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1010,"y":560,"wires":[]},{"id":"015fbbfdcb90ca20","type":"http request","z":"e308df9c84a9999b","name":"","method":"PUT","ret":"txt","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","authType":"","senderr":false,"x":770,"y":640,"wires":[[]]},{"id":"e9a329f9a4617e1e","type":"catch","z":"e308df9c84a9999b","name":"","scope":null,"uncaught":false,"x":770,"y":780,"wires":[["4d6d66369577655d"]]},{"id":"4d6d66369577655d","type":"function","z":"e308df9c84a9999b","name":"Alert","func":"msg.payload = \"http request not accepted check settings\"","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":970,"y":780,"wires":[["0e2994359cdd7ea7"]]},{"id":"0e2994359cdd7ea7","type":"ui_toast","z":"e308df9c84a9999b","position":"top right","displayTime":"10","highlight":"red","sendall":true,"outputs":0,"ok":"OK","cancel":"","raw":false,"topic":"","name":"","x":1160,"y":780,"wires":[]},{"id":"1c94b8ec141b8dd3","type":"ui_group","name":"Settings","tab":"cf3108690ea4a357","order":1,"disp":true,"width":"6","collapse":false},{"id":"b0377a28a0e7e96f","type":"ui_group","name":"Check","tab":"cf3108690ea4a357","order":2,"disp":true,"width":"6","collapse":false},{"id":"f03f4af79d794fa8","type":"ui_group","name":"Control","tab":"cf3108690ea4a357","order":3,"disp":true,"width":"6","collapse":false},{"id":"cf3108690ea4a357","type":"ui_tab","name":"Controls","icon":"fa-camera-cctv","disabled":false,"hidden":false}]