Thanks @Jay_Heavner and @kohai-ut for the clues.
Here is some node-red which
- at startup and occasionally thereafter:
- call HA’s device and entity list APIs
- looks for specific model of switches (Homeseer HS-WS200+ in my case)
- creates a node-red flow context with a dictionary to map a device id to its entity id for the switches that were found
- on zwave value events:
- set msg.event_source to the entity_id of the switch that was pressed by using the flow context created above
- set msg.double_click, msg.triple_click, … by decoding the event attributes
- set msg.on_click : true when “on” was pressed, false when “off” was pressed
Maybe this helps someone get started.
Here is the node-red JSON:
[{"id":"43a4b0ed.3f8d1","type":"debug","z":"fa216d06.aae75","name":"zwave scene","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":590,"y":100,"wires":[]},{"id":"39eee981.86142e","type":"change","z":"fa216d06.aae75","name":"","rules":[{"t":"move","p":"payload","pt":"msg","to":"event_payload","tot":"msg"},{"t":"set","p":"event_device","pt":"msg","to":"event_payload.event.device_id","tot":"msg"},{"t":"set","p":"double_click","pt":"msg","to":"event_payload.event.value_raw = 3","tot":"jsonata"},{"t":"set","p":"triple_click","pt":"msg","to":"event_payload.event.value_raw = 4","tot":"jsonata"},{"t":"set","p":"quad_click","pt":"msg","to":"event_payload.event.value_raw = 5","tot":"jsonata"},{"t":"set","p":"on_click","pt":"msg","to":"event_payload.event.property_key = \"001\"","tot":"jsonata"},{"t":"set","p":"event_source","pt":"msg","to":"$lookup($flowContext(\"device_to_entity_id\"), event_device)","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":420,"y":140,"wires":[["43a4b0ed.3f8d1","681ef4c3636b638e"]]},{"id":"4466591b81dad150","type":"server-events","z":"fa216d06.aae75","name":"","server":"1777b72c.cb0709","version":1,"event_type":"zwave_js_value_notification","exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"waitForRunning":true,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"$outputData(\"eventData\").event_type","valueType":"jsonata"},{"property":"event_type","propertyType":"msg","value":"$outputData(\"eventData\").event_type","valueType":"jsonata"}],"x":160,"y":140,"wires":[["39eee981.86142e"]]},{"id":"84bcd46297aa4f92","type":"debug","z":"fa216d06.aae75","name":"device to entity map","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":900,"y":40,"wires":[]},{"id":"2c5c24c896af9828","type":"inject","z":"fa216d06.aae75","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"43200","crontab":"","once":true,"onceDelay":"120","topic":"","payload":"","payloadType":"date","x":110,"y":40,"wires":[["1c942bd27e1091bb"]]},{"id":"32223a5e2c057a78","type":"ha-api","z":"fa216d06.aae75","name":"entity_registry","server":"1777b72c.cb0709","version":1,"debugenabled":false,"protocol":"websocket","method":"get","path":"","data":"{\"type\": \"config/entity_registry/list\"}","dataType":"jsonata","responseType":"json","outputProperties":[{"property":"entities","propertyType":"msg","value":"","valueType":"results"}],"x":480,"y":40,"wires":[["95b9851f2089019b"]]},{"id":"95b9851f2089019b","type":"function","z":"fa216d06.aae75","name":"device to entity map","func":"var switches_devs = {};\nmsg.switches_devs = switches_devs;\n\nvar i;\nvar dev;\nfor (i in msg.devices) {\n dev = msg.devices[i];\n if (dev.model == \"HS-WS200+\") {\n switches_devs[dev.id] = dev;\n }\n}\n\nvar device_to_entity = {};\nmsg.device_to_entity = device_to_entity;\nflow.set(\"device_to_entity\", device_to_entity);\nvar device_to_entity_id = {};\nmsg.device_to_entity_id = device_to_entity_id;\nflow.set(\"device_to_entity_id\", device_to_entity_id);\nvar ent;\nfor (i in msg.entities) {\n ent = msg.entities[i];\n if (ent.device_id in switches_devs && ent.entity_id.startsWith(\"switch.\")) {\n device_to_entity[ent.device_id] = ent;\n device_to_entity_id[ent.device_id] = ent.entity_id;\n }\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":680,"y":40,"wires":[["84bcd46297aa4f92"]]},{"id":"1c942bd27e1091bb","type":"ha-api","z":"fa216d06.aae75","name":"device_registry","server":"1777b72c.cb0709","version":1,"debugenabled":false,"protocol":"websocket","method":"get","path":"","data":"{\"type\": \"config/device_registry/list\"}","dataType":"jsonata","responseType":"json","outputProperties":[{"property":"devices","propertyType":"msg","value":"","valueType":"results"}],"x":280,"y":40,"wires":[["32223a5e2c057a78"]]},{"id":"681ef4c3636b638e","type":"link out","z":"fa216d06.aae75","name":"zwave scene","mode":"link","links":["0518473636085915","84083e19e77dd382","ad1b608561d8fe7c"],"x":575,"y":140,"wires":[]},{"id":"1777b72c.cb0709","type":"server","name":"Home Assistant","version":2,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true,"heartbeat":false,"heartbeatInterval":30}]