What Node(s)/Approach for Implementing Automation Override Based on Manual Switch Input

Tl;dr question/summary: What node would be recommended if I am trying to "gate" output from an automation flow, where the gate (either allows something through or not) is changed based on an event detected? In this case, the event is whether a zwave scene has been selected from a light switch.

BACKGROUND
I currently have this flow working (well, the sensor may be changed out, but the flow works :slight_smile:):

[{"id":"f32eceb9.961ec","type":"stoptimer","z":"6b3ec0df.41f908","duration":"3","units":"Minute","payloadtype":"num","payloadval":"0","name":"","x":420,"y":240,"wires":[["8cc57554.02c0d","9302bbaf.46e72"],[]]},{"id":"f6749d4c.b63d08","type":"switch","z":"6b3ec0df.41f908","name":"switch","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"on","vt":"str"},{"t":"eq","v":"off","vt":"str"}],"checkall":"false","repair":false,"outputs":2,"x":230,"y":180,"wires":[["f32eceb9.961ec","6697113d.27c11"],["f32eceb9.961ec"]]},{"id":"8cc57554.02c0d","type":"api-call-service","z":"6b3ec0df.41f908","name":"OFF: Counter LEDs","server":"480b0678.d07368","version":1,"debugenabled":false,"service_domain":"switch","service":"turn_off","entityId":"switch.kitchen_counter","data":"","dataType":"json","mergecontext":"","output_location":"payload","output_location_type":"msg","mustacheAltTags":false,"x":650,"y":240,"wires":[[]],"icon":"font-awesome/fa-life-bouy"},{"id":"9302bbaf.46e72","type":"api-call-service","z":"6b3ec0df.41f908","name":"OFF: Kitchen Overhead","server":"480b0678.d07368","version":1,"debugenabled":false,"service_domain":"light","service":"turn_off","entityId":"light.kitchen_dimmer_switch_inovelli_lzw31_sn_level","data":"{\"transition\":\"1\"}","dataType":"json","mergecontext":"","output_location":"payload","output_location_type":"msg","mustacheAltTags":false,"x":680,"y":300,"wires":[[]],"icon":"font-awesome/fa-life-bouy"},{"id":"368b624a.bb18fe","type":"server-state-changed","z":"6b3ec0df.41f908","name":"Sonar (kitchen)","server":"480b0678.d07368","version":1,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"binary_sensor.kitchen_refrigerator_sonar_sensor","entityidfiltertype":"substring","outputinitially":false,"state_type":"str","haltifstate":"","halt_if_type":"str","halt_if_compare":"is","outputs":1,"output_only_on_state_change":true,"x":100,"y":120,"wires":[["2f91a3b9.e3b8fc","f6749d4c.b63d08"]]},{"id":"6697113d.27c11","type":"api-current-state","z":"6b3ec0df.41f908","name":"Counter LEDs ON?","server":"480b0678.d07368","version":1,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"switch.kitchen_counter","state_type":"str","state_location":"","override_payload":"msg","entity_location":"","override_data":"msg","blockInputOverrides":false,"x":430,"y":180,"wires":[[],["3269c01.ad8554"]],"icon":"font-awesome/fa-life-bouy"},{"id":"fa408424.eecb2","type":"inject","z":"6b3ec0df.41f908","name":"Inject: off","props":[{"p":"payload","v":"off","vt":"str"},{"p":"topic","v":"","vt":"string"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"off","payloadType":"str","x":420,"y":300,"wires":[["8cc57554.02c0d","9302bbaf.46e72"]]},{"id":"2f91a3b9.e3b8fc","type":"debug","z":"6b3ec0df.41f908","name":"","active":false,"tosidebar":true,"console":false,"tostatus":true,"complete":"true","targetType":"full","statusVal":"payload","statusType":"auto","x":270,"y":120,"wires":[]},{"id":"3269c01.ad8554","type":"api-call-service","z":"6b3ec0df.41f908","name":"ON: Counter LEDs","server":"480b0678.d07368","version":1,"debugenabled":false,"service_domain":"switch","service":"turn_on","entityId":"switch.kitchen_counter","data":"","dataType":"json","mergecontext":"","output_location":"payload","output_location_type":"msg","mustacheAltTags":false,"x":710,"y":140,"wires":[[]],"icon":"font-awesome/fa-life-bouy"},{"id":"ed9eef9e.32f7e","type":"inject","z":"6b3ec0df.41f908","name":"Inject: on","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"on","payloadType":"msg","x":440,"y":120,"wires":[["3269c01.ad8554"]]},{"id":"480b0678.d07368","type":"server","z":"","name":"Home Assistant","legacy":false,"addon":false,"rejectUnauthorizedCerts":false,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":false,"cacheJson":false}]

Operation (current)—The kitchen counter LEDs turn on when it detects my presence and there is a delay of 3 minutes after no movement detection before the LEDs automatically turn off. It also turns off the kitchen overhead lights at the same time if, for example, I turned them on when I walked into the kitchen so I have all kitchen lighting automatically turn off.

ISSUE
The problem is that sometimes I want to have the kitchen overhead lights stay on even if no motion is detected and the 3-minute timer expires. Currently, the kitchen overhead lights are being controlled by an Inovelli Dimmer Red Series (LZW31-SN), which allows different "scenes" to be reported depending on the number of times I press the "on"-portion of the paddle [1,2]. For example, I can quickly press the up-portion of the paddle 2x to select scene 2. Thus:

Operation (desired)—The currently working operation (as described above), modified by:

  1. I select scene 2 manually using Inovelli switch for kitchen overhead lights (double-tap the up-portion of the paddle).
  2. Scene-detection happens
  3. If detected scene=2, then not allow automation pictured above to turn off kitchen overhead lights.

I believe I can figure out the scene detection (esp. using the Inovelli node [3]), but what can I use to gate the input between the output of the 3-minute timer and svc call to turn off the Kitchen Overhead?

I saw a simple gate node I can import [4], but wondering if there is another approach where I don’t have to add yet-another node to the palette.

References
[1] https://community.home-assistant.io/t/node-red-my-experience-so-far/54146
[2] https://support.inovelli.com/portal/en/kb/articles/how-to-setting-up-scenes-in-home-assistant
[3] https://flows.nodered.org/node/node-red-contrib-inovelli-nodes
[4] https://flows.nodered.org/node/node-red-contrib-simple-gate

1 Like

You could possibly use a switch node ? https://cookbook.nodered.org/basic/route-on-context

Are you saying:

  1. Store the scene_data using a change node to, for example, a global context variable (e.g., current_kitchen_scene_data)
  2. Use the switch node to look at the current_kitchen_scene_data and pass (or don't pass) the turn_off event to the kitchen switch node?

That's the approach I've taken in mine for maximum flexibility of where I use the Switch node checks.

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