Set conditions for on/off-state of groups


I would see a great benefit if it was possible to somehow specify which conditions result in a groups state being on or off.

Currently it seems as if grouped lights or switches have an on/off state, reflecting if all or some devices are on/off. Specifically for lights I can tell, that one light being on results in the group being considered on.

However, I feel like it would make sense to allow a configuration within groups to define which state each entity has to be in to set the group state to on.

As an example:
Imagine a group.livingroom containing multiple devices of different kinds.

  • binary_sensor.motion
  • light.tv_light
    Then there’s group.ambience_light, which are the lights around the house that should be turned on while I’m at home AND awake (indicated by me watching TV).

An automation to turn off the ambience light when I have stopped watching TV and brushed my teeth (indicated by me moving around, hence the motion sensor in the group) could then look like:

    platform: state
    entity_id: group.livingroom
    to: 'off'
      minutes: 15
    - service: light.turn_off
      entity_id: group.ambience

Essentially the conditions required to perform the action are moved from the automation to the group, being left with only the condition/trigger, that the group state has to be on/off for duration X.

To me this sort of resembles how conditions in Tasker are being defined. There we say “bluetooth connected” + “wifi off” + “location somewhere”, and as soon as all conditions are met, the assigned task is fired.

I guess the same result could be achieved by creating an automation with all those conditions set as, well, conditions within the automation, and the trigger for the automation being a time-interval. A very short one though.

So to sum things up, I think the following concept (or similar if better suggestions are posted) for creating groups would make creating automations more intuitive:

    name: Watching TV
    view: no
    entities: on
      binary_sensor.motion: off 'home'
      light.tv_light: on

Yes, this is very similar to scenes. So thinking about it, what I want could also be interpreted as “reverse-scenes”, which would be groups with all entity-states matching those of a scene. Or put another way: use scenes as triggers for automations.

I don’t know which way around it would be the most efficient and intuitive solution. Feel free to improve my thoughts.