Turn on/off a group and exclude a single entity

Hi All,

HAPPY 2023!!! wish you all a great coding year!

Is it possible to turn on/off a group and exclude a single entity inside the group?

I want have this group but in several automatons I use this group but every single automation is for a specific scene. So I need to exclude an entity so it won’t go on or off.

helpers_switches_scene:
  name: "Helpers Dinner"
  entities:
    - input_boolean.scene_appletv
    - input_boolean.scene_daytime
    - input_boolean.scene_disco
    - input_boolean.scene_evening
    - input_boolean.scene_goodnight
    - input_boolean.scene_kodi
    - input_boolean.scene_romantic
    - input_boolean.scene_sleeping
    - input_boolean.scene_tv
    - input_boolean.scene_nintendo
    - input_boolean.scene_dinner
    - input_boolean.scene_sleeping

Now I have multiple groups and exclude every entity for that specific group. But if this can be smarter let me know :slight_smile:

:thinking: exclude

- service: group.set
  data:
    entity_id: group.main_group
    action: turn_on
    exclude:
      - input_boolean.entity_to_exclude

@krskrab

None of those are valid configuration keys for the group.set service…


@poudenes

Are you asking whether it is possible to deactivate the group entity or to apply a turn_on/off service call to all the entities in a group?

Please include a couple of examples of the automations you are using and explain what you want to change about how they work.

Example

Turn on all input_booleans in group.helpers_switches_scene except input_boolean.scene_disco and input_boolean.scene_kodi.

- service: input_boolean.turn_on
  target:
    entity_id: >
      {{ state_attr('group.helpers_switches_scene', 'entity_id') 
        | reject('in', ['input_boolean.scene_disco', 'input_boolean.scene_kodi']) | list }}
1 Like

@123 Gives me the exact example what I looking for :slight_smile:

1 Like