This is my first post. I'll give an introduction to me and what I'm doing with HE elsewhere (tl;dr - replacing an entire house full of X-10 left by previous owners), but for now, I've gotten stumped on what I think should be a pretty simple task.
For "what does he know" reference, I've already successfully created rules for Hue and Ecobee, and a couple of really ugly dashboards. I've purchased a Lutron Caseta Smart Bridge Pro 2 and installed it to HE, but haven't yet started adding switches or other devices to the house.
The last time I programmed anything, it was on a Commodore 64. I understand coding in principle, but normally prefer to stand on the shoulders of giants and follow instructions.
Using a local end point, triggered by an Elgato Stream Deck, have a Hue Group smoothly color cycle between six scenes with an approximate 10 minute fade between each one. Do this until I trigger that end point again, then set to the final scene.
What I've achieved so far
I've successfully created a variable ("StudioColorCycleLoop") that toggles between true/false with each press of the button on the Elgato Stream Deck. (Rule Machine)
I've successfully created the six scenes (Blue, Red, Orange, White, Green, Purple) and can trigger these with buttons on the Stream Deck via local end point addresses. (Groups and Scenes)
I've verified that I can do slow fades between any two of the color scenes using a timed trigger. During development of my rules, I'm using a 3 second fade with a 10 second wait, but I've also tried a 15 minute fade that worked nicely. (Groups and Scenes)
I have used these two discussions as references while trying to learn all of this:
What's not quite working
My WHILE loop seems to start correctly, but stalls. I get the first color change, but not anything after.
The END-IF seems to trigger correctly, because the lights turn white. The loop isn't stopping, though, because it will eventually go back to whatever the first scene in the loop section is.
Worse, the loop seems to get stuck in a weird way. I turned everything off, but found those lights on (at an in-between fade color) in the middle of the night. I turned them off again, but they were back on the next time I woke up. The only way I was able to stop the behavior was to reboot both the Hubitat and the Hue Bridge.
Here's my code
The "Trigger Variable" for the Stream Deck button:
Select Trigger Events Local end point Select Actions to Run IF (Variable StudioColorCycleLoop(false) = false(T) THEN Set StudioColorCycleLoop to true ELSE Set StudioColorCycleLoop to false
Here's as far as I got with the WHILE loop rule. Note that the timing is the shortened test version, and each scene currently has a 3 second fade in its definition:
Select Trigger Events Variable reports StudioColorCycleLoop(false) *changed* Select Actions to Run IF (StudioColorCycleLoop variable(false) = true(F) [FALSE] THEN Repeat 3 times every 0:00:30 (stopable) Activate Scenes: Studio Wash Blue Delay 0:00:10 Activate scenes: Studio Wash Red Delay 0:00:10 END-REP END-IF Stop Repeating Actions Activate Scenes: Studio Wash White
As mentioned above, what I'd like to have happen is that I hit the Stream Deck button, and the Studio Wash group cycles through each of the six scenes and loops until I hit that Stream Deck button again.
If there are better / more elegant / more appropriate ways to do the delays or the fades, please let me know. I'm currently putting the fade in the scene definition itself. I also tried setting scene changes (e.g., Red to Blue) where I specified that the fade happen over 600 seconds with an update every X seconds. I'm not sure what a reasonable value for X is, but I've been using 6.
I really thought I had it ready to go after I got the scenes to respond to a local end point trigger, but the IF-THEN/WHILE loop is... er... throwing me for a loop.
Any advice would be greatly appreciated!