Make ST Switch check light on or off before executing comand


#9

OMG how god damn true!

As for the code I’m still not getting something right but I think you’ve steered me on to the right path I just need to figure out my devices.

Cheers guys


#10

Did you try importing my piston above and testing that?


If you are working with a different piston, you can click on the green camera pic and then post that image here for review.


#11

Yes I imported the above and have actually got it working thank you so much for that.

The only issue I’m running into now is that it works for a split second before turning off again.
The only way I could get it to begin working with your piston was to turn the code optimisation off, but I’m now having this other issue :frowning:

Not sure if I need to ad a end with execution to the end of the string to stop it from replaying the piston or something. Would love any insight you might have.

Cheers


#12

Please turn Logging Level to Full and post an error here (along with a green snapshot and Trace turned on)… It sounds like the button may be sending a “push” twice.


#13

12/8/2019, 8:35:35 AM +939ms
+1ms ╔Received event [212 Montague].test = 1575754535939 with a delay of 0ms
+97ms ║RunTime Analysis CS > 25ms > PS > 53ms > PE > 18ms > CE
+99ms ║Runtime (37330 bytes) successfully initialized in 53ms (v0.3.110.20191009) (97ms)
+101ms ║╔Execution stage started
+113ms ║║Cancelling condition #2’s schedules…
+114ms ║║Condition #2 evaluated false (8ms)
+116ms ║║Cancelling condition #1’s schedules…
+117ms ║║Condition group #1 evaluated false (state changed) (11ms)
+122ms ║╚Execution stage complete. (21ms)
+123ms ╚Event processed successfully (123ms)


#14

Please turn on Trace and post a fresh green snapshot…

Also, the Test button does nothing in this piston. We need to see a log from a real error.
(IE: push the ST button)


#15

12/8/2019, 8:35:35 AM +939ms
+1ms ╔Received event [212 Montague].test = 1575754535939 with a delay of 0ms
+97ms ║RunTime Analysis CS > 25ms > PS > 53ms > PE > 18ms > CE
+99ms ║Runtime (37330 bytes) successfully initialized in 53ms (v0.3.110.20191009) (97ms)
+101ms ║╔Execution stage started
+113ms ║║Cancelling condition #2’s schedules…
+114ms ║║Condition #2 evaluated false (8ms)
+116ms ║║Cancelling condition #1’s schedules…
+117ms ║║Condition group #1 evaluated false (state changed) (11ms)
+122ms ║╚Execution stage complete. (21ms)
+123ms ╚Event processed successfully (123ms)


#16

Thank you for the Trace. Now we just need to see a log after you press the ST button…


#17

Oh Sorry I thought that was the log


#18

