-
Notifications
You must be signed in to change notification settings - Fork 1
/
HEmonitorMessages.json
1 lines (1 loc) · 5.24 KB
/
HEmonitorMessages.json
1
[{"id":"6673bb7f.f431e4","type":"tab","label":"Monitor HE message","disabled":false,"info":""},{"id":"2a879b7d.ca5c64","type":"inject","z":"6673bb7f.f431e4","name":"Every 5 minutes","topic":"","payload":"","payloadType":"date","repeat":"300","crontab":"","once":true,"onceDelay":0.1,"x":174,"y":44,"wires":[["ca67490d.5c37a8"]]},{"id":"ca67490d.5c37a8","type":"change","z":"6673bb7f.f431e4","name":"Stamp","rules":[{"t":"set","p":"starttime","pt":"msg","to":"","tot":"date"}],"action":"","property":"","from":"","to":"","reg":false,"x":357,"y":63,"wires":[["b4667aa9.594ab8","c9852450.f64f68","e3e6e5a0.566fc8"]]},{"id":"b4667aa9.594ab8","type":"http request","z":"6673bb7f.f431e4","name":"Get App List ZWave Hub","method":"GET","ret":"obj","paytoqs":false,"url":"http://192.168.10.153/hub/messages","tls":"","proxy":"","authType":"basic","x":190,"y":135,"wires":[["d0bbff5.f006"]]},{"id":"54cbb656.40a9f8","type":"change","z":"6673bb7f.f431e4","name":"Stamp","rules":[{"t":"set","p":"endtime","pt":"msg","to":"","tot":"date"}],"action":"","property":"","from":"","to":"","reg":false,"x":604,"y":136,"wires":[["48a2eea8.9bbd6","b5fe12d2.4372a"]]},{"id":"48a2eea8.9bbd6","type":"debug","z":"6673bb7f.f431e4","name":"","active":false,"tosidebar":true,"console":true,"tostatus":false,"complete":"true","targetType":"full","x":759,"y":141,"wires":[]},{"id":"3f0028c4.f8ede8","type":"pushover","z":"6673bb7f.f431e4","name":"","device":"","title":"","priority":0,"sound":"","url":"","url_title":"","html":false,"x":667,"y":528,"wires":[]},{"id":"78b86459.05239c","type":"change","z":"6673bb7f.f431e4","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"msg.topic","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":566,"y":456,"wires":[["3f0028c4.f8ede8"]]},{"id":"c9852450.f64f68","type":"http request","z":"6673bb7f.f431e4","name":"Get App List Coordinator Hub","method":"GET","ret":"obj","paytoqs":false,"url":"http://192.168.10.169/hub/messages","tls":"","proxy":"","authType":"basic","x":209,"y":210,"wires":[["3ef068f8.086598"]]},{"id":"3ef068f8.086598","type":"change","z":"6673bb7f.f431e4","name":"","rules":[{"t":"set","p":"hub","pt":"msg","to":"Coordinator","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":452,"y":211,"wires":[["54cbb656.40a9f8"]]},{"id":"d0bbff5.f006","type":"change","z":"6673bb7f.f431e4","name":"","rules":[{"t":"set","p":"hub","pt":"msg","to":"ZWave","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":428,"y":136,"wires":[["54cbb656.40a9f8"]]},{"id":"e3e6e5a0.566fc8","type":"http request","z":"6673bb7f.f431e4","name":"Get App List Zigbee Hub","method":"GET","ret":"obj","paytoqs":false,"url":"http://192.168.10.170/hub/messages","tls":"","proxy":"","authType":"basic","x":186,"y":277,"wires":[["b13714c0.033c28"]]},{"id":"b13714c0.033c28","type":"change","z":"6673bb7f.f431e4","name":"","rules":[{"t":"set","p":"hub","pt":"msg","to":"Zigbee","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":453,"y":278,"wires":[["54cbb656.40a9f8"]]},{"id":"b5fe12d2.4372a","type":"function","z":"6673bb7f.f431e4","name":"Analyze Response","func":"var hubData = flow.get(msg.hub) || {};\nmsg.newData = true;\nhubData.hub = msg.hub;\n//node.warn(hubData);\n\nif (msg.statusCode == 200)\n{\n if ((!msg.payload.messages) || (msg.payload.messages.length === 0))\n {\n msg.payload.messages[0] = 'all clear';\n }\n}\nelse\n{\n msg.newData = false;\n}\nif ((msg.payload) && (msg.payload.messages) && (msg.newData === true))\n{\n if (msg.payload.messages.length)\n {\n if (hubData.messages)\n {\n if (msg.payload.messages.length == hubData.messages.length && msg.payload.messages.every(function(u, i) {\n return u === hubData.messages[i];\n })\n ) {\n msg.newData = false;\n } else {\n msg.messages = msg.payload.messages;\n } \n }\n else\n {\n msg.messages = msg.payload.messages;\n }\n }\n hubData.messages = msg.payload.messages;\n}\nelse\n{\n msg.newData = false;\n}\n//node.warn(hubData);\nmsg.topic = \"Hub \" + msg.hub + \" messages: \" + hubData.messages.join(\", \");\n\nflow.set(msg.hub, hubData);\nreturn msg;\n","outputs":1,"noerr":0,"x":703,"y":205,"wires":[["945953e5.c1f3d","c86cb8c5.612268"]]},{"id":"d7a1f5c0.9b2bf8","type":"inject","z":"6673bb7f.f431e4","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":140,"y":575,"wires":[["e5438a56.9bd828"]]},{"id":"e5438a56.9bd828","type":"function","z":"6673bb7f.f431e4","name":"","func":"flow.set('Coordinator', null);\nflow.set('ZWave', null);\nflow.set('Zigbee', null);\n\nreturn msg;","outputs":1,"noerr":0,"x":303,"y":581,"wires":[[]]},{"id":"945953e5.c1f3d","type":"switch","z":"6673bb7f.f431e4","name":"Only when new messages","property":"newData","propertyType":"msg","rules":[{"t":"true"},{"t":"false"}],"checkall":"false","repair":false,"outputs":2,"x":754,"y":279,"wires":[["c86cb8c5.612268","78b86459.05239c"],[]]},{"id":"c86cb8c5.612268","type":"debug","z":"6673bb7f.f431e4","name":"","active":false,"tosidebar":true,"console":true,"tostatus":false,"complete":"true","targetType":"full","x":957,"y":193,"wires":[]}]