Turn Led's on and off with Preset Rotation

I have some led’s in my server room. They are set up with a drop down helper script listing the presets I want. They are set to change every minute to a new preset. THIS WORKS GREAT!

Now I want to have them cme on at 06:00 and go off at 17:00, which they sort of do. It seems that at 17:00 they go off, but 1 minute later they come back on again. I believe that this is do to the 1 minute rotation cycle.

How can I overcome this. Below is the code.

Thank you

####################################################
#   WLED SERVERROOM     2025Nov25                  #
####################################################
- id: "ffd022de-814c-4195-a960-e5f4848a5e48"
  alias: "WLED Server Room Preset Rotation"
  description: WLED Server Room Preset Rotation
  trigger:
    - platform: time_pattern
      minutes: "/1" # Adjust interval as needed
  action:
    - service: input_select.select_next
      target:
        entity_id: input_select.wled_server_room_preset_sequence
    - service: select.select_option
      target:
        entity_id: select.server_room_preset # Replace with your WLED preset entity_id
      data_template:
        option: "{{ states('input_select.wled_server_room_preset_sequence') }}" 
  mode: single
####################################################
#     SERVER ROOM WLED OFF  2025Nov25              #
####################################################
- id: "aae6e053-7742-4843-8e86-0e3bda6f9acc"
  alias: "Server Room WLED Strip Lights OFF"
  description: Server Room WLED Strip Lights OFF
  trigger:
    - platform: time
      at: '17:00:00'
  condition: []
  action:
    - service: light.turn_off
      data: {}
      target:
        entity_id: light.server_room_wled
  mode: single  
####################################################
#       SERVER ROOM WLED ON        2025Nov25       #
####################################################
- id: "f9ddbdfb-876f-47e2-929f-d29f891eb36b"
  alias: "Server Room WLED Strip Lights ON"
  description: Server Room WLED Strip Lights ON
  trigger:
    - platform: time
      at: '06:00:00'
  condition: []
  action:
    - service: light.turn_on
      data: {}
      target:
        entity_id: light.server_room_wled
  mode: single      
###################################################
#           END OF CONFIGURATION FILE             #
###################################################  








Add a condition to your first automation telling it that it should only run between those 2 times:

conditions:
  - condition: time
    after: "06:00:01"
    before: "16:59:59"

EDIT: Depending on how your light behaves if you select a preset while it’s off, you might not even need the 6AM automation which turns it on if you add the above condition.

Going to try it. Thank you

1 Like

This is what I changed it to but does not seem to work.
Is this what you intended for me to change.
Thanks

- id: "ffd022de-814c-4195-a960-e5f4848a5e48"
  alias: "WLED Server Room Preset Rotation"
  description: WLED Server Room Preset Rotation
  trigger:
    - platform: time_pattern
      minutes: "/1" # Adjust interval as needed
  conditions:
    - condition: time
      after: "06:00:01"
      before: "16:59:59"      
  action:
    - service: input_select.select_next
      target:
        entity_id: input_select.wled_server_room_preset_sequence
    - service: select.select_option
      target:
        entity_id: select.server_room_preset # Replace with your WLED preset entity_id
      data_template:
        option: "{{ states('input_select.wled_server_room_preset_sequence') }}" 
  mode: single

Yes, that’s what I intended.

Define “does not seem to work” - is it still turning on the presets after 5pm? If so, check the automation traces to see why your conditions were ignored.

Sorry for the confusion.
I should have said there were no trace errors, and the lights do not even turn off.
If I run the automation by clicking run it does nothing, though it shows that the automation ran a few seconds ago. Also every minute the automation restarts based on my preset time.

Now I’m even more confused.

The automation with the time condition does not turn off your lights. That is taken care of by your "Server Room WLED Strip Lights OFF" automation.

Clicking Run bypasses all triggers & conditions, so the condition part is definitely not what’s causing your issue. Also, that Run button will run a single action. You have 2 actions: input_select.select_next & select.select_option. This means that you only ran one of those actions.

Where did you get the original automation from and how are you storing/editing it? I’m asking because it’s still using the old format of the automation actions (eg. service was renamed to action earlier this year). If you were using the UI, your automation would have been automatically updated to use the newer format, which is another thing that confuses me.

This was an automation I used last year for some holiday lights.
Was not familiar with the change.

I will look up what changed and try to reformat it.
Thanks

Please read what I just wrote. There is no need to reformat it manually if you’re using the UI. As soon as you change something in the automation and hit Save, it should update to the newer format automatically.

I see that.
Just started to read that the use of service is still okay to use.
I jumped the gun, in that I thought it needed to be changed, my fault.