Scripting a light created from platform:group

Hi!

I’m new to Home assistant and I’m trying to configure an script/automation to turn a group of lights on.

I have followed the instructions in the docs for a light group created using the platform:group. I get the group to function properly in the frontend when I manually want to turn the lights on or off, but I have no idea of how to script this group or how to automate this group since there is no id associated with the group.

/Thomas

the action bit would look like this:

  - service: light.turn_off
    data:
      entity_id: group.Interior_Lights

a complete automation example would be:

- alias: All Lights Off
  trigger:
    - platform: state
      entity_id: group.pirs
      to: 'off'
      for:
        minutes: 3
  condition:
    - condition: state
      entity_id: input_boolean.normal
      state: 'on'
    - condition: state
      entity_id: media_player.panasonic_viera_tv
      state: 'off'
  action:
  - service: light.turn_off
    data:
      entity_id: group.Interior_Lights

Thanks!
But my group is generated like this:

light:
      - platform: group
        name: Window Lights
        entities:
          - light.staircasewindow_light
          - light.kitchenwindow_light

So I do not have the property of group.interior_lights as you described them, do I? Do I need to associate the individual lamps in a group to make this work?

I’ve not created such a group, but following doc:


you would replace my above example with:
- alias: All Lights Off
  trigger:
    - platform: state
      entity_id: group.pirs
      to: 'off'
      for:
        minutes: 3
  condition:
    - condition: state
      entity_id: input_boolean.normal
      state: 'on'
    - condition: state
      entity_id: media_player.panasonic_viera_tv
      state: 'off'
  action:
  - service: light.turn_off
    data:
      entity_id: light.window_lights

Yes, Thanks got it working.

So from what I understand, it creates an id from the name, by making lower case letters and replacing space with subscores… The most interesting aspect is what happens when I introduce a swedish word with a non-normal character such as “ö” or “ä”.

But thanks for your help.

you should keep entity names in plain English (or swedish with no accents) and use the friendly_name to display the Swedish name with accents.
Most sensors will allow you to define a friendly name, if they don’t, you can add that info in the customisation area.
Let me know if you need help

Good idea. Thanks again