Listening for all keypresses?

I'm new to Node Red, so apologies if this is blatantly obvious to others.

I want a simple automation where if I triple click down on any light switch (dimmer or switch) in the house, all of the lights turn off. Good news is I have this working (well...kinda)! :slight_smile:

But I'm unsure of the following:

  1. Is there a more efficient way of doing this? I'm worried perhaps my approach isn't great.
  2. I'd like to ignore this for 2 or 3 switches, but I'm not sure how to add that to this flow
  3. Are all of these events logged? When I turn on all the lights/fans in the house, I find that a) it takes a really long time to turn them all off and b) some don't turn off. But I'm not sure how to debug what's going on.
[{"id":"b88860e25be046b0","type":"tab","label":"All Lights Off","disabled":false,"info":"","env":[]},{"id":"94a88fb7ee98feec","type":"inject","z":"b88860e25be046b0","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":460,"y":580,"wires":[[]]},{"id":"3d5d1d1aed13ec8c","type":"ha-get-entities","z":"b88860e25be046b0","name":"get lights that are on","server":"7114fde5.02aa54","version":0,"rules":[{"property":"entity_id","logic":"starts_with","value":"light.","valueType":"str"},{"property":"state","logic":"is","value":"on","valueType":"str"}],"output_type":"array","output_empty_results":false,"output_location_type":"msg","output_location":"payload","output_results_count":1,"x":320,"y":160,"wires":[["098f15ac1853c245"]]},{"id":"098f15ac1853c245","type":"api-call-service","z":"b88860e25be046b0","name":"turn lights off","server":"7114fde5.02aa54","version":5,"debugenabled":false,"domain":"light","service":"turn_off","areaId":[],"deviceId":[],"entityId":[],"data":"{\"entity_id\": $join(payload.entity_id, \",\")}","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":510,"y":220,"wires":[[]]},{"id":"9b4f15e000925d96","type":"server-events","z":"b88860e25be046b0","name":"all lights triple click down (except theater closet)","server":"7114fde5.02aa54","version":2,"eventType":"zwave_js_value_notification","exposeToHomeAssistant":false,"eventData":"{\"value\":\"KeyPressed3x\",\"property_key\":\"001\"}","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"}],"event_type":"","x":180,"y":240,"wires":[["92f92829d5c1d782","3d5d1d1aed13ec8c"]]},{"id":"92f92829d5c1d782","type":"ha-get-entities","z":"b88860e25be046b0","name":"get fans that are on","server":"7114fde5.02aa54","version":0,"rules":[{"property":"entity_id","logic":"starts_with","value":"fan.","valueType":"str"},{"property":"state","logic":"is","value":"on","valueType":"str"}],"output_type":"array","output_empty_results":false,"output_location_type":"msg","output_location":"payload","output_results_count":1,"x":310,"y":320,"wires":[["4a67b2a4b7c68799"]]},{"id":"4a67b2a4b7c68799","type":"api-call-service","z":"b88860e25be046b0","name":"turn fans off","server":"7114fde5.02aa54","version":5,"debugenabled":false,"domain":"fan","service":"turn_off","areaId":[],"deviceId":[],"entityId":[],"data":"{\"entity_id\": $join(payload.entity_id, \",\")}","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":510,"y":280,"wires":[[]]},{"id":"24773876dc609804","type":"debug","z":"b88860e25be046b0","name":"debug 1","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":400,"y":480,"wires":[]},{"id":"7114fde5.02aa54","type":"server","name":"Home Assistant","addon":true}]

Thanks!

If I import your flow into a typical Node-red installation I get this:

Everything except the inject and debug nodes is "Unknown".

You will probably find more people familiar with how things work in Home Assistant on the Home Assistant forum.

Weird...I just exported the current flow, which looks like this for me:

That's because you have Home Assistant and I don't.

I am sure there are HA users on this forum, but most people here just use Node-red.

Welcome to the Forum, @anikkar.

I'm afraid you have tripped over a couple of the obstacles described in this FAQ. You will almost certainly get more help with this issue on the Home Assistant forum, but you can expect lots of support on Node-RED issues here if you follow that advice.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.