I am trying to create a loop of changing bulb colors when “shower” mode/routine is executed. Please help me with my first piston.
My First Piston (Basic Loop)
The loop is going to continue running the entire time the mode is set to Shower, so this will continually reset the color transition to 30 seconds in the future. Additionally, Sky Blue will override Purple and Aqua will override Sky Blue so you would only see one color.
I think you’re looking for if Location mode changes to Shower
and transitions of probably 30, 60, and 90 seconds for each color.
Yes I can and I will post, shortly. In the meantime I have this working, but I am not sure why the transition in the original post does not work.
Full Log below:
+0ms
╔Received event [Home].mode = Home with a delay of 11ms
+129ms
║RunTime Analysis CS > 13ms > PS > 97ms > PE > 19ms > CE
+131ms
║Runtime (37988 bytes) successfully initialized in 97ms (v0.2.100.20171211) (131ms)
+131ms
║╔Execution stage started
+136ms
║║Comparison (string) :6e176817ec321422aeb9b3c0b4002fbf: changes_to (string) :5d613727bc73922ca03a0669313d1d7b: = false (0ms)
+137ms
║║Condition #8 evaluated false (2ms)
+138ms
║║Condition group #1 evaluated false (state did not change) (3ms)
+140ms
║╚Execution stage complete. (8ms)
+140ms
╚Event processed successfully (141ms)
In testing, I’ve been having issues with the transition to colour command… doesent work for me but I put it down to my use of virtual devices… maybe something bigger going on though?
Something as simple as
IF switch X is on
with RGB bulb
transition to red
Doesent work
Looks like the log shows that the location mode is Home rather than Shower. Now I see what you intended to do with the while loop though, you probably don’t need the outer if
statement at all.
@ipaterson
Is there a way to remove the outer IF statement without rewriting the whole inside code?
Sure, you can use the reordering tool to drag and drop lines. As shown in the clip below, click the arrows in the sidebar to start the drag, then move the pointer to the right over the code to drop it at the appropriate place. Once the code is outside of the if you can delete the empty if.
I guess that does not work on the iPhone Safari browser.
I click on the double arrows and nothing happens
I can’t get the drag and drop to work on Chrome (Android), either. Works perfectly on desktop, though.
LOL, no I am just a multi-tasker with multiple windows open simultaneously. I feel way too cramped to code on a puny keyboard. Plus, I am a “big picture” kind of guy, and I like to see at least 50 lines of code at once. I am not saying that I have never used a small screen to tweak small chunks of code, but all my real coding happens on the big screen.