Homekit Z-wave (and more) integration

This flow shows how to use Z-wave node with homekit and possible other sources that could turn on and off the Z-wave node. The hardware is a Z-wave node controlled through a Z-wave USB stick. Homekit node is added to have Z-wave status in the home app in iphone and get support for siri. The Z-wave node can be controlled with siri or in the home app. It can also be controlled with input from any other node that can send payload of 0 or 1. Also if the lamp button on the wall is switched the homekit status will change.

Found a small bug and is fixed. My zwave sometimes received more than one answer from the hardware node into the zwave in node.

[{"id":"b361406f.5f366","type":"zwave-out","z":"ba5d3350.389f","name":"ZW out","controller":"af69749e.2d03f8","x":1520,"y":300,"wires":[[]]},{"id":"d8aca14e.24f3d","type":"delay","z":"ba5d3350.389f","name":"","pauseType":"rate","timeout":"5","timeoutUnits":"seconds","rate":"2","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":1350,"y":300,"wires":[["b361406f.5f366"]]},{"id":"e353d849.aa19e8","type":"rbe","z":"ba5d3350.389f","name":"","func":"rbe","gap":"","start":"","inout":"out","x":1190,"y":300,"wires":[["d8aca14e.24f3d"]]},{"id":"2518a58e.06280a","type":"change","z":"ba5d3350.389f","name":"Lamp hallway 1 ID5 INS 1","rules":[{"t":"set","p":"payload","pt":"msg","to":"'{\"nodeid\":5, \"instance\":1, \"value\":' & msg.payload & '}'\t","tot":"jsonata"},{"t":"set","p":"topic","pt":"msg","to":"setValue","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":990,"y":300,"wires":[["e353d849.aa19e8"]]},{"id":"5d733253.fa255c","type":"change","z":"ba5d3350.389f","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.On","tot":"msg"},{"t":"delete","p":"hap","pt":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":760,"y":300,"wires":[["2518a58e.06280a"]]},{"id":"815fa5ee.50c318","type":"homekit-service","z":"ba5d3350.389f","accessory":"ede2c148.eec39","name":"Hallway 1","serviceName":"Outlet","x":566.6666603088379,"y":284.4444580078125,"wires":[["5d733253.fa255c"]]},{"id":"fb1ed611.fa9458","type":"inject","z":"ba5d3350.389f","name":"","topic":"","payload":"{\"On\":1}","payloadType":"json","repeat":"","crontab":"","once":false,"x":400,"y":300,"wires":[["815fa5ee.50c318"]]},{"id":"8743a187.9ec26","type":"inject","z":"ba5d3350.389f","name":"","topic":"","payload":"{\"On\":0}","payloadType":"json","repeat":"","crontab":"","once":false,"x":400,"y":260,"wires":[["815fa5ee.50c318"]]},{"id":"723cb07b.e7439","type":"change","z":"ba5d3350.389f","name":"ID5 INS 1","rules":[{"t":"set","p":"ID5_1","pt":"global","to":"payload","tot":"msg"},{"t":"set","p":"payload","pt":"msg","to":"{\"On\": msg.payload }","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":400,"y":360,"wires":[["815fa5ee.50c318"]]},{"id":"a8e8848e.88f6f8","type":"link in","z":"ba5d3350.389f","name":"","links":["3d5585e3.1d5eaa","b33b0bf5.ec9848","c0e5c27a.fdc36"],"x":295,"y":360,"wires":[["723cb07b.e7439"]]},{"id":"739cbb45.565cb4","type":"zwave-in","z":"ba5d3350.389f","name":"ZW in","controller":"af69749e.2d03f8","x":210,"y":500,"wires":[["a164a3a.94d646"]]},{"id":"a164a3a.94d646","type":"switch","z":"ba5d3350.389f","name":"value changed","property":"topic","propertyType":"msg","rules":[{"t":"eq","v":"zwave: value changed","vt":"str"}],"checkall":"true","outputs":1,"x":380,"y":500,"wires":[["f4449b1a.89ded8"]]},{"id":"f4449b1a.89ded8","type":"switch","z":"ba5d3350.389f","name":"label Switch","property":"payload.label","propertyType":"msg","rules":[{"t":"eq","v":"Switch","vt":"str"}],"checkall":"true","outputs":1,"x":550,"y":500,"wires":[["ccf1f19c.ea695"]]},{"id":"ccf1f19c.ea695","type":"change","z":"ba5d3350.389f","name":"","rules":[{"t":"set","p":"payload.state","pt":"msg","to":"payload.currState","tot":"msg"},{"t":"change","p":"payload.state","pt":"msg","from":"false","fromt":"bool","to":"0","tot":"num"},{"t":"change","p":"payload.state","pt":"msg","from":"true","fromt":"bool","to":"1","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":760,"y":500,"wires":[["66f0d383.cd188c"]]},{"id":"66f0d383.cd188c","type":"switch","z":"ba5d3350.389f","name":"Nodeid","property":"payload.nodeid","propertyType":"msg","rules":[{"t":"eq","v":"3","vt":"num"},{"t":"eq","v":"5","vt":"num"},{"t":"eq","v":"6","vt":"num"},{"t":"eq","v":"7","vt":"num"}],"checkall":"true","outputs":4,"x":940,"y":500,"wires":[[],["a4b3a2af.fcaac"],[],[]]},{"id":"a4b3a2af.fcaac","type":"switch","z":"ba5d3350.389f","name":"Instance","property":"payload.instance","propertyType":"msg","rules":[{"t":"eq","v":"1","vt":"num"},{"t":"eq","v":"2","vt":"num"}],"checkall":"true","outputs":2,"x":1120,"y":480,"wires":[["ff6c9c53.cc75a"],[]]},{"id":"ff6c9c53.cc75a","type":"trigger","z":"ba5d3350.389f","op1":"","op2":"","op1type":"nul","op2type":"payl","duration":"250","extend":true,"units":"ms","reset":"","name":"","x":1300,"y":460,"wires":[["2d7e5a2.d7bd3a6"]]},{"id":"2d7e5a2.d7bd3a6","type":"change","z":"ba5d3350.389f","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.state","tot":"msg"},{"t":"delete","p":"topic","pt":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1500,"y":460,"wires":[["828dc1eb.3b1fc","e877e394.dbb2f","cebcaeb8.47586"]]},{"id":"cebcaeb8.47586","type":"rbe","z":"ba5d3350.389f","name":"","func":"rbe","gap":"","start":"","inout":"out","x":1750,"y":400,"wires":[["b33b0bf5.ec9848"]]},{"id":"b33b0bf5.ec9848","type":"link out","z":"ba5d3350.389f","name":"Out ID5 INS 1","links":["a8e8848e.88f6f8"],"x":1855,"y":400,"wires":[]},{"id":"828dc1eb.3b1fc","type":"ui_text","z":"ba5d3350.389f","group":"fa423119.5a753","order":2,"width":0,"height":0,"name":"Hallway 1","label":"Hallway 1","format":"{{msg.payload}}","layout":"row-spread","x":1760,"y":440,"wires":[]},{"id":"e877e394.dbb2f","type":"change","z":"ba5d3350.389f","name":"ID5 INS 1","rules":[{"t":"set","p":"ID5_1","pt":"global","to":"payload.state","tot":"msg"},{"t":"set","p":"payload","pt":"msg","to":"{\"On\": msg.payload.state }","tot":"jsonata"},{"t":"delete","p":"topic","pt":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1760,"y":480,"wires":[[]]},{"id":"355ee532.fd497a","type":"comment","z":"ba5d3350.389f","name":"Input payload of 0 or 1","info":"","x":360,"y":400,"wires":[]},{"id":"98fa29f9.4fa7e8","type":"comment","z":"ba5d3350.389f","name":"Change ID to your own node","info":"","x":900,"y":120,"wires":[]},{"id":"af69749e.2d03f8","type":"zwave-controller","z":"","port":"/dev/ttyACM0","driverattempts":"3","pollinterval":"10000","allowunreadyupdates":false,"logging":"minimal"},{"id":"ede2c148.eec39","type":"homekit-accessory","z":"","accessoryName":"Hallen 2","pinCode":"111-11-999","port":"","manufacturer":"Default Manufacturer","model":"Default Model","serialNo":"Default Serial Number","accessoryType":"7"},{"id":"fa423119.5a753","type":"ui_group","z":"","name":"Lampor","tab":"2d1b6d1f.cf2152","order":4,"disp":true,"width":"3"},{"id":"2d1b6d1f.cf2152","type":"ui_tab","z":"","name":"Home","icon":"dashboard"}]

Collection Info

Flow Info

Created 7 years ago
Rating: not yet rated

Owner

Actions

Rate:

Node Types

Core
  • change (x6)
  • comment (x2)
  • delay (x1)
  • inject (x2)
  • link in (x1)
  • link out (x1)
  • rbe (x2)
  • switch (x4)
  • trigger (x1)
Other
  • homekit-accessory (x1)
  • homekit-service (x1)
  • ui_group (x1)
  • ui_tab (x1)
  • ui_text (x1)
  • zwave-controller (x1)
  • zwave-in (x1)
  • zwave-out (x1)

Tags

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