LIFX Holiday Cheer?

I have a LIFX porch light that I’ve automated to come on at dusk and off at dawn. I thought it would be neat to have it cycle slowly between red, white, and green while it’s on… but trying to figure out the best way to go about it.

I’m looking at the docs for LIFX, and Lights. I can make the light any color, but not sure how to create a loop of specific colors with a specific duration between transitions.

Thoughts?

You can use two scripts to create a loop to rotate through a series of colours. The first handles one set of transitions, with appropriate delays. Then it calls the second script. The second script merely calls the first to loop through again. Here’s an example I just tried out on my LiFX lights:

# rotate through one iteration of xmas lights:
# green for 30 seconds
# white for 30 seconds
# red for 30 seconds
# white for 30 seconds
# Then finally call the xmas_light_loop script, which
# in turn calls this one again.
# Note that the delay step also has to include transition time.
xmas_lights:
  sequence:
    - service: light.turn_on
      data:
        entity_id: light.lounge
        rgb_color: [0, 255, 0]
        transition: 10
    - delay: 00:00:40
    - service: light.turn_on
      data:
        entity_id: light.lounge
        rgb_color: [255, 255, 255]
        transition: 10
    - delay: 00:00:40
    - service: light.turn_on
      data:
        entity_id: light.lounge
        rgb_color: [255, 0, 0]
        transition: 10
    - delay: 00:00:40
    - service: light.turn_on
      data:
        entity_id: light.lounge
        rgb_color: [255, 255, 255]
        transition: 10
    - service: script.turn_on
      data:
        entity_id: script.xmas_light_loop

xmas_light_loop:
  sequence:
    - delay: 00:00:40
    - service: script.turn_on
      data:
        entity_id: script.xmas_lights

Just turn on the script.xmas_lights service to start the sequence, and when you turn the light off ensure you turn off both scripts as well.