Skip to content

Instantly share code, notes, and snippets.

@fraser73
Created October 25, 2017 20:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fraser73/54b184ac0a570832bc90dfcc807ff5e1 to your computer and use it in GitHub Desktop.
Save fraser73/54b184ac0a570832bc90dfcc807ff5e1 to your computer and use it in GitHub Desktop.
Configure polling with open zwave

Demonstrates definition and use of zwave polling "enablePoll" of nodes in zwave network. Can be built on to enable other functions as well.

[{"id":"fd194699.c1b758","type":"inject","z":"efb6c051.73d03","name":"Trigger","topic":"Trigger","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"x":130,"y":1920,"wires":[["cb394c36.b40f38"]]},{"id":"cb394c36.b40f38","type":"function","z":"efb6c051.73d03","name":"Obtain global var (edit for specific node)","func":"//Enter node to dump as file or \"all\"\nvar dumpNode=\"all\";\n\nvar openzwaveNodes = global.get(\"openzwaveNodes\");\n\nif (dumpNode!=\"all\") {var valueResult = {payload: openzwaveNodes[dumpNode]};\n return valueResult;}\n else {\n var valueResult = {payload: openzwaveNodes};\n return valueResult;\n}\n\n","outputs":1,"noerr":0,"x":660,"y":1920,"wires":[["37870527.37cc5a"]]},{"id":"37870527.37cc5a","type":"debug","z":"efb6c051.73d03","name":"","active":true,"console":"false","complete":"true","x":990,"y":1920,"wires":[]},{"id":"2170cdff.4fe19a","type":"comment","z":"efb6c051.73d03","name":"Write zwave global variable out to file for debug","info":"","x":260,"y":1880,"wires":[]},{"id":"faf623cd.d4e16","type":"inject","z":"efb6c051.73d03","name":"enablePoll (node 1) Binary Switch","topic":"enablePoll","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"x":220,"y":1720,"wires":[["2d04ca10.d75d7e"]]},{"id":"d529a531.5e6c9","type":"zwave-out","z":"efb6c051.73d03","name":"/dev/zwave","controller":"15a41f3c.b5fba9","x":810,"y":1720,"wires":[["3d16cf8b.958a6"]]},{"id":"3d16cf8b.958a6","type":"debug","z":"efb6c051.73d03","name":"","active":true,"console":"false","complete":"true","x":990,"y":1720,"wires":[]},{"id":"d16f511c.b2afb8","type":"debug","z":"efb6c051.73d03","name":"","active":true,"console":"false","complete":"true","x":990,"y":1800,"wires":[]},{"id":"2d04ca10.d75d7e","type":"function","z":"efb6c051.73d03","name":"Build Object","func":"var returnMsg={\"topic\": \"enablePoll\", \"payload\": {\"args\": [1, 37, 1, 0]}};\nreturn returnMsg;\n","outputs":1,"noerr":0,"x":570,"y":1720,"wires":[["d529a531.5e6c9","d16f511c.b2afb8"]]},{"id":"c3300be.f19dbf8","type":"inject","z":"efb6c051.73d03","name":"enablePoll Thermostat (node 2) Temp","topic":"enablePoll","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"x":230,"y":1800,"wires":[["e9724d25.fea7c8"]]},{"id":"e9724d25.fea7c8","type":"function","z":"efb6c051.73d03","name":"Build Object","func":"var returnMsg={\"topic\": \"enablePoll\", \"payload\": {\"args\": [2, 67, 1, 1]}};\nreturn returnMsg;\n","outputs":1,"noerr":0,"x":570,"y":1800,"wires":[["d529a531.5e6c9","d16f511c.b2afb8"]]},{"id":"3d53862e.7a4c4a","type":"comment","z":"efb6c051.73d03","name":"Enable Polling","info":"In order to enable polling, the node, command class, command index and instance must be specified.\nThese aren't always obvious, so it's worth looking at the global zwave object to obtain these \nresults for each node, if it doesn't work first time.\n\nTrigger the obtain global var flow and then drill down through the object in the debug, to find out its abilities.\n\nNode 6\nClasses available include 37 (binary switch)\nThat class is on instance 1, index 0\n\nThis gives an enablePoll array setting of {6, 37, 1, 0). Anything else will generate an error.","x":150,"y":1680,"wires":[]},{"id":"4674875c.84106","type":"delay","z":"efb6c051.73d03","name":"","pauseType":"delay","timeout":"5","timeoutUnits":"minutes","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":380,"y":1760,"wires":[["2d04ca10.d75d7e","e9724d25.fea7c8"]]},{"id":"61e74f70.a8c47","type":"inject","z":"efb6c051.73d03","name":"Trigger at start","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":true,"x":160,"y":1760,"wires":[["4674875c.84106"]]},{"id":"15a41f3c.b5fba9","type":"zwave-controller","z":"","port":"/dev/zwave","driverattempts":"3","pollinterval":"10000","allowunreadyupdates":true,"logging":"full"}]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment