Why can't I group my security 'door/window/motion' sensors so I can select them as a group for automation?

Or be able to tag them as such so I can just say if ‘perimeter sensor’ triggered then sound alarm. Selecting or copying the entities for each triggered event is time consuming especially if you forget one when you have 30+ sensors for windows and doors.

So there is a bit of a hack for this that I found a while ago.

I have several buttons throughout my house. They all support at least one click (most are just single/double, but some are 3+). I didn’t want to keep adding multiple entity IDs to the automation as i moved / added switches so I thought that i’d just use a single group… which it turns out you can’t really do.

The hack is to subscribe too all events and then filter them out as you can see if the trigger entity_id is in a group. Its a hacky mess, but it does work.

 # See: https://community.home-assistant.io/t/how-to-use-for-entity-id-in-group-in-automation/46279/13
 - id: my-dedicated-buttons-buttons-switch-thing-on
   alias: any of the dedicated buttons toggle the fan on
        platform: event
        event_type: state_changed
     condition: and
        - condition: state
            entity_id: switch.my_fan
            state: "off"
        - condition: template
            # We only want a SINGLE press to toggle on. ignore double presses!
            value_template: "{{ trigger.event.data.entity_id in state_attr('group.dedicated_button_group','entity_id') and states(trigger.event.data.entity_id) in ['single']}}"
        - service: switch.turn_on

It would be a lot better, though, if any entity in a group could be used as a trigger.

You can.

The ask is not how too set up groups, it’s how to use a group as the trigger entity.

You can use groups as the trigger just as any other entity.

Is this new-ish?

No, groups are part of home assistant for probably 5 years already.


I’ve been using this approach since Nov 2019.


    - binary_sensor.family_room_patio_door_alarm
    - binary_sensor.fence_gate_alarm
    - binary_sensor.front_door_alarm
    - binary_sensor.garage_entry_door_alarm
    - binary_sensor.left_garage_door_sensor
    - binary_sensor.right_garage_door_alarm


- id: '1574642382202'
  alias: Set indicator when doors are open
  description: ''
  - entity_id: group.monitored_doors
    for: 00:01:00
    platform: state
    to: 'on'

It would be nice if there was a UI for editing groups, or creating automatic groups based on entitiy “tagging” or something like that.

So with this if any of those change from their state when alarm panel is armed they trigger? What about having 2 groups? One that includes motion sensors for “vacation mode” and one for “night mode” that is only window/doors.

Honestly I wish there was just a more robust interface for security devices like vera has. you could say which devices were monitored during each “mode”

Make two different groups, i.e. group.vacation_sensors and group.night_sensors.

You might also want to check out Bwalarm (akasma74 edition)

1 Like

Should i be reporting this as a bug, then?

I have n devices that are all ‘sourced’ from Zigbee2MQTT which listens for zigbee button presses. Each device creates 4 entities. If a device has the zigbee network id 0xdeadbeef12345 then the entities will be:

- sensor.0xdeadbeef12345_action
- sensor.0xdeadbeef12345_click
- sensor.0xdeadbeef12345_battery
- sensor.0xdeadbeef12345_linkquality

If i collect all the sensor.${NetID}_click entities and put them in a group, the state of the group will always be unknown even if the specific value of sensor.0xdeadbeef12345_click is single or double … etc.

A group with status unknown never triggers anything… which is why i’ve resorted too listing the entity IDs individually in my triggers.