Little test with groups and automations: gives invalid config

Hey guys,
I started with Home Assitant a day or two ago and I’m trying to get a better grip on how things work.
So one of the features I’m exploring now is using groups of lights. Segmentizing the lights gives me better control I hope and creates a cleaner automations.

So i thought let’s start with a group in my groups.yaml:

  name: Koepel Lights
  - light.kamerlamp_l
  - light.kamerlamp_r
  - light.koepel_leds

And let’s create within automation.yaml (based upon the example in the documentation)

- id: lights_on_sun_set
  alias: Turn on the lights when the sun is set
  description: ''
  - event: sunset
    platform: sun
    offset: "-00:45:00"
  - condition: state
    entity_id: all
    state: home
  - service: light.turn_on
    entity_id: group.koepel_lights
  mode: single

But this does give an invalid config and I can’t figure out why. Can anybody help me with this?
I know… noob question. :sweat_smile:

You’re not turning on a light. You’re turning on a group. So the light service is not applicable. You want homeassistant.turn_on/off

Having said that, you can make a group of lights behave like a light where you can use the light services. To do so, use the light group platform (this goes under lights: not group:)

Define “Koepel Lights” as a Light Group instead of a generic group. You’ll have better control of all lights in the group (including setting brightness, color, etc).

… and ninja’d by the speedy tom_I yet again.


Thank you Tom_I! This helped me a lot! :slight_smile:

Hey 123_Taras,
This indeed helps a lot. And Tom_I was indeed speedy as a Ninja!