Domoticz to domoticz

In case that Domoticz remote does not working well I just made a flow to get sensor/devices values from mqtt domoticz/out and resend it to another domoticz/in on another instance. Warning!! You still need manually create dummy devices in same order what first Domoticz have. Sensor type and IDX must be the same of both instances. Is possible to shift forward IDXes, but still its must be in same order, and type Its a dirty flow. Works only with sensors and simply switches.

[{"id":"2b416547.ffe4aa","type":"tab","label":"From Domoticz to Domoticz","disabled":false,"info":"Getting values from domoticz/out then parsing and sending to another domoticz instance.\nBy Xury"},{"id":"9fed3e39.b1884","type":"mqtt in","z":"2b416547.ffe4aa","name":"","topic":"domoticz/out","qos":"2","broker":"61993d3e.ed8d94","x":114,"y":157,"wires":[["57ccd850.0d4c28"]]},{"id":"97a774bc.e02de8","type":"debug","z":"2b416547.ffe4aa","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":655,"y":159,"wires":[]},{"id":"57ccd850.0d4c28","type":"json","z":"2b416547.ffe4aa","name":"","property":"payload","action":"","pretty":false,"x":185,"y":67,"wires":[["f733bcd0.b6a7d"]]},{"id":"f733bcd0.b6a7d","type":"change","z":"2b416547.ffe4aa","name":"","rules":[{"t":"delete","p":"payload.Battery","pt":"msg"},{"t":"delete","p":"payload.RSSI","pt":"msg"},{"t":"delete","p":"payload.description","pt":"msg"},{"t":"delete","p":"payload.dtype","pt":"msg"},{"t":"delete","p":"payload.id","pt":"msg"},{"t":"delete","p":"payload.name","pt":"msg"},{"t":"delete","p":"payload.stype","pt":"msg"},{"t":"delete","p":"payload.unit","pt":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":370,"y":65,"wires":[["2e39ac94.a8fd34"]]},{"id":"2e39ac94.a8fd34","type":"function","z":"2b416547.ffe4aa","name":"Join svalue_X","func":"if ( msg.payload.svalue2 ) {\n    msg.payload.svalue = msg.payload.svalue1 + \";\" + msg.payload.svalue2;\n}\n else { msg.payload.svalue = msg.payload.svalue1\n }\n if ( msg.payload.svalue3 ) {\n    msg.payload.svalue +=  \";\" + msg.payload.svalue3;\n}\n if ( msg.payload.svalue4 ) {\n    msg.payload.svalue +=  \";\" + msg.payload.svalue4;\n }\n if ( msg.payload.svalue5 ) {\n    msg.payload.svalue +=  \";\" + msg.payload.svalue5;\n }\nreturn msg;","outputs":1,"noerr":0,"x":373,"y":156,"wires":[["bf370c3b.f6083"]]},{"id":"e6f8a8a9.836628","type":"change","z":"2b416547.ffe4aa","name":"","rules":[{"t":"delete","p":"payload.svalue1","pt":"msg"},{"t":"delete","p":"payload.svalue2","pt":"msg"},{"t":"delete","p":"payload.svalue3","pt":"msg"},{"t":"delete","p":"payload.svalue4","pt":"msg"},{"t":"delete","p":"payload.svalue5","pt":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":380,"y":236,"wires":[["97a774bc.e02de8","33c2cd8d.c43e52"]]},{"id":"bf370c3b.f6083","type":"switch","z":"2b416547.ffe4aa","name":"Switchlight type selection","property":"payload.switchType","propertyType":"msg","rules":[{"t":"neq","v":"On/Off","vt":"str"},{"t":"eq","v":"On/Off","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":174,"y":284,"wires":[["e6f8a8a9.836628"],["2915eaea.09cd66"]]},{"id":"2915eaea.09cd66","type":"change","z":"2b416547.ffe4aa","name":"","rules":[{"t":"set","p":"payload.command","pt":"msg","to":"switchlight","tot":"str"},{"t":"set","p":"payload.switchcmd","pt":"msg","to":"payload.nvalue","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":155,"y":360,"wires":[["66b0a5b8.4c3cdc"]]},{"id":"a4416ecb.ec8b5","type":"debug","z":"2b416547.ffe4aa","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":780,"y":314,"wires":[]},{"id":"66b0a5b8.4c3cdc","type":"function","z":"2b416547.ffe4aa","name":"ON/OFF","func":"if (msg.payload.nvalue) {\n    msg.payload.switchcmd = \"On\"\n}\nelse {\n    msg.payload.switchcmd = \"Off\"\n}\nreturn msg;","outputs":1,"noerr":0,"x":358,"y":362,"wires":[["89b99299.999f6"]]},{"id":"89b99299.999f6","type":"change","z":"2b416547.ffe4aa","name":"","rules":[{"t":"delete","p":"payload.switchType","pt":"msg"},{"t":"delete","p":"payload.svalue1","pt":"msg"},{"t":"delete","p":"payload.svalue","pt":"msg"},{"t":"delete","p":"payload.nvalue","pt":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":555,"y":363,"wires":[["e6db3c31.f67a4"]]},{"id":"e6db3c31.f67a4","type":"function","z":"2b416547.ffe4aa","name":"Sort order","func":"var temp = msg.payload\nmsg.payload = {}\nmsg.payload.command = temp.command\nmsg.payload.idx = temp.idx\nmsg.payload.switchcmd = temp.switchcmd\nreturn msg;","outputs":1,"noerr":0,"x":568,"y":288,"wires":[["a4416ecb.ec8b5","33c2cd8d.c43e52"]]},{"id":"33c2cd8d.c43e52","type":"mqtt out","z":"2b416547.ffe4aa","name":"Stromiec","topic":"domoticz/in","qos":"2","retain":"","broker":"16ef4dd6.fa38d2","x":779,"y":241,"wires":[]},{"id":"65283359.09b81c","type":"comment","z":"2b416547.ffe4aa","name":"Copy values from  domoticz to another instance","info":"Using domoticz/out domoticz/in in dirty way. But works.\nWarning!. You have to manually prepare sensors/devices\nwith exactly the same IDXes as first instance. In the\nsame order,type etc.\nIs possible to shift IDXes about amount of numbers, but\nstill you need same order.","x":691,"y":79,"wires":[]},{"id":"61993d3e.ed8d94","type":"mqtt-broker","z":"","name":"","broker":"127.0.0.1","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""},{"id":"16ef4dd6.fa38d2","type":"mqtt-broker","z":"","name":"","broker":"192.168.3.177","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"15","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closePayload":"","willTopic":"","willQos":"0","willPayload":""}]

Flow Info

Created 5 years, 4 months ago
Rating: not yet rated

Owner

Actions

Rate:

Node Types

Core
  • change (x4)
  • comment (x1)
  • debug (x2)
  • function (x3)
  • json (x1)
  • mqtt in (x1)
  • mqtt out (x1)
  • mqtt-broker (x2)
  • switch (x1)
Other
  • tab (x1)

Tags

  • domoticz
  • mqtt
Copy this flow JSON to your clipboard and then import into Node-RED using the Import From > Clipboard (Ctrl-I) menu option