A sensor of binary sensors to use in automation?

First up, I’m trying to accomplish an automation that will set off my siren and strobe device if a door or window are opened.

I have the siren setup and working as a switch that I’m able to toggle on/off in Home Assistant. I have the door/window sensors setup as binary_devices and they’re working great as well.

I have the SmartThings SmartHome Monitor (SHM) <-> Home Assistant MQTT setup working where I can see/change my home/away/disarmed mode. But there isn’t currently (from what I could find) a method to trigger when a device is tripped while in home/away mode, so I’m essentially looking to rebuild this functionality within Home Assistant.

I even have an automation that works.

But my currently working automation is more of a “tester” and I’m hoping there might be a better way to fully implement it. My current automation is setup to look at 3 open/close sensors, but my home has… at least 20? Maybe even more than 30, and I’ll be adding more soon. I’d like to setup the automation to look at any door/window binary_sensor, but I’m happy to manually add them to a group to ensure I’m only looking at the binary_sensors I really want to look at (initially I was considering a for-loop to just look for any binary_sensor, but I could foresee that becoming an issue if I had a motion sensor I didn’t want to trigger the siren).

Is there a way to setup an automation to look at a group of binary_sensors and “trigger” based on the state of any device within that group changing without manually adding each one of them as separate entity_id entries "OR"d together in the automation?

Thanks!
-Chad

This might help, I think if all entities in a group are the same state, the group is that state, otherwise its unknown. This should work for triggering an alarm.

1 Like

Thank you! That’s perfect!

For completeness, here’s my automation:
alarm.yaml:

# Strobe alert when alarm triggered in home mode
- alias: "Alarm Triggered Home Mode"
  initial_state: True
  trigger:
    platform: state
    entity_id: group.door_and_window_sensors_house
    from: 'off'
    to: 'on'
  condition:
    condition: state
    entity_id: alarm_control_panel.alarm_system
    state: 'armed_home'
  action:
    - service: switch.turn_on
      entity_id: switch.zwave_siren_strobe
1 Like