Lights not turning off


#21

Like this?:


#22

You need the first if statement to encompass everything.

Edit: I’m usually limited to mobile. So it makes helping more difficult. Give me some time and I’ll whip up a piston


#23

@c1arkbar

So the piston fired, but my lights turned on and off a couple times and stayed off. Tried to fix it and the logs are gone .

I did notice that all the lights were set to 1%, which is something I added at the end of the script (fade from 100 to 1 in 60 seconds). The problem was that it all happened so fast, I dont think it waited 60 seconds to fade.

Ive since scrapped the fade, and would kist like to get the lights to come on, white, 15 minutes before sunset at 100%. Then 10 minutes before sunset, if the month is X, follow the rest of whats posted in the piston.

EDIT: Not sure why this didnt actually post when I wrote it. It was about 20 minutes ago… SOrry.

I appreciate all your assistance with this.


#24

Ok so here is what I was mentioning earlier about using a switch/case statement. To describe what is happening here. If the time is between 15 minutes to sunset and 10:30 pm then it will evaluate the month. It will take 10 and check each case for a match. If it finds one then it will complete the actions in that case. If it does not find a match then it will use the default case which has your normal colors.

Some issues that might surface from this. With the turn off being in the else of the time condition then you might find it difficult to turn on those lights outside of the timeframe but that might not be the case. At any rate you can import this and replace your lights back with how you had them. I used similar device types where you did so it should make for an easy transition.


#25

Thanks for this! Ive imported and set MY lights to corespond with it.

The only time I ever have these lights called via another piston (in CoRe still), is in the second half (or-If) of my good night piston, which calls for them to come on between 1030 PM and 0600 AM if any of my presence sensors arrive in that time frame, do some other stuff (SHM disarm, interior lights, etc) wait 10 minutes and turn off.

And Im certain Ill need my hand held when it comes to that Core transition!


#26

You are welcome. And this will be easy to add months to this piston as well. You will just select add a new case. Input the value of the month you want and bam. Add your actions!

Well when you decide to make that transfer we will be here to help. Currently I have an entire piston that controls just my location mode and shm. Its listed in the wiki as Home Scheduler. Separate from that one I have one that handles any arrival/departure for us. Those two work in tandem to keep the mode in check. Then I build other pistons based on the mode instead of checking for the same type of thing in different pistons.


#27

A couple things after using your piston:
Firstly, I forgot to turn on full logging…Its on now and I’m leaving it on until this piston works fully.

For some reason, my porch light (Bulb 5)showed, in the ST app, that after this piston ran and shut everything off, that it powered on, then off, then on, and back off again. The color was set correctly while it was on, though.

Also, the other light that is grouped with my porch light (bulb 2 and 5) never set the correct color (purple).

Since Im using a Hue bridge, should I put a longer “wait” command between the actions? I recall someone saying or having around a 10 second wait between each action when a hue bridge was involved.

Thoughts?


#28

I can’t test this later when I get home. I have hue bulbs through the bridge as well. But I don’t think I’ve had issues with waits.


#29

Ok, thanks. Im gonna sit on my front porch tonight and see what happens when they turn on.

First Im going to go into each light and move the brightness and color to something other than what this piston calls for, then turn them off. Watch the piston fire (with logging on :wink: ) and Ill report back.

Do I need to turn TCP to never for anything in this piston?


#30

No that won’t be necessary. Only if you had a long wait where the condition could revert back to false


#31

Below are the logs fromyesterday. Apparently there was someone in my house that toggled my porch light, so it didnt come on as it should have. Either way, the brightness of the driveway lights did not set properly to 100%. And the some lights showed “on” again after this piston turned off the lights at 1030. Almost like I was chasing the lights to turn them off again.

10/4/2017, 10:29:59 PM +366ms
+1ms ╔Received event [Home].time = 1507174200000 with a delay of -635ms
+170ms ║RunTime Analysis CS > 27ms > PS > 55ms > PE > 89ms > CE
+183ms ║Runtime (43633 bytes) successfully initialized in 55ms (v0.2.0ec.20170927) (181ms)
+184ms ║╔Execution stage started
+264ms ║║Comparison (time) 80999563 is_between (time) 1507160400000 … (time) 81000000 = false (13ms)
+267ms ║║Cancelling condition #6’s schedules…
+268ms ║║Condition #6 evaluated false (71ms)
+274ms ║║Cancelling statement #6’s schedules…
+286ms ║║Requesting time schedule wake up at Thu, Oct 5 2017 @ 6:25:00 PM CDT
+290ms ║║Cancelling condition #1’s schedules…
+291ms ║║Condition group #1 evaluated false (state changed) (96ms)
+295ms ║║Cancelling statement #68’s schedules…
+353ms ║║Executed physical command [Driveway 2].off() (51ms)
+354ms ║║Executed [Driveway 2].off (52ms)
+419ms ║║Executed physical command [Driveway].off() (61ms)
+420ms ║║Executed [Driveway].off (63ms)
+448ms ║║Executed physical command [Front Porch Plug].off() (24ms)
+449ms ║║Executed [Front Porch Plug].off (26ms)
+478ms ║║Executed physical command [Garden Spot].off() (25ms)
+479ms ║║Executed [Garden Spot].off (27ms)
+526ms ║║Executed physical command [Porch].off() (44ms)
+527ms ║║Executed [Porch].off (46ms)
+533ms ║╚Execution stage complete. (348ms)
+535ms ║Setting up scheduled job for Thu, Oct 5 2017 @ 6:25:00 PM CDT (in 71700.1s)
+555ms ╚Event processed successfully (555ms)

10/4/2017, 6:25:07 PM +348ms
+0ms ╔Received event [Home].time = 1507159508708 with a delay of -1361ms
+328ms ║RunTime Analysis CS > 196ms > PS > 51ms > PE > 82ms > CE
+339ms ║Runtime (43635 bytes) successfully initialized in 51ms (v0.2.0ec.20170927) (338ms)
+340ms ║╔Execution stage started
+357ms ║║Evaluating switch with values [[i:75:null:0, v:[t:integer, v:10, vt:string]]]
+362ms ║║Comparison (integer) 10 is (integer) 10 = true (3ms)
+441ms ║║Executed physical command [Driveway].setColor([[hex: #800080, hue:83, saturation:100, level:25]]) (57ms)
+443ms ║║Executed [Driveway].setColor (68ms)
+488ms ║║Executed physical command [Porch].setColor([[hex: #800080, hue:83, saturation:100, level:25]]) (41ms)
+489ms ║║Executed [Porch].setColor (44ms)
+496ms ║║Fast executing schedules, waiting for 1872ms to sync up
+2384ms ║║Evaluating switch with values [[i:75:null:0, v:[t:integer, v:10, vt:string]]]
+2389ms ║║Comparison (integer) 10 is (integer) 10 = true (3ms)
+2452ms ║║Executed physical command [Driveway 2].setColor([[hex: #FF8C00, hue:9, saturation:100, level:50]]) (44ms)
+2453ms ║║Executed [Driveway 2].setColor (46ms)
+2458ms ║╚Execution stage complete. (2118ms)
+2461ms ║Setting up scheduled job for Wed, Oct 4 2017 @ 10:30:00 PM CDT (in 14690.193s)
+2477ms ╚Event processed successfully (2478ms)

10/4/2017, 6:25:03 PM +169ms
+1ms ╔Received event [Home].time = 1507159504554 with a delay of -1386ms
+370ms ║RunTime Analysis CS > 47ms > PS > 64ms > PE > 259ms > CE
+382ms ║Runtime (43635 bytes) successfully initialized in 64ms (v0.2.0ec.20170927) (380ms)
+384ms ║╔Execution stage started
+402ms ║║Evaluating switch with values [[i:75:null:0, v:[t:integer, v:10, vt:string]]]
+410ms ║║Comparison (integer) 10 is (integer) 10 = true (3ms)
+473ms ║║Executed physical command [Driveway].setLevel([100]) (48ms)
+475ms ║║Executed [Driveway].setLevel (51ms)
+529ms ║║Executed physical command [Porch].setLevel([100]) (50ms)
+530ms ║║Executed [Porch].setLevel (52ms)
+536ms ║║Executed virtual command [Driveway, Porch].wait (1ms)
+538ms ║║Requesting a wake up for Wed, Oct 4 2017 @ 6:25:08 PM CDT (in 5.0s)
+549ms ║║Fast executing schedules, waiting for 898ms to sync up
+1467ms ║║Evaluating switch with values [[i:75:null:0, v:[t:integer, v:10, vt:string]]]
+1472ms ║║Comparison (integer) 10 is (integer) 10 = true (3ms)
+1537ms ║║Executed physical command [Driveway 2].setLevel([100]) (45ms)
+1538ms ║║Executed [Driveway 2].setLevel (47ms)
+1544ms ║║Executed virtual command [Driveway 2].wait (1ms)
+1545ms ║║Requesting a wake up for Wed, Oct 4 2017 @ 6:25:09 PM CDT (in 5.0s)
+1557ms ║╚Execution stage complete. (1173ms)
+1560ms ║Setting up scheduled job for Wed, Oct 4 2017 @ 6:25:08 PM CDT (in 3.98s), with 2 more jobs pending
+1576ms ╚Event processed successfully (1576ms)

10/4/2017, 6:24:59 PM +162ms
+1ms ╔Received event [Home].time = 1507159500000 with a delay of -839ms
+134ms ║RunTime Analysis CS > 25ms > PS > 46ms > PE > 64ms > CE
+146ms ║Runtime (43638 bytes) successfully initialized in 46ms (v0.2.0ec.20170927) (145ms)
+148ms ║╔Execution stage started
+218ms ║║Comparison (time) 66299322 is_between (time) 1507160400000 … (time) 81000000 = true (12ms)
+220ms ║║Time restriction check passed
+222ms ║║Cancelling condition #6’s schedules…
+223ms ║║Condition #6 evaluated true (64ms)
+243ms ║║Cancelling statement #6’s schedules…
+258ms ║║Requesting time schedule wake up at Wed, Oct 4 2017 @ 10:30:00 PM CDT
+262ms ║║Cancelling condition #1’s schedules…
+263ms ║║Condition group #1 evaluated true (state changed) (105ms)
+268ms ║║Evaluating switch with values [[i:75:null:0, v:[t:integer, v:10, vt:string]]]
+274ms ║║Comparison (integer) 10 is (integer) 10 = true (3ms)
+278ms ║║Cancelling statement #2’s schedules…
+330ms ║║Executed physical command [Driveway].on() (47ms)
+331ms ║║Executed [Driveway].on (49ms)
+384ms ║║Executed physical command [Porch].on() (49ms)
+384ms ║║Executed [Porch].on (51ms)
+390ms ║║Executed virtual command [Driveway, Porch].wait (1ms)
+392ms ║║Requesting a wake up for Wed, Oct 4 2017 @ 6:25:04 PM CDT (in 5.0s)
+399ms ║║Cancelling statement #71’s schedules…
+445ms ║║Executed physical command [Driveway 2].on() (41ms)
+446ms ║║Executed [Driveway 2].on (43ms)
+452ms ║║Executed virtual command [Driveway 2].wait (0ms)
+453ms ║║Requesting a wake up for Wed, Oct 4 2017 @ 6:25:04 PM CDT (in 5.0s)
+461ms ║║Cancelling statement #74’s schedules…
+491ms ║║Executed physical command [Garden Spot].on() (25ms)
+492ms ║║Executed [Garden Spot].on (27ms)
+531ms ║║Executed physical command [Garden Spot].setColor([[hex: #FF0000, hue:0, saturation:100, level:50]]) (23ms)
+532ms ║║Executed [Garden Spot].setColor (37ms)
+565ms ║║Executed physical command [Garden Spot].setLevel([100]) (21ms)
+566ms ║║Executed [Garden Spot].setLevel (29ms)
+574ms ║╚Execution stage complete. (427ms)
+577ms ║Setting up scheduled job for Wed, Oct 4 2017 @ 6:25:04 PM CDT (in 4.816s), with 2 more jobs pending
+594ms ╚Event processed successfully (593ms)

10/4/2017, 7:37:17 AM +65ms
+1ms ╔Received event [Home].test = 1507120636794 with a delay of 270ms
+165ms ║RunTime Analysis CS > 37ms > PS > 47ms > PE > 81ms > CE
+180ms ║Runtime (43499 bytes) successfully initialized in 47ms (v0.2.0ec.20170927) (176ms)
+182ms ║╔Execution stage started
+247ms ║║Comparison (time) 27437260 is_between (time) 1507160400000 … (time) 81000000 = false (15ms)
+252ms ║║Condition #6 evaluated false (56ms)
+267ms ║║Cancelling statement #6’s schedules…
+282ms ║║Requesting time schedule wake up at Wed, Oct 4 2017 @ 6:25:00 PM CDT
+291ms ║║Condition group #1 evaluated false (state did not change) (97ms)
+298ms ║║Cancelling statement #68’s schedules…
+320ms ║║Skipped execution of physical command [Driveway 2].off([]) because it would make no change to the device. (3ms)
+321ms ║║Executed [Driveway 2].off (12ms)
+327ms ║║Skipped execution of physical command [Driveway].off([]) because it would make no change to the device. (2ms)
+329ms ║║Executed [Driveway].off (4ms)
+360ms ║║Executed physical command [Front Porch Plug].off() (28ms)
+361ms ║║Executed [Front Porch Plug].off (30ms)
+368ms ║║Skipped execution of physical command [Garden Spot].off([]) because it would make no change to the device. (3ms)
+369ms ║║Executed [Garden Spot].off (5ms)
+376ms ║║Skipped execution of physical command [Porch].off([]) because it would make no change to the device. (3ms)
+377ms ║║Executed [Porch].off (5ms)
+398ms ║╚Execution stage complete. (217ms)
+410ms ║Setting up scheduled job for Wed, Oct 4 2017 @ 6:25:00 PM CDT (in 38862.527s)
+426ms ╚Event processed successfully (426ms)


#32

Any thoughts, @c1arkbar?

Same issue last night, where the levels didnt set to 100%


#33

Sorry never had a chance to get on last night. Can you create a simple test piston that just has actions in it.

With hue lights
Set color to red
Turn on

Basically simple things to see if you need these waits. Try different things like using HSL instead of color. Mixing up where the turn on command is etc.


#34

Having the same issue, tried multiple was of writing the if statements but timers not triggering properly.

For me also whenever I add a Fade effect it messes up the whole piston (possibly a bug here?)

Interested in the Hue wait times as haven’t read about this before and most of mine are Hue.


#35

I tried moving the order around, putting the “set level” first, and that didnt work.

I wonder if its holding onto the last level that the Hue Bridge controlled via the Hue app? Meaning, if I open the Hue app, turn the lights on (any color) and then set the level to 100, then turn the lights off, will webCore be able to keep that level, but change the color to the intended ones?

Im at a loss as well.

Paging @ady624 for guidance


#36

Sorry I haven’t been around a lot this week. Been super busy at work and home. But I don’t seem to run into the same issues with my hue bulbs as you.

Do you actively use the hue app? Because I can’t remember the last time I ever opened it.


#37

I don’t, but I have. I’ve used it to check the status quickly and initially change color and levels when troubleshooting this issue .


#38

So Ive tried moving the order around within the piston and its not making a difference.

I was outside a few nights ago when this fired, and the lights turned on at 100% but then dropped to 25,50, and 25%.

They are not being used or called with any other piston or controlled by any smart lighting application. Im really stumped as to why they are doing this.

The one thing I havent tried is removing the line that sets the level, and see if that works.