-
-
Notifications
You must be signed in to change notification settings - Fork 21
/
blubutton4.json
1 lines (1 loc) · 3.51 KB
/
blubutton4.json
1
[{"id":"5ae5ea9d59cabfd2","type":"shelly-gen2","z":"62a53d6e4cbdfb9a","hostname":"192.168.178.76","description":"ShellyBluGateway","mode":"callback","verbose":false,"server":"7f2759a4fe573634","outputmode":"event","uploadretryinterval":5000,"pollinginterval":5000,"pollstatus":false,"getstatusoncommand":false,"devicetype":"SNGW-BT01","devicetypemustmatchexactly":false,"captureblutooth":true,"outputs":1,"x":330,"y":100,"wires":[["cca090e1ec3df949","1036e2e1278be0a8"]]},{"id":"cc48394b6f62d257","type":"debug","z":"62a53d6e4cbdfb9a","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1050,"y":100,"wires":[]},{"id":"47a53d4373d2f908","type":"inject","z":"62a53d6e4cbdfb9a","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":160,"y":100,"wires":[["5ae5ea9d59cabfd2"]]},{"id":"cca090e1ec3df949","type":"function","z":"62a53d6e4cbdfb9a","name":"filter for BLU events","func":"if(msg.payload.info){\n let isBluMessage = msg.payload.info.event === \"shelly-blu\";\n if (isBluMessage){\n node.send([msg, null]);\n }\n}\nelse{\n node.send([null, msg]);\n}\n","outputs":2,"timeout":"","noerr":0,"initialize":"","finalize":"","libs":[],"x":570,"y":100,"wires":[["274ab400bebe2077"],["659e6672bcb7be07"]]},{"id":"93977f546b1ba812","type":"debug","z":"62a53d6e4cbdfb9a","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1050,"y":60,"wires":[]},{"id":"274ab400bebe2077","type":"function","z":"62a53d6e4cbdfb9a","name":"switch RC button 4","func":"// see also https://shelly-api-docs.shelly.cloud/docs-ble/Devices/wall_us/\n\n// TODO: adapt your mac addresses here\nlet rcbutton4 = \"7c:c6:b6:75:1b:1d\";\n\nif (msg.payload.info.data.address == rcbutton4){\n let buttons = msg.payload.info.data.button;\n\n let messages = [];\n\n for(let i=0; i<buttons.length; i++){\n let button = buttons[i];\n\n // we filter away no action and button down\n if(button != 0x00 && button != 0xFE){\n let newMsg = { payload: button }\n messages.push(newMsg);\n } else {\n messages.push(null);\n }\n }\n\n node.send(messages);\n}\n","outputs":4,"timeout":"","noerr":0,"initialize":"","finalize":"","libs":[],"x":850,"y":80,"wires":[["93977f546b1ba812"],["cc48394b6f62d257"],["fc5f78a1987deb87"],["483beb35d8609845"]]},{"id":"659e6672bcb7be07","type":"debug","z":"62a53d6e4cbdfb9a","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1030,"y":260,"wires":[]},{"id":"1036e2e1278be0a8","type":"debug","z":"62a53d6e4cbdfb9a","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1030,"y":300,"wires":[]},{"id":"fc5f78a1987deb87","type":"debug","z":"62a53d6e4cbdfb9a","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1050,"y":140,"wires":[]},{"id":"483beb35d8609845","type":"debug","z":"62a53d6e4cbdfb9a","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1050,"y":180,"wires":[]},{"id":"7f2759a4fe573634","type":"shelly-gen2-server","port":"20000","hostname":"","hostip":"192.168.178.121"}]