12/8/2019, 9:44:28 AM +955ms
+1ms ╔Received event [Grayden Lamp].button = pushed with a delay of 153ms
+43ms ║RunTime Analysis CS > 11ms > PS > 23ms > PE > 9ms > CE
+45ms ║Runtime (37326 bytes) successfully initialized in 23ms (v0.3.110.20191009) (43ms)
+46ms ║╔Execution stage started
+52ms ║║Comparison (enum) pushed gets (string) pushed = true (1ms)
+53ms ║║Condition #2 evaluated true (4ms)
+54ms ║║Condition group #1 evaluated true (state did not change) (5ms)
+64ms ║║Comparison (enum) on is (string) on = true (1ms)
+65ms ║║Condition #4 evaluated true (9ms)
+66ms ║║Condition group #3 evaluated true (state did not change) (11ms)
+68ms ║║Cancelling statement #7’s schedules…
+77ms ║║Executed physical command [Bedside Lamp 1].off() (6ms)
+78ms ║║Executed [Bedside Lamp 1].off (8ms)
+80ms ║╚Execution stage complete. (34ms)
+81ms ╚Event processed successfully (81ms)
12/8/2019, 9:44:13 AM +240ms
+2ms ╔Received event [Grayden Lamp].button = pushed with a delay of 158ms
+86ms ║RunTime Analysis CS > 21ms > PS > 52ms > PE > 13ms > CE
+88ms ║Runtime (37327 bytes) successfully initialized in 52ms (v0.3.110.20191009) (86ms)
+89ms ║╔Execution stage started
+94ms ║║Comparison (enum) pushed gets (string) pushed = true (0ms)
+95ms ║║Condition #2 evaluated true (3ms)
+96ms ║║Condition group #1 evaluated true (state did not change) (4ms)
+111ms ║║Comparison (enum) on is (string) on = true (1ms)
+112ms ║║Condition #4 evaluated true (14ms)
+112ms ║║Condition group #3 evaluated true (state did not change) (15ms)
+114ms ║║Cancelling statement #7’s schedules…
+161ms ║║Executed physical command [Bedside Lamp 1].off() (43ms)
+162ms ║║Executed [Bedside Lamp 1].off (44ms)
+164ms ║╚Execution stage complete. (75ms)
+165ms ╚Event processed successfully (165ms)
12/8/2019, 9:19:15 AM +732ms
+1ms ╔Received event [Grayden Lamp].button = pushed with a delay of 167ms
+87ms ║RunTime Analysis CS > 21ms > PS > 53ms > PE > 12ms > CE
+89ms ║Runtime (37332 bytes) successfully initialized in 53ms (v0.3.110.20191009) (86ms)
+89ms ║╔Execution stage started
+95ms ║║Comparison (enum) pushed gets (string) pushed = true (0ms)
+96ms ║║Cancelling condition #2’s schedules…
+96ms ║║Condition #2 evaluated true (4ms)
+97ms ║║Cancelling condition #1’s schedules…
+98ms ║║Condition group #1 evaluated true (state changed) (6ms)
+112ms ║║Comparison (enum) on is (string) on = true (1ms)
+113ms ║║Condition #4 evaluated true (14ms)
+114ms ║║Condition group #3 evaluated true (state did not change) (15ms)
+116ms ║║Cancelling statement #7’s schedules…
+133ms ║║Executed physical command [Bedside Lamp 1].off() (12ms)
+133ms ║║Executed [Bedside Lamp 1].off (14ms)
+135ms ║╚Execution stage complete. (46ms)
+136ms ╚Event processed successfully (136ms)
12/8/2019, 8:35:35 AM +939ms
+1ms ╔Received event [212 Montague].test = 1575754535939 with a delay of 0ms
+97ms ║RunTime Analysis CS > 25ms > PS > 53ms > PE > 18ms > CE
+99ms ║Runtime (37330 bytes) successfully initialized in 53ms (v0.3.110.20191009) (97ms)
+101ms ║╔Execution stage started
+113ms ║║Cancelling condition #2’s schedules…
+114ms ║║Condition #2 evaluated false (8ms)
+116ms ║║Cancelling condition #1’s schedules…
+117ms ║║Condition group #1 evaluated false (state changed) (11ms)
+122ms ║╚Execution stage complete. (21ms)
+123ms ╚Event processed successfully (123ms)

Clear

Full


#19

Thanks for the logs…

It seems like, at all three times, White Bulb 2 was seen as “ON”, so webCoRE sent the “OFF” command…

9:19:15 AM:
║║Condition #4 evaluated true (14ms)
║║Executed physical command [Bedside Lamp 1].off()

9:44:13 AM:
║║Condition #4 evaluated true (14ms)
║║Executed physical command [Bedside Lamp 1].off()

9:44:28 AM:
║║Condition #4 evaluated true (14ms)
║║Executed physical command [Bedside Lamp 1].off()

Was there any issues with those three times?


I do not see this happening in your log…


#20

Oh sorry,

The reason it shows that is it has the same behaviour when its already turned on. So I ran it with the light on. So for instance I can turn it on with the lifx app then hit the ST button and it goes off for a split second then comes back on.

When it’s off it does it in reverse of course. But I’ll run it again with the light off so you can see the log. Thanks again for all your continued help WCmore :slight_smile:


#21

12/8/2019, 12:19:38 PM +684ms
+1ms ╔Received event [Grayden Lamp].button = pushed with a delay of 178ms
+87ms ║RunTime Analysis CS > 21ms > PS > 51ms > PE > 16ms > CE
+89ms ║Runtime (37330 bytes) successfully initialized in 51ms (v0.3.110.20191009) (87ms)
+90ms ║╔Execution stage started
+95ms ║║Comparison (enum) pushed gets (string) pushed = true (0ms)
+97ms ║║Condition #2 evaluated true (3ms)
+97ms ║║Condition group #1 evaluated true (state did not change) (4ms)
+109ms ║║Comparison (enum) off is (string) on = false (1ms)
+110ms ║║Condition #4 evaluated false (11ms)
+111ms ║║Condition group #3 evaluated false (state did not change) (12ms)
+113ms ║║Cancelling statement #5’s schedules…
+131ms ║║Executed physical command [Bedside Lamp 1].on() (14ms)
+132ms ║║Executed [Bedside Lamp 1].on (16ms)
+134ms ║╚Execution stage complete. (44ms)
+135ms ╚Event processed successfully (134ms)
12/8/2019, 12:19:27 PM +848ms
+1ms ╔Received event [Grayden Lamp].button = pushed with a delay of 174ms
+89ms ║RunTime Analysis CS > 22ms > PS > 53ms > PE > 15ms > CE
+91ms ║Runtime (37327 bytes) successfully initialized in 53ms (v0.3.110.20191009) (89ms)
+92ms ║╔Execution stage started
+97ms ║║Comparison (enum) pushed gets (string) pushed = true (0ms)
+99ms ║║Condition #2 evaluated true (3ms)
+99ms ║║Condition group #1 evaluated true (state did not change) (4ms)
+110ms ║║Comparison (enum) off is (string) on = false (1ms)
+112ms ║║Cancelling condition #4’s schedules…
+112ms ║║Condition #4 evaluated false (11ms)
+113ms ║║Cancelling condition #3’s schedules…
+114ms ║║Condition group #3 evaluated false (state changed) (13ms)
+116ms ║║Cancelling statement #5’s schedules…
+134ms ║║Executed physical command [Bedside Lamp 1].on() (14ms)
+135ms ║║Executed [Bedside Lamp 1].on (15ms)
+137ms ║╚Execution stage complete. (45ms)
+138ms ╚Event processed successfully (138ms)


#22

The last log you posted, turned on the light because it was seen as off.

12:19:27 PM
║║Condition #4 evaluated false
║║Executed physical command [Bedside Lamp 1].on()

12:19:38 PM
║║Condition #4 evaluated false
║║Executed physical command [Bedside Lamp 1].on()


In all the logs you posted, this issue is nowhere to be found… We need to see the issue to be able to troubleshoot it… Perhaps you have some other programming controlling that light?!?


#23

Would a video of the issue help do you think? Or based on the fact that the logs don’t show any issue would I be better off going back through my WC setup and re adding my devices and retrying the piston from there do you think?

Cheers


#24

Ok so I went back over everything and realised the reason I was probably having an issue was I had accidently left a previous piston running.

However after deleting all the pistons connected to that switch and re-installing your piston it is not effecting the light at all. When the light is turned on via Lifx app and I press the ST button to turn it off nothing happens until I press the ST button a second time and then it will turn off.

Below is the log:

12/9/2019, 11:18:45 AM +523ms
+0ms ╔Received event [Grayden Lamp].button = pushed with a delay of 158ms
+45ms ║RunTime Analysis CS > 11ms > PS > 26ms > PE > 8ms > CE
+48ms ║Runtime (37172 bytes) successfully initialized in 26ms (v0.3.110.20191009) (46ms)
+48ms ║╔Execution stage started
+54ms ║║Comparison (enum) pushed gets (string) pushed = true (1ms)
+55ms ║║Condition #2 evaluated true (3ms)
+56ms ║║Condition group #1 evaluated true (state did not change) (5ms)
+64ms ║║Comparison (enum) on is (string) on = true (1ms)
+65ms ║║Cancelling condition #4’s schedules…
+67ms ║║Condition #4 evaluated true (8ms)
+68ms ║║Cancelling condition #3’s schedules…
+69ms ║║Condition group #3 evaluated true (state changed) (11ms)
+71ms ║║Cancelling statement #7’s schedules…
+2342ms ║║Executed physical command [Bedside Lamp 1].off() (2269ms)
+2343ms ║║Executed [Bedside Lamp 1].off (2271ms)
+2345ms ║╚Execution stage complete. (2297ms)
+2346ms ╚Event processed successfully (2346ms)
12/9/2019, 11:18:35 AM +146ms
+2ms ╔Received event [Grayden Lamp].button = pushed with a delay of 181ms
+82ms ║RunTime Analysis CS > 21ms > PS > 49ms > PE > 12ms > CE
+84ms ║Runtime (37170 bytes) successfully initialized in 49ms (v0.3.110.20191009) (81ms)
+85ms ║╔Execution stage started
+90ms ║║Comparison (enum) pushed gets (string) pushed = true (0ms)
+92ms ║║Condition #2 evaluated true (3ms)
+92ms ║║Condition group #1 evaluated true (state did not change) (4ms)
+101ms ║║Comparison (enum) off is (string) on = false (1ms)
+102ms ║║Cancelling condition #4’s schedules…
+103ms ║║Condition #4 evaluated false (8ms)
+103ms ║║Cancelling condition #3’s schedules…
+104ms ║║Condition group #3 evaluated false (state changed) (10ms)
+106ms ║║Cancelling statement #5’s schedules…
+2167ms ║║Executed physical command [Bedside Lamp 1].on() (2059ms)
+2168ms ║║Executed [Bedside Lamp 1].on (2061ms)
+2170ms ║╚Execution stage complete. (2086ms)
+2171ms ╚Event processed successfully (2171ms)
12/9/2019, 11:18:23 AM +21ms
+2ms ╔Received event [Grayden Lamp].button = pushed with a delay of 196ms
+85ms ║RunTime Analysis CS > 21ms > PS > 50ms > PE > 14ms > CE
+87ms ║Runtime (37150 bytes) successfully initialized in 50ms (v0.3.110.20191009) (84ms)
+88ms ║╔Execution stage started
+93ms ║║Comparison (enum) pushed gets (string) pushed = true (0ms)
+94ms ║║Cancelling condition #2’s schedules…
+95ms ║║Condition #2 evaluated true (4ms)
+96ms ║║Cancelling condition #1’s schedules…
+97ms ║║Condition group #1 evaluated true (state changed) (5ms)
+105ms ║║Comparison (enum) on is (string) on = true (1ms)
+106ms ║║Condition #4 evaluated true (8ms)
+107ms ║║Condition group #3 evaluated true (state did not change) (9ms)
+109ms ║║Cancelling statement #7’s schedules…
+2316ms ║║Executed physical command [Bedside Lamp 1].off() (2204ms)
+2316ms ║║Executed [Bedside Lamp 1].off (2206ms)
+2319ms ║╚Execution stage complete. (2230ms)
+2319ms ╚Event processed successfully (2319ms)

Clear

Full


#25

We’ve all done this at one point or another…


This sounds like the device is not reporting to the hub when the Lifx app changes the light. I would consider trying a different Device Handler.


As far as the latest logs, it looks like webCoRE is doing exactly as instructed:

11:18:23 AM
║║Condition #4 evaluated true
║║Executed physical command [Bedside Lamp 1].off()

11:18:35 AM
║║Condition #4 evaluated false
║║Executed physical command [Bedside Lamp 1].on()

11:18:45 AM
║║Condition #4 evaluated true
║║Executed physical command [Bedside Lamp 1].off()

All clues point towards the Lifx app is likely bypassing the ST hub, so the ST hub (and webCoRE) is unaware of any changes…


#26

Yeah I had that thought also. But it also happens with Google Assistant.

Do you think it’s just the lights not reporting to ST hub that they’re on/off when triggered by anything other than the ST button?

Thanks again for all your help WCmore I know its not always easy helping noobs as we just don’t get it. But even with the help you have given me I’ve learnt a lot so I really appreciate it. I see looking through the forums that you’re super active here so I’m happy if you want to put this one to bed and I’ll work on some other ways of working around this on my own and you can help others with their predicaments.

Thanks again :smiley:


#27

I think the general concept is, normally each device can only have one “master” hub… I suspect that Lixf took “claim” of that bulb, which is likely why the ST hub is not “in tune” with the current conditions.

(IE: Google Assistant is likely sending the command to Lifx, not SmartThings)


#28

Yeah I’d say that’s what’s happening as well. Thanks again WCmore.

Now go, return in to the forums, and be the hero we need. Where ever broken piston’s lurk or grumpy spouses and partners despair at a smart home… He is THERE.

:joy::rofl::joy: