Trigger Group platform

I think it would be very useful if there were a group trigger platform that allowed you to monitor groups of entities for state changes, where the trigger instance in actions would be the actual entity that triggered the action, not the group.

Related to: Get entity in group automation trigger

It would probably be sufficient if the entities attribute of a group could be used in the entity_id list of a trigger or even a template sensor. It would be so cool if something like this would work:

sensor:
  - platform: template
    sensors:
      open_window_count:
        friendly_name: "Open window count"
        value_template: >-
            {%- for entity_id in state_attr("group.all_windows", "entity_id") if states(entity_id) == 'on' -%}
            {%- if loop.last -%}{{loop.index}}{%- endif -%}
            {%- else -%}0{%- endfor -%}
        entity_id: group.all_windows.attributes.entity_id

Right now a sensor update cannot be triggered correctly without explicitly listing all group entities. Proper group triggering would therefore be a very important feature.

2 Likes