I build a node-red flow that is working with domoticz. TCP stream listen to 5001 but you can change it to any port you like. Also the HTT Request Sender iuse the format http://<mosquito ip>/<port>/camera/<domoticz switch idx>/<status_id>.
for status id you give value of 1 (when event started) or 0 (when event ended).
- Code: Select All Code
[{"id":"7bf4e37f.71669c","type":"tab","label":"Flow 5"},{"id":"42212607.be6e48","type":"comment","z":"7bf4e37f.71669c","name":"Instructions","info":"In domoticz go to Hardware/create virtual device\nlookup the IDX in the devices tab","x":395,"y":22,"wires":[]},{"id":"871b5baa.9c2418","type":"mqtt out","z":"7bf4e37f.71669c","name":"domoticz/in","topic":"domoticz/in","qos":"","retain":"","broker":"ecc5db38.629e78","x":710,"y":87,"wires":[]},{"id":"3a87e7c1.c088b8","type":"function","z":"7bf4e37f.71669c","name":"Message","func":"var output = msg.payload.split(\"/\");\nvar cam_idx = parseInt(output[2]);\nvar Status_id = parseInt(output[3]);\n\nmsg.payload = {};\nmsg.payload.command = \"switchlight\";\nmsg.payload.idx = cam_idx;\nif (Status_id==1) {\nmsg.payload.switchcmd = \"On\" ;\nmsg.payload.level = 100;\n}\nelse if (Status_id===0) {\nmsg.payload.switchcmd = \"Off\";\nmsg.payload.level = 0;\n}\n\nreturn msg;","outputs":1,"noerr":0,"x":344,"y":150,"wires":[["871b5baa.9c2418","54e58729.f9d1c8"]]},{"id":"54e58729.f9d1c8","type":"debug","z":"7bf4e37f.71669c","name":"DOMOTICZ","active":true,"console":"false","complete":"payload","x":705,"y":214,"wires":[]},{"id":"ca73dfe.0ebeb2","type":"inject","z":"7bf4e37f.71669c","name":"XEOMA","topic":"","payload":"GET /camera/167/0 HTTP/1.1User-Agent: UserAgentFSHost: 192.168.10.7","payloadType":"str","repeat":"","crontab":"","once":false,"x":137,"y":57,"wires":[["3a87e7c1.c088b8"]]},{"id":"f9a8ebce.c24ca8","type":"tcp in","z":"7bf4e37f.71669c","name":"Xeoma_In","server":"server","host":"","port":"5001","datamode":"single","datatype":"utf8","newline":"","topic":"/camera","base64":false,"x":118,"y":191,"wires":[["3a87e7c1.c088b8"]]},{"id":"ecc5db38.629e78","type":"mqtt-broker","z":"","broker":"localhost","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"15","cleansession":true,"willTopic":"","willQos":"0","willPayload":"","birthTopic":"","birthQos":"0","birthPayload":""}]