Simple sunset/sunrise light automation only halfway working

Hello
I have the following configuration:

- alias: 'Utelys Light On'
  trigger:
    platform: sun
    event: sunset
  action:
    service: light.turn_on
    data_template:
      entity_id: group.ute_lys

- alias: 'Utelys Light Off'
  trigger:
    platform: sun
    event: sunrise
  action:
    service: light.turn_off
    data_template:
      entity_id: group.ute_lys

The on part are working, not the off. Hassio on raspbian. The lights are ikea tradfri.

From the log:
08:36 Sun has risen

17:00 Sun has set_
17:00 utepahjorne turned on_
17:00 Ute lys turned on_
17:00 ute ved ingang turned on_
17:00 Utelys Light On has been triggered

Any clue?

The light.turn_off service doesn’t like data ( data: / data_template: ) and will error. You also don’t need it for your particular light.turn_on service call either.

change to:

- alias: 'Utelys Light On'
  trigger:
    platform: sun
    event: sunset
  action:
    service: light.turn_on
    entity_id: group.ute_lys

- alias: 'Utelys Light Off'
  trigger:
    platform: sun
    event: sunrise
  action:
    service: light.turn_off
    entity_id: group.ute_lys

and it should work.

Thank you so much. I have struggled with this a few weeks :slight_smile: