Lights Fading up and then staying on


#1

1) Give a description of the problem
The light goes off after the fade loop is completed

2) What is the expected behavior?
To fade the light from 0-80% in 10 minutes and then stay on until 6:00 AM

3) What is happening/not happening?
Light comes on and fades up but is being turned off by room manager.

**4) Post a Green Snapshot of the piston![image|45x37]

5) Attach any logs (From ST IDE and by turning logging level to Full)
1/23/2018, 5:59:59 AM +124ms
+1ms ╔Received event [Home].time = 1516705200000 with a delay of -877ms
+395ms ║RunTime Analysis CS > 267ms > PS > 59ms > PE > 70ms > CE
+398ms ║Runtime (42749 bytes) successfully initialized in 59ms (v0.2.102.20180116) (396ms)
+399ms ║╔Execution stage started
+415ms ║║Comparison (time) 21599532 happens_daily_at (time) 17400000 = false (6ms)
+417ms ║║Cancelling condition #12’s schedules…
+418ms ║║Condition #12 evaluated false (11ms)
+432ms ║║Cancelling statement #12’s schedules…
+436ms ║║Requesting time schedule wake up at Wed, Jan 24 2018 @ 4:50:00 AM EST
+439ms ║║Cancelling condition #1’s schedules…
+440ms ║║Condition group #1 evaluated false (state changed) (33ms)
+449ms ║║Comparison (integer) 1 is_less_than (integer) 80 = true (2ms)
+450ms ║║Condition #24 evaluated true (7ms)
+461ms ║║Comparison (enum) off is_not (string) off = false (1ms)
+462ms ║║Condition #25 evaluated false (11ms)
+463ms ║║Condition group #19 evaluated false (state did not change) (21ms)
+471ms ║║Comparison (time) 21599593 happens_daily_at (time) 21600000 = true (0ms)
+473ms ║║Time restriction check passed
+475ms ║║Cancelling condition #30’s schedules…
+476ms ║║Condition #30 evaluated true (8ms)
+477ms ║║Cancelling statement #30’s schedules…
+482ms ║║Requesting time schedule wake up at Wed, Jan 24 2018 @ 6:00:00 AM EST
+490ms ║║Comparison (string) :0b4c38241cd3f9d5bc3e816c32944d25: is_any_of (string) :0b4c38241cd3f9d5bc3e816c32944d25:,:062a023dd7333a8b86feb07f041dfd0c: = true (2ms)
+491ms ║║Condition #31 evaluated true (6ms)
+499ms ║║Comparison (enum) off is (string) on = false (2ms)
+501ms ║║Condition #35 evaluated false (8ms)
+502ms ║║Condition group #13 evaluated false (state did not change) (33ms)
+506ms ║╚Execution stage complete. (106ms)
+508ms ║Setting up scheduled job for Wed, Jan 24 2018 @ 4:50:00 AM EST (in 82200.369s), with 1 more job pending
+520ms ╚Event processed successfully (520ms)
1/23/2018, 4:49:59 AM +86ms
+1ms ╔Received event [Home].time = 1516701000000 with a delay of -914ms
+130ms ║RunTime Analysis CS > 22ms > PS > 50ms > PE > 58ms > CE
+133ms ║Runtime (42745 bytes) successfully initialized in 50ms (v0.2.102.20180116) (131ms)
+134ms ║╔Execution stage started
+148ms ║║Comparison (time) 17399228 happens_daily_at (time) 17400000 = true (5ms)
+149ms ║║Time restriction check passed
+151ms ║║Cancelling condition #12’s schedules…
+151ms ║║Condition #12 evaluated true (10ms)
+160ms ║║Cancelling statement #12’s schedules…
+165ms ║║Requesting time schedule wake up at Wed, Jan 24 2018 @ 4:50:00 AM EST
+172ms ║║Comparison (string) :0b4c38241cd3f9d5bc3e816c32944d25: is_any_of (string) :0b4c38241cd3f9d5bc3e816c32944d25:,:062a023dd7333a8b86feb07f041dfd0c: = true (2ms)
+173ms ║║Condition #26 evaluated true (5ms)
+174ms ║║Cancelling condition #1’s schedules…
+175ms ║║Condition group #1 evaluated true (state changed) (34ms)
+178ms ║║Cancelling statement #2’s schedules…
+193ms ║║Executed physical command [Tom’s Light].on() (10ms)
+194ms ║║Executed [Tom’s Light].on (12ms)
+200ms ║║Executed virtual command [Tom’s Light].setVariable (3ms)
+219ms ║║Executed physical command [Tom’s Light].setLevel([1]) (9ms)
+220ms ║║Executed [Tom’s Light].setLevel (18ms)
+226ms ║║Comparison (time) 17399310 happens_daily_at (time) 21600000 = false (0ms)
+228ms ║║Cancelling condition #30’s schedules…
+229ms ║║Condition #30 evaluated false (4ms)
+230ms ║║Cancelling statement #30’s schedules…
+233ms ║║Requesting time schedule wake up at Tue, Jan 23 2018 @ 6:00:00 AM EST
+236ms ║║Condition group #13 evaluated false (state did not change) (12ms)
+239ms ║╚Execution stage complete. (105ms)
+241ms ║Setting up scheduled job for Tue, Jan 23 2018 @ 6:00:00 AM EST (in 4200.673s), with 1 more job pending
+260ms ╚Event processed successfully (259ms)

Here are my settings for Room Manager:

I have played around with the settings but I can’t seem to get it to stop turning the light out between 4:50 - 6:00 am. Also, I have the Mode set for Nighttime until 6:00 am. when it turns to Home.

REMOVE BELOW AFTER READING
If a solution is found for your question then please mark the post as the solution.


#2

Can anybody help with this? I did have the fading up working in the above piston but then it seemed that the light didn’t turn off at 6:00 am so I was trying to fix it and now the fading up to 80% loop isn’t working. This is what I have right now.


#3

Your first IF statement is only triggering and evaluating true at 4:50 am (Time happens daily at 450am). It executes then and processes the Turn on White bulb 5, set Fadelevel = 1, and set White bulb 5 to the Fadelevel value. The piston doesn’t trigger again until “Time happens daily at 6am”, where the top IF statement would evaluate false but your 2nd condition evaluates true and shuts the light off.

I’ll post up a suggested change in a few minutes that should help without making the piston overly complicated. :slight_smile:


#4

See if this works? If not, post another log snippet and we’ll figure out where it’s falling down:


#5

No, it seems to skip right over the “While” Loop. Here is the log. Don’t mind the times as I am changing them to test it. I took out line 48 because the MaxFadeLevel has to be 80.
s
1/24/2018, 2:38:59 PM +92ms
+0ms ╔Received event [Home].time = 1516822740000 with a delay of -909ms
+157ms ║RunTime Analysis CS > 17ms > PS > 54ms > PE > 87ms > CE
+160ms ║Runtime (43920 bytes) successfully initialized in 54ms (v0.2.102.20180116) (159ms)
+161ms ║╔Execution stage started
+176ms ║║Comparison (time) 52739261 happens_daily_at (time) 52740000 = true (4ms)
+177ms ║║Time restriction check passed
+179ms ║║Cancelling condition #12’s schedules…
+179ms ║║Condition #12 evaluated true (10ms)
+185ms ║║Cancelling statement #12’s schedules…
+189ms ║║Requesting time schedule wake up at Thu, Jan 25 2018 @ 2:39:00 PM EST
+196ms ║║Comparison (string) :b5914c7c012497f300215fa7e4a9eb8a: is_any_of (string) :b5914c7c012497f300215fa7e4a9eb8a:,:0b4c38241cd3f9d5bc3e816c32944d25:,:062a023dd7333a8b86feb07f041dfd0c: = true (1ms)
+197ms ║║Condition #26 evaluated true (6ms)
+198ms ║║Cancelling condition #1’s schedules…
+199ms ║║Condition group #1 evaluated true (state changed) (31ms)
+202ms ║║Cancelling statement #2’s schedules…
+217ms ║║Executed physical command [Tom’s Light].on() (11ms)
+218ms ║║Executed [Tom’s Light].on (13ms)
+225ms ║║Executed virtual command [Tom’s Light].setVariable (3ms)
+240ms ║║Executed physical command [Tom’s Light].setLevel([1]) (12ms)
+241ms ║║Executed [Tom’s Light].setLevel (14ms)
+252ms ║║Comparison (integer) 1 is_inside_of_range (integer) 1 … (integer) 80 = true (1ms)
+253ms ║║Condition #46 evaluated true (8ms)
+261ms ║║Comparison (enum) off is_not (string) off = false (2ms)
+263ms ║║Condition #47 evaluated false (9ms)
+264ms ║║Condition group #41 evaluated false (state did not change) (20ms)
+269ms ║║Comparison (time) 52739359 happens_daily_at (time) 53400000 = false (0ms)
+271ms ║║Condition #40 evaluated false (4ms)
+272ms ║║Cancelling statement #40’s schedules…
+275ms ║║Requesting time schedule wake up at Wed, Jan 24 2018 @ 2:50:00 PM EST
+278ms ║║Condition group #39 evaluated false (state did not change) (12ms)
+282ms ║╚Execution stage complete. (121ms)
+284ms ║Setting up scheduled job for Wed, Jan 24 2018 @ 2:50:00 PM EST (in 660.625s), with 1 more job pending
+292ms ╚Event processed successfully (293ms)
1/24/2018, 2:38:13 PM +119ms
+1ms ╔Starting piston… (v0.2.102.20180116)
+358ms ║╔Subscribing to devices…
+1065ms ║╚Finished subscribing (716ms)
+1093ms ║Comparison (time) 52694209 happens_daily_at (time) 52740000 = false (1ms)
+1095ms ║Cancelling condition #12’s schedules…
+1100ms ║Cancelling statement #12’s schedules…
+1103ms ║Requesting time schedule wake up at Wed, Jan 24 2018 @ 2:39:00 PM EST
+1117ms ║Comparison (string) :b5914c7c012497f300215fa7e4a9eb8a: is_any_of (string) :b5914c7c012497f300215fa7e4a9eb8a:,:0b4c38241cd3f9d5bc3e816c32944d25:,:062a023dd7333a8b86feb07f041dfd0c: = true (2ms)
+1119ms ║Cancelling condition #1’s schedules…
+1140ms ║Comparison (integer) 1 is_inside_of_range (integer) 1 … (integer) 80 = true (6ms)
+1151ms ║Comparison (enum) off is_not (string) off = false (2ms)
+1159ms ║Comparison (time) 52694276 happens_daily_at (time) 53400000 = false (0ms)
+1161ms ║Cancelling statement #40’s schedules…
+1164ms ║Requesting time schedule wake up at Wed, Jan 24 2018 @ 2:50:00 PM EST
+1170ms ║Comparison (string) :b5914c7c012497f300215fa7e4a9eb8a: is_any_of (string) :b5914c7c012497f300215fa7e4a9eb8a:,:0b4c38241cd3f9d5bc3e816c32944d25:,:062a023dd7333a8b86feb07f041dfd0c: = true (2ms)
+1178ms ║Comparison (enum) off is (string) on = false (1ms)
+1197ms ║Setting up scheduled job for Wed, Jan 24 2018 @ 2:39:00 PM EST (in 45.685s), with 1 more job pending
+1210ms ╚Piston successfully started (1209ms)
1/24/2018, 2:36:59 PM +83ms
+1ms ╔Received event [Home].time = 1516822620000 with a delay of -917ms
+161ms ║RunTime Analysis CS > 26ms > PS > 52ms > PE > 83ms > CE
+164ms ║Runtime (44170 bytes) successfully initialized in 52ms (v0.2.102.20180116) (162ms)
+165ms ║╔Execution stage started
+179ms ║║Comparison (time) 52619256 happens_daily_at (time) 52620000 = true (5ms)
+180ms ║║Time restriction check passed
+182ms ║║Cancelling condition #12’s schedules…
+183ms ║║Condition #12 evaluated true (10ms)
+192ms ║║Cancelling statement #12’s schedules…
+197ms ║║Requesting time schedule wake up at Thu, Jan 25 2018 @ 2:37:00 PM EST
+205ms ║║Comparison (string) :b5914c7c012497f300215fa7e4a9eb8a: is_any_of (string) :b5914c7c012497f300215fa7e4a9eb8a:,:0b4c38241cd3f9d5bc3e816c32944d25:,:062a023dd7333a8b86feb07f041dfd0c: = true (3ms)
+206ms ║║Condition #26 evaluated true (7ms)
+208ms ║║Cancelling condition #1’s schedules…
+208ms ║║Condition group #1 evaluated true (state changed) (36ms)
+211ms ║║Cancelling statement #2’s schedules…
+227ms ║║Executed physical command [Tom’s Light].on() (12ms)
+228ms ║║Executed [Tom’s Light].on (13ms)
+234ms ║║Executed virtual command [Tom’s Light].setVariable (3ms)
+255ms ║║Executed physical command [Tom’s Light].setLevel([1]) (9ms)
+256ms ║║Executed [Tom’s Light].setLevel (19ms)
+267ms ║║Comparison (integer) 1 is_inside_of_range (integer) 1 … (integer) 80 = true (2ms)
+269ms ║║Condition #46 evaluated true (8ms)
+277ms ║║Comparison (enum) off is_not (string) off = false (2ms)
+279ms ║║Condition #47 evaluated false (10ms)
+280ms ║║Condition group #41 evaluated false (state did not change) (21ms)
+285ms ║║Comparison (time) 52619366 happens_daily_at (time) 53400000 = false (0ms)
+287ms ║║Condition #40 evaluated false (4ms)
+288ms ║║Cancelling statement #40’s schedules…
+291ms ║║Requesting time schedule wake up at Wed, Jan 24 2018 @ 2:50:00 PM EST
+294ms ║║Condition group #39 evaluated false (state did not change) (12ms)
+298ms ║╚Execution stage complete. (134ms)
+300ms ║Setting up scheduled job for Wed, Jan 24 2018 @ 2:50:00 PM EST (in 780.618s), with 1 more job pending
+310ms ╚Event processed successfully (310ms)


#6

Shouldn’t the WHILE LOOP be part of the THEN section? You’ve got it in the ELSE section…


#7

I have tried that also but it still skips right over the While Loop. It just won’t look at it no matter where it is.


#8

Is it because your IFs are triggers and your WHILE is a condition.
Mixing conditions and triggers is not always good.
Try making everything ALWAYS SUBSCRIBE and see what happens. Don’t know but something to try.
Good luck.


#9

I put the While Loop after the first IF Statement and then changed it to Async. That seems to work. At least it counts up and adjusts the light to 80%. It seems to be staying on at 81% right now. I am waiting to see if it turns off at 3:25. However, I did notice that it stalled at about 12% for some reason. I have included the logs for that time as there was an Orange line in the log

1/24/2018, 3:00:59 PM +72ms
+0ms ╔Received event [Home].time = 1516824060537 with a delay of -1466ms
+147ms ║RunTime Analysis CS > 14ms > PS > 36ms > PE > 97ms > CE
+149ms ║Runtime (43907 bytes) successfully initialized in 36ms (v0.2.102.20180116) (148ms)
+150ms ║╔Execution stage started
+179ms ║║Calculating (integer) 14 + (integer) 1 >> (integer) 15
+186ms ║║Executed virtual command [Tom’s Light].setVariable (3ms)
+198ms ║║Executed physical command [Tom’s Light].setLevel([15]) (9ms)
+199ms ║║Executed [Tom’s Light].setLevel (10ms)
+209ms ║║Comparison (integer) 15 is_inside_of_range (integer) 1 … (integer) 80 = true (2ms)
+211ms ║║Condition #46 evaluated true (9ms)
+220ms ║║Comparison (enum) on is_not (string) off = true (2ms)
+222ms ║║Condition #47 evaluated true (10ms)
+223ms ║║Condition group #41 evaluated true (state did not change) (21ms)
+225ms ║║Cancelling statement #42’s schedules…
+232ms ║║Executed virtual command [Tom’s Light].wait (2ms)
+233ms ║║Requesting a wake up for Wed, Jan 24 2018 @ 3:01:04 PM EST (in 5.0s)
+240ms ║╚Execution stage complete. (90ms)
+243ms ║Setting up scheduled job for Wed, Jan 24 2018 @ 3:01:04 PM EST (in 4.992s), with 2 more jobs pending
+251ms ╚Event processed successfully (251ms)
1/24/2018, 3:00:45 PM +654ms
+1ms ╔Received event [Home].execute = recovery with a delay of 164ms
+9827ms ║RunTime Analysis CS > 26ms > PS > 9688ms > PE > 114ms > CE
+9829ms ║Piston waited at a semaphore for 9636ms <<<<<<<<This line
+9832ms ║Runtime (43976 bytes) successfully initialized in 9688ms (v0.2.102.20180116) (9830ms)
+9833ms ║╔Execution stage started
+9842ms ║║Comparison (time) 54055494 happens_daily_at (time) 53940000 = false (1ms)
+9844ms ║║Cancelling condition #12’s schedules…
+9844ms ║║Condition #12 evaluated false (5ms)
+9845ms ║║Cancelling statement #12’s schedules…
+9848ms ║║Requesting time schedule wake up at Thu, Jan 25 2018 @ 2:59:00 PM EST
+9851ms ║║Cancelling condition #1’s schedules…
+9852ms ║║Condition group #1 evaluated false (state changed) (13ms)
+9861ms ║║Comparison (integer) 14 is_inside_of_range (integer) 1 … (integer) 80 = true (2ms)
+9863ms ║║Condition #46 evaluated true (8ms)
+9873ms ║║Comparison (enum) on is_not (string) off = true (2ms)
+9874ms ║║Condition #47 evaluated true (11ms)
+9875ms ║║Condition group #41 evaluated true (state did not change) (21ms)
+9877ms ║║Cancelling statement #42’s schedules…
+9882ms ║║Executed virtual command [Tom’s Light].wait (0ms)
+9883ms ║║Requesting a wake up for Wed, Jan 24 2018 @ 3:01:00 PM EST (in 5.0s)
+9890ms ║║Comparison (time) 54055542 happens_daily_at (time) 55500000 = false (0ms)
+9892ms ║║Condition #40 evaluated false (3ms)
+9893ms ║║Cancelling statement #40’s schedules…
+9896ms ║║Requesting time schedule wake up at Wed, Jan 24 2018 @ 3:25:00 PM EST
+9898ms ║║Condition group #39 evaluated false (state did not change) (11ms)
+9901ms ║╚Execution stage complete. (68ms)
+9904ms ║Setting up scheduled job for Wed, Jan 24 2018 @ 3:01:00 PM EST (in 4.98s), with 2 more jobs pending
+9912ms ╚Event processed successfully (9911ms)


#10

So, it worked once and then the next time I went to test it, it skipped over the While Loop again. Here is the Log…
1/24/2018, 3:27:59 PM +114ms
+0ms ╔Received event [Home].time = 1516825680000 with a delay of -887ms
+153ms ║RunTime Analysis CS > 17ms > PS > 55ms > PE > 77ms > CE
+160ms ║Runtime (43906 bytes) successfully initialized in 55ms (v0.2.102.20180116) (159ms)
+167ms ║╔Execution stage started
+187ms ║║Comparison (time) 55679289 happens_daily_at (time) 55680000 = true (4ms)
+189ms ║║Time restriction check passed
+190ms ║║Cancelling condition #12’s schedules…
+191ms ║║Condition #12 evaluated true (16ms)
+203ms ║║Cancelling statement #12’s schedules…
+211ms ║║Requesting time schedule wake up at Thu, Jan 25 2018 @ 3:28:00 PM EST
+228ms ║║Comparison (string) :b5914c7c012497f300215fa7e4a9eb8a: is_any_of (string) :b5914c7c012497f300215fa7e4a9eb8a:,:0b4c38241cd3f9d5bc3e816c32944d25:,:062a023dd7333a8b86feb07f041dfd0c: = true (2ms)
+230ms ║║Condition #26 evaluated true (16ms)
+231ms ║║Cancelling condition #1’s schedules…
+232ms ║║Condition group #1 evaluated true (state changed) (58ms)
+235ms ║║Cancelling statement #2’s schedules…
+250ms ║║Executed physical command [Tom’s Light].on() (12ms)
+251ms ║║Executed [Tom’s Light].on (13ms)
+258ms ║║Executed virtual command [Tom’s Light].setVariable (3ms)
+277ms ║║Executed physical command [Tom’s Light].setLevel([1]) (8ms)
+278ms ║║Executed [Tom’s Light].setLevel (18ms)
+292ms ║║Comparison (integer) 1 is_inside_of_range (integer) 1 … (integer) 80 = true (5ms)
+295ms ║║Cancelling condition #46’s schedules…
+297ms ║║Condition #46 evaluated true (15ms)
+308ms ║║Comparison (enum) off is_not (string) off = false (2ms)
+309ms ║║Condition #47 evaluated false (11ms)
+310ms ║║Condition group #41 evaluated false (state did not change) (29ms)
+315ms ║║Comparison (time) 55679427 happens_daily_at (time) 57600000 = false (0ms)
+317ms ║║Condition #40 evaluated false (3ms)
+318ms ║║Cancelling statement #40’s schedules…
+321ms ║║Requesting time schedule wake up at Wed, Jan 24 2018 @ 4:00:00 PM EST
+324ms ║║Condition group #39 evaluated false (state did not change) (11ms)
+328ms ║╚Execution stage complete. (166ms)
+330ms ║Setting up scheduled job for Wed, Jan 24 2018 @ 4:00:00 PM EST (in 1920.557s), with 1 more job pending
+341ms ╚Event processed successfully (341ms)


#11

How do I do that?


#12

Click on these 2 statements, one at a time.
image
Then click on the settings cog at the bottom.
You should find it there. You will then see a blue + symbol next to the statement when selected.


#13

Well, that seems to have worked! I tested it a couple of times and it worked each time. So should I leave the While Loop as Asyncronous or does the ALWAYS SUBSCRIBE take care of it?


#14

I don’t think making your WHILE async actually did anything. Not 100% sure though.
As I said earlier, mixing triggers and conditions can cause issues.
For belt and braces, whenever I mix the 2 I always make the conditions ALWAYS SUBSCRIBE.
Probably not good practice, but hey, if it works, do it. :wink:
Glad you got it working.


#15

So far so good! I will see what happens tomorrow morning. The reason I set it up this way is so that if the light was turned off before the fading up had finished then the light would stay off. When using a FADE command, it would just keep coming back on. So this has really helped me to learn. Thanks for the help!


#16

It skipped the while loop because of the bold lines. We’re turning your light on, then checking the status of the swtich .043 seconds later. Your switch still reports it is off, so the condition evaluates false and the While loop is skipped.

You can probably use another boolean variable (DimmingActive) or something like that in its place. That won’t have the status update delay that the switch is having.

Then I’m certain the piston as posted would work.


#17

But what was happening was that the light would indeed go on and set its’ fade level at 1%. But then it would skip the while loop. It would stay on at 1%. Having changed the two conditions in the While Loop to “Always Subscribe” seems to make it check the conditions and upon finding that the conditions are true it goes through the loop until it reaches the 80% or the light is turned off.


#18

Right, because it’s part of the THEN statement when your IF condition evaluates true. The problem is, the 1% command isn’t processed by your device in 0.043 seconds… it probably hasn’t even received it yet. So when your piston evaluates the switch, .043 seconds after the “set level” command, it is still reporting off.

Yes, this will retrigger the piston when your light changes to ON and is reported to ST. I’m sure you’ve used the ST app to turn lights on and notice the delay… certainly longer than 4/100th’s of a second. :slight_smile:

I was just trying to highlight exactly why the piston was failing in the first place so you could understand why as opposed to just trying things until it worked. Not taking away from the other workaround.

By subscribing to other conditions, you’re re-triggering your entire piston when ST gets a report from your switch that it has turned on (from the set level to 1% command). So the condition for your WHILE loop is met and it executes.

Using a variable would allow it to flow through the piston one time to complete your loop… probably doesn’t matter but I know when things don’t work I like to know exactly why and wanted to point out where it was failing.


#19

This is definitely good to know and learn. I understand what you are saying. So how do I do it with a “dimming” variable?


#20

I was going to use a DimmingActive Boolean that is set true at the beginning of the dimming sequence, then set false at the end. Then I realized that would break your current function of the dimmer cancelling if Alexa or a light switch was used to shut the light off.

So in this piston, I created a third condition for the WHILE loop. It will continue the fade loop as long as the fade level is below the max, and either the FadeLevel is 1 OR the light switch is not off.

Since the fade level will always be 1 the first time the WHILE loop is reached, that will allow it to pass the condition even though the switch is reporting as ‘off’. Since the loop includes an 8 second wait, by the time the fade level is set to 2, the switch will be reporting ‘on’.

Hope this works! Always fun working through these…