Turn Hue RGB led strip on for 10 minutes and fade thereafter

A Philips Hue RGB ledstrip works with Home Assistant and the code below turns it on with RGB color 0,0,255. I’ve tried to build an automation without success so far. These are my intentions:

1) switch on the strip and stays on (0,0,255) for 10 minutes
2) after above 10 minutes fade out from 0,0,255 to 0,0,0 (30 minutes)

Would be great if someone is willing to help me to solve this!

- alias: Switch on and fade out
  trigger:
  - platform: state
    entity_id: binary_sensor.remote
    to: 'on'
  action:
    service: light.turn_on
    data:
      entity_id: light.room_2
      rgb_color: [0,0,255]

Add a 10-minute delay after the first action, and add another action after that calling the light.turn_off service with a transition of 1800 (1800 seconds == 30 minutes).

Thanks for helping Tediore! The new code below generates an error “duplicated mapping key service: light.turn_off”. Can you be more specific and tell me what I’m doing wrong?

- alias: Switch on and fade
  trigger:
  - platform: state
    entity_id: binary_sensor.remote
    to: 'on'
  action:
    service: light.turn_on
    data:
      entity_id: light.room_2
      rgb_color: [255,175,65]
      brightness: 255
      delay:
        minutes: 10
    service: light.turn_off
    data:
      entity_id: light.room_2
      transition: 1800

Needs to be like this:

action:
- service: light.turn_on
  ...
- delay:
    minutes: 10
- service: light.turn_off
  ...

To have multiple triggers, actions, etc. you need to make it a list with hyphens.

1 Like

I did exactly what you wrote and luckily I no longer receive any error messages. Thanks! Although I now get more experienced with Home Assistant all spaces, tabs and hyphens make it difficult.

Unfortunately, the transition is not working yet. With the code below the strip goes on for 10 seconds and then off, so no fade out.

Do you or someone reading this is experienced with Philips Hue and the right way to use the transition (fade out) in this automation?

- alias: Switch on and fade
  trigger:
  - platform: state
    entity_id: binary_sensor.remote
    to: 'on'
  action:
  - service: light.turn_on
    data:
      entity_id: light.room_2
      rgb_color: [255,175,65]
      brightness: 255
  - delay:
      seconds: 10
  - service: light.turn_off
    data:
      entity_id: light.room_2
      transition: 20