Node Red Consolidation

Hello,

I’m a novice to using Node Red and I’m looking for a way to condense the first step of this flow into a single node from all of the nodes that it is now.

I’m sure this is simple, but I don’t know how.

wait for some more informed person but, as far as I know, you can put a comma separated string of entities in the event state node as long as they share the same state for triggering. Change ‘Exact’ to ‘Substring’ and you’re good to go. It will trigger when device1 OR device2 change to on.

[{"id":"e4ffaf35.1a1f2","type":"server-state-changed","z":"b5f97a77.12c848","name":"state on","server":"9405c3fe.d0a6c","version":1,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"binary_sensor.device1, binary_sensor.device2","entityidfiltertype":"substring","outputinitially":false,"state_type":"str","haltifstate":"on","halt_if_type":"str","halt_if_compare":"is","outputs":2,"output_only_on_state_change":true,"x":1910,"y":300,"wires":[[],[]]},{"id":"9405c3fe.d0a6c","type":"server","z":"","name":"Home Assistant","addon":true}]

About the conditions, you could simplify them by doing the following. Check whether first condition is true… if it is, trigger alarm, if it isn’t true, check whether second condition is true… and so on

I think you could create a group and place all of those sensors into the group, then just check for a state change on the group. I haven’t done this, but I believe a change of any entity in the group will then initiate the trigger.

A second option is to use a wildcard to listen for a change in any matching device. The one below I’m using to listen for any zone change from 3 different phones. You may need 2 of those - one for doors (binary_sensor\.door+) and one for windows (binary_sensor\.window+.), depending on how you have them named.

or put them in a group within HA and test the group

Hey, how can I enable this menu?

Yes I like to know also
Never seen this menu
I also missing “for”

Read up on Sub-Flows this will help reduce the clutter. Happy New year!

As you are on HA forum, I guess you are also using Home assistant. In this case, I would suggest using one of the alarm integration (alarmo, bwalarm74,…) this will do the “consolidation” for you.
Then, it will trigger the flow without having all states there.

Unknown. This is what I thought was the default State Node that came with the Node-Red Add-On.

Update:
It looks like that’s a sub-node of the node-red-contrib-home-assistant-websocket
v 0.27.9

1 Like

Wow thanks, I just updated the NR addon and it’s showing up, really beautiful

Not sure this will work since (to my knowledge) when a device inside is “on” the group is “on”. So when a device inside the group is triggered the group state is not updated. If will only be updated all the devices inside the group goes to “off” , the group goes to off.

here are my groups to give you an idea on how it works … scroll down for the motion panel/group

Parents:
  name: Parents
  entities:
    - device_tracker.phonelee
    - device_tracker.carolines_iphone
 
family:
  name: Family
  entities:
    - device_tracker.phonelee
    - device_tracker.carolines_iphone
    - device_tracker.blakes_iphone 
    - device_tracker.aimees_iphone



LoungeLamps:
  entities:
    - light.lightbulb_01
    - light.lightbulb_02
    - switch.wire_light
    - switch.cupboard_light




motionpanel:
  name: Motion
  entities:
    - binary_sensor.motion_sensor_158d00016d5813
    - binary_sensor.motion_sensor_158d0001231c9b
    - binary_sensor.motion_sensor_158d00016be379
    - binary_sensor.motion_sensor_158d00015da5fd
    - binary_sensor.motion_sensor_158d000171cce3
    - binary_sensor.motion_sensor_158d0001db087a
    - binary_sensor.motion_sensor_158d00016bff3e
    - binary_sensor.door_window_sensor_158d00014d20b8
    - binary_sensor.door_window_sensor_158d0001d682cc

here is my node Red for the alarm

note: the logic for the actual detection is around the wrong way … should test for ‘on’

I got it … going to change some my automations (simplify them). Thnx