Cycle through automations with the press of a switch?

I have been searching the forums, but not seeing specifically what I am looking for. I have an Ikea Strybar, and the on and off buttons on it do exactly what I want. That is, turn on all outside lights, or turn them all off.

I would like to use the left and right buttons to cycle through various light automations - I can trigger a single automation with a press, double-press, or long hold on the left or right buttons, but that is not really what I need.

I would like the left button to turn off outdoor color lighting and revert to normal (that’s easy) and have the right button cycle through various lighting automations. So, press once, Automation A, then B, C, D, E, F… You get the idea.

I have not been able to find a way to use a switch to cycle through each automation in a list of automations. Any ideas?

TBH, I’m not even sure what that means.

automations have triggers. that’s how they start.

do you mean that on the first press trigger automation A then on the next press trigger automation B, on the third press… etc?

if you want to do that then the only way I know is to create an input_select (or maybe an input_boolean) that gets set by the automation starting it’s actions. so you know that automation A already ran if that select is on. then in the conditions of the automations use that to select the desired next automation, etc…

Yes, something like a boolean is in the right ballpark. I am just looking for each press of the button to iterate over a list and then eventually return to the start - or press left to cancel the running automation, and return to “normal”.

The intent is to have various lighting colours - say, Halloween, Thanksgiving, Christmas, Easter, Football team - whatever, and just iterate through those various lighting automations with a press for each one.

So press once. It goes to A. Press again, it goes to B, Press again it goes to C… Until it reaches the end of the list and starts over.

I would suggest creating an Input Select Helper that holds the names of your “lighting colours”. Have the button-triggered automation cycle through that list using the input_select.select_next action. If you wanted to, you could also assign the input_select.select_previous action to one of the other press types.

Have a second automation triggered by the state of the Input Select to change to that color scheme. Doing it this way allows you to also use the Input Select in a dashboard as a quick way to select a specific color scheme manually.

2 Likes

i agree with @Didgeridrew

one additional thought. if you already have written automation a,b,c,d,e,f that you want to trigger, instead of creating the second automation that checks the states of input_select, you can add a trigger to those automation a,b,c,d,e,f

for example, if you made ‘AutomationA’ one of the input_select options, then in automation a, add a trigger like this:

  - platform: state
    entity_id:
      - input_select.your_new_select_helper
    to: AutomationA
1 Like

This is excellent, I have already created the automations, and was just looking for a simple way to manually trigger them!