WLED Rotate the colour of candles

I converted some battery operated candles to WLED and mains power for my wife. :grinning:

I just used the candle effect but I also wanted coloured candles for my granddaughter. I made each candle it’s own segment and then preset with the chosen colour.

I’m happy with the result!

Bath Candles

I would like to make the coloured ones shift the colour to the next candle every 5 seconds. Have tried various effects but can’t get the result I’m looking for. I thought a HA script might be the best way to go.

I created this simple script which takes 5 colours as variables.

  sequence:
    - alias: "Set 1st Bath Candle to 1st colour"
      service: light.turn_on
      data:
        rgb_color: "{{ colour1 }}"
      target:
        entity_id: light.candle_wled
        
    - alias: "Set 2nd Bath Candle to 2nd colour"
      service: light.turn_on
      data:
        rgb_color: "{{ colour2 }}"
      target:
        entity_id: light.candle_wled_segment_1

    - alias: "Set 3rd Bath Candle to 3rd colour"
      service: light.turn_on
      data:
        rgb_color: "{{ colour3 }}"
      target:
        entity_id: light.candle_wled_segment_2
        
    - alias: "Set 4th Bath Candle to 4th colour"
      service: light.turn_on
      data:
        rgb_color: "{{ colour4 }}"
      target:
        entity_id: light.candle_wled_segment_3
        
    - alias: "Set 5th Bath Candle to 5th colour"
      service: light.turn_on
      data:
        rgb_color: "{{ colour5 }}"
      target:
        entity_id: light.candle_wled_segment_4

I also tried to create an automation that uses an input_select to step through a list of values.

- alias: Change bath candle colours 
  trigger:
    platform: time_pattern 
    minutes: '/1'
  condition:
    condition: state
    entity_id: light.candle_wled
    state: 'on' 
  action:
    - service: light.turn_on
      data_template:
        entity_id: light.candle_wled
        colour: "{{ states('input_select.candle_colours') }}" 
    - service: input_select.select_next
      entity_id: input_select.candle_colours

Here is the input_select.

input_select:
  candle_colours:
    options:
      - Green
      - Red
      - Blue
      - Yellow
      - Purple

This, of course, doesn’t work but I would like feedback on whether it is possible to change the input_select to create all 5 variables to set the 5 segments each to a different colour.

I thought maybe the script might not even need the input_select if it could simply read the rgb_color of the previous segment and apply that.

Any ideas or suggestions are most appreciated.