How do I cycle through scenes with a button?

I'm trying to put a rule together to cycle through three scenes. I have very little experience working with RM so I'm not sure if I'm doing something dumb. This is what I have put together so far:
image

However, this rule doesn't seem to work. The problem is also quite inconsistent so I'm not sure what is going wrong where. If I set the scene to Daylight & hold the button, then it will activate Early Evening and immediately activate Late Evening. If I'm on Late Evening, it'll activate Daylight and then it all just breaks. The Groups & Scenes app doesn't seem to be updating scene activation, or RM doesn't seem to be communicating with the Groups & Scenes app properly. It thinks that no scenes are active despite me manually activating "Late Evening"; I can see this in the Apps:
image

Finally, sometimes multiple scenes get activated at once (so Daylight and Late Evening will show up as "On" even though that's impossible!)

Am I doing something wrong? Is there a better way to go about this whole ordeal?

Instead of closing the first if with an end if, continue the same one, and change the second and third ifs for else ifs.
It means that if the first was false, then the next one gets tested. If first one was true, the other two are skipped.

That's how I had originally set it up. If I do that, then it goes
Daylight ā†’ Early Evening ā†’ Late Evening ā†’ Daylight ā†’ ...

I don't have experience using the held function of buttons, but have you tested the rule using run actions instead of physically holding the button?
Might be a clue there

I use advanced button controller for this. You can select multiple scenes and it will cycle through them. Itā€™s very responsive and reliable.

1 Like

You are using a series of IF THENs, so each IF is evaluated when it is reached. You are performing an action in one IF that will make the condition you're testing for in the next IF be true by the time it is reached if that device's state has finished updating by then (may or may not happen every time, which explains the inconsistency). If you want only one block, the first matching one, to run in an IF block, I'd do this instead:

IF (Daylight is on) THEN
  Activate scenes: Early Evening
ELSE-IF (Early Evening is on) THEN
  Activate scenes: Late Evening
ELSE-IF (Late Evening is on) THEN
  Activate scenes: Daylight
END-IF

That being said, the community app Advanced Button Controller mentioned below also has this functionality built-in and might be easier to set up, though I think it will go alphabetically instead of in any specified order.

(EDIT: So...what MrPancake said above and I missed before. Oops! :laughing:)

3 Likes

I would also add an else in the end to activate one of the scenes, just in case no scenes are active when its Triggered.

1 Like

This.
This is gold.

1 Like

Off topic, but where/how did you get the Hubitat site into Dark Mode!? :astonished:

Not the forums. I already have the forums in dark mode. I'm talking about the Hubitat portal, like in @Akshay's pic in the first post.

Maybe just the browser in dark mode

Huh, my phone's browser is definitely in dark mode, but that doesn't happen for me.

Firefox

I use a plugin called DarkReader.

1 Like