Last active
July 10, 2019 08:56
-
-
Save sktaylortrash/6e6511b520ebac8f3acd15307c19906c to your computer and use it in GitHub Desktop.
Node-Red Websocket connection to Deconz (RaspBee, ConBee) for sensors and switches
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ | |
"id": "c6315211.08b09", | |
"type": "tab", | |
"label": "Deconz MQTT Bridge", | |
"disabled": false, | |
"info": "Interface for interpreting Deconz websocket updates" | |
}, | |
{ | |
"id": "b9c8498.fdbefb8", | |
"type": "websocket in", | |
"z": "c6315211.08b09", | |
"name": "Ok", | |
"server": "", | |
"client": "9437396c.723f58", | |
"x": 130, | |
"y": 155, | |
"wires": [ | |
[ | |
"28f8c15a.1ed09e" | |
] | |
] | |
}, | |
{ | |
"id": "28f8c15a.1ed09e", | |
"type": "json", | |
"z": "c6315211.08b09", | |
"name": "", | |
"x": 288.00001335144043, | |
"y": 155.00000095367432, | |
"wires": [ | |
[ | |
"fe2b1b4e.5fa768", | |
"78537012.405ec" | |
] | |
] | |
}, | |
{ | |
"id": "3d14459e.ffdf6a", | |
"type": "mqtt out", | |
"z": "c6315211.08b09", | |
"name": "Publish sensor", | |
"topic": "", | |
"qos": "0", | |
"retain": "false", | |
"broker": "79ae0f24.e78a8", | |
"x": 1247, | |
"y": 449, | |
"wires": [] | |
}, | |
{ | |
"id": "ccd2df84.6e492", | |
"type": "switch", | |
"z": "c6315211.08b09", | |
"name": "Identify switch", | |
"property": "payload.state.buttonevent", | |
"propertyType": "msg", | |
"rules": [ | |
{ | |
"t": "nnull" | |
}, | |
{ | |
"t": "else" | |
} | |
], | |
"checkall": "true", | |
"outputs": 2, | |
"x": 497.38677978515625, | |
"y": 283.56640625, | |
"wires": [ | |
[ | |
"910515f7.694518", | |
"7d41be73.80768" | |
], | |
[ | |
"80c89ebc.d00f3" | |
] | |
] | |
}, | |
{ | |
"id": "910515f7.694518", | |
"type": "debug", | |
"z": "c6315211.08b09", | |
"name": "Pushbutton", | |
"active": false, | |
"tosidebar": true, | |
"console": false, | |
"complete": "payload.state.buttonevent", | |
"x": 689, | |
"y": 229, | |
"wires": [] | |
}, | |
{ | |
"id": "35e7050c.f5d1ba", | |
"type": "debug", | |
"z": "c6315211.08b09", | |
"name": "Motion sensor", | |
"active": false, | |
"tosidebar": true, | |
"console": false, | |
"complete": "payload.state.presence", | |
"x": 699.3828125, | |
"y": 340.28912353515625, | |
"wires": [] | |
}, | |
{ | |
"id": "7d41be73.80768", | |
"type": "function", | |
"z": "c6315211.08b09", | |
"name": "Deconz/switch/{{id}}", | |
"func": "var newmsg = {};\nnewmsg.payload = {};\nnewmsg.topic = {};\nnewmsg.topic = \"Deconz/switch/\"+msg.payload.id;\nnewmsg.payload = msg.payload.state.buttonevent;\nreturn newmsg;", | |
"outputs": 1, | |
"noerr": 0, | |
"x": 917.0156860351562, | |
"y": 277.25, | |
"wires": [ | |
[ | |
"3d14459e.ffdf6a" | |
] | |
] | |
}, | |
{ | |
"id": "a3ae2d4f.d917f", | |
"type": "function", | |
"z": "c6315211.08b09", | |
"name": "Deconz/motion/{{id}}", | |
"func": "var newmsg = {};\nnewmsg.payload = {};\nnewmsg.topic = {};\nnewmsg.topic = \"Deconz/motion/\"+msg.payload.id;\nif(msg.payload.state.presence === false){\n newmsg.payload = \"OFF\";\n}else{\n newmsg.payload = \"ON\";\n}\nreturn newmsg;", | |
"outputs": 1, | |
"noerr": 0, | |
"x": 919.5158081054688, | |
"y": 389.25006103515625, | |
"wires": [ | |
[ | |
"3d14459e.ffdf6a" | |
] | |
] | |
}, | |
{ | |
"id": "80c89ebc.d00f3", | |
"type": "switch", | |
"z": "c6315211.08b09", | |
"name": "identify motion", | |
"property": "payload.state.presence", | |
"propertyType": "msg", | |
"rules": [ | |
{ | |
"t": "nnull" | |
}, | |
{ | |
"t": "else" | |
} | |
], | |
"checkall": "true", | |
"outputs": 2, | |
"x": 498, | |
"y": 395, | |
"wires": [ | |
[ | |
"35e7050c.f5d1ba", | |
"a3ae2d4f.d917f" | |
], | |
[ | |
"3f61cef9.6ca872" | |
] | |
] | |
}, | |
{ | |
"id": "d290ba0b.90e358", | |
"type": "debug", | |
"z": "c6315211.08b09", | |
"name": "Lightlevel sensor", | |
"active": false, | |
"tosidebar": true, | |
"console": false, | |
"complete": "payload.state.lightlevel", | |
"x": 703, | |
"y": 447, | |
"wires": [] | |
}, | |
{ | |
"id": "6b06c75f.fe0518", | |
"type": "function", | |
"z": "c6315211.08b09", | |
"name": "Deconz/lightlevel/{{id}}", | |
"func": "// Needs to be adjusted\nvar newmsg = {};\nnewmsg.payload = {};\nnewmsg.topic = {};\nnewmsg.topic = \"Deconz/lightlevel/\"+msg.payload.id;\nif(msg.payload.state.lightlevel === false){\n newmsg.payload = \"OFF\";\n}else{\n newmsg.payload = \"ON\";\n}\nreturn newmsg;", | |
"outputs": 1, | |
"noerr": 0, | |
"x": 922.1329956054688, | |
"y": 498.9609375, | |
"wires": [ | |
[ | |
"3d14459e.ffdf6a" | |
] | |
] | |
}, | |
{ | |
"id": "3f61cef9.6ca872", | |
"type": "switch", | |
"z": "c6315211.08b09", | |
"name": "identify lightlevel", | |
"property": "payload.state.lightlevel", | |
"propertyType": "msg", | |
"rules": [ | |
{ | |
"t": "nnull" | |
}, | |
{ | |
"t": "else" | |
} | |
], | |
"checkall": "true", | |
"outputs": 2, | |
"x": 500.6171875, | |
"y": 504.71087646484375, | |
"wires": [ | |
[ | |
"d290ba0b.90e358", | |
"6b06c75f.fe0518" | |
], | |
[ | |
"fab9e59c.5efbd8" | |
] | |
] | |
}, | |
{ | |
"id": "dbd5caf6.9e8e48", | |
"type": "debug", | |
"z": "c6315211.08b09", | |
"name": "Contact sensor", | |
"active": false, | |
"console": "false", | |
"complete": "payload.state.openclose", | |
"x": 705, | |
"y": 562, | |
"wires": [] | |
}, | |
{ | |
"id": "b3e2925.7531d7", | |
"type": "function", | |
"z": "c6315211.08b09", | |
"name": "Deconz/contact/{{id}}", | |
"func": "var newmsg = {};\nnewmsg.payload = {};\nnewmsg.topic = {};\nnewmsg.topic = \"Deconz/contact/\"+msg.payload.id;\nif(msg.payload.state.contact === false){\n newmsg.payload = \"OFF\";\n}else{\n newmsg.payload = \"ON\";\n}\nreturn newmsg;", | |
"outputs": 1, | |
"noerr": 0, | |
"x": 925.1329956054688, | |
"y": 608.9609375, | |
"wires": [ | |
[ | |
"3d14459e.ffdf6a" | |
] | |
] | |
}, | |
{ | |
"id": "fab9e59c.5efbd8", | |
"type": "switch", | |
"z": "c6315211.08b09", | |
"name": "identify contact", | |
"property": "payload.state.openclose", | |
"propertyType": "msg", | |
"rules": [ | |
{ | |
"t": "nnull" | |
}, | |
{ | |
"t": "else" | |
} | |
], | |
"checkall": "true", | |
"outputs": 2, | |
"x": 503.6171875, | |
"y": 614.7108764648438, | |
"wires": [ | |
[ | |
"dbd5caf6.9e8e48", | |
"b3e2925.7531d7" | |
], | |
[ | |
"5c1440e5.cb9d3" | |
] | |
] | |
}, | |
{ | |
"id": "fe2b1b4e.5fa768", | |
"type": "debug", | |
"z": "c6315211.08b09", | |
"name": "", | |
"active": false, | |
"tosidebar": true, | |
"console": false, | |
"tostatus": false, | |
"complete": "false", | |
"x": 290, | |
"y": 60, | |
"wires": [] | |
}, | |
{ | |
"id": "78537012.405ec", | |
"type": "switch", | |
"z": "c6315211.08b09", | |
"name": "Is Config", | |
"property": "payload.config", | |
"propertyType": "msg", | |
"rules": [ | |
{ | |
"t": "nnull" | |
}, | |
{ | |
"t": "else" | |
} | |
], | |
"checkall": "true", | |
"repair": false, | |
"outputs": 2, | |
"x": 480, | |
"y": 180, | |
"wires": [ | |
[], | |
[ | |
"ccd2df84.6e492" | |
] | |
] | |
}, | |
{ | |
"id": "57178adb.f31d44", | |
"type": "debug", | |
"z": "c6315211.08b09", | |
"name": "Water Sensor", | |
"active": false, | |
"tosidebar": true, | |
"console": false, | |
"tostatus": false, | |
"complete": "payload.state.water", | |
"x": 700, | |
"y": 680, | |
"wires": [] | |
}, | |
{ | |
"id": "494aaa6e.6fb254", | |
"type": "function", | |
"z": "c6315211.08b09", | |
"name": "Deconz/water/{{id}}", | |
"func": "var newmsg = {};\nnewmsg.payload = {};\nnewmsg.topic = {};\nnewmsg.topic = \"Deconz/water/\"+msg.payload.id;\nif(msg.payload.state.water == false){\n newmsg.payload = \"OFF\";\n}else{\n newmsg.payload = \"ON\";\n}\nreturn newmsg;", | |
"outputs": 1, | |
"noerr": 0, | |
"x": 910.1329956054688, | |
"y": 726.9609375, | |
"wires": [ | |
[ | |
"3d14459e.ffdf6a" | |
] | |
] | |
}, | |
{ | |
"id": "5c1440e5.cb9d3", | |
"type": "switch", | |
"z": "c6315211.08b09", | |
"name": "identify water", | |
"property": "payload.state.water", | |
"propertyType": "msg", | |
"rules": [ | |
{ | |
"t": "nnull" | |
}, | |
{ | |
"t": "else" | |
} | |
], | |
"checkall": "true", | |
"repair": false, | |
"outputs": 2, | |
"x": 488.6171875, | |
"y": 732.7108764648438, | |
"wires": [ | |
[ | |
"57178adb.f31d44", | |
"494aaa6e.6fb254" | |
], | |
[] | |
] | |
}, | |
{ | |
"id": "9437396c.723f58", | |
"type": "websocket-client", | |
"z": "", | |
"path": "ws://172.16.33.10:443/", | |
"tls": "", | |
"wholemsg": "false" | |
}, | |
{ | |
"id": "79ae0f24.e78a8", | |
"type": "mqtt-broker", | |
"z": "", | |
"name": "", | |
"broker": "localhost", | |
"port": "1883", | |
"clientid": "", | |
"usetls": false, | |
"compatmode": true, | |
"keepalive": "15", | |
"cleansession": true, | |
"birthTopic": "", | |
"birthQos": "0", | |
"birthPayload": "", | |
"closeTopic": "", | |
"closePayload": "", | |
"willTopic": "", | |
"willQos": "0", | |
"willPayload": "" | |
} | |
] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://github.com/andreypopov/node-red-contrib-deconz