Webcore thinks light is on when it is definitely not


#1

1) Give a description of the problem
My garage light will be turned off if no motion AND the light is ON. Alexa will announce when turning off garage light. Well it keeps announcing turning off garage light … I’ve checked and smartthings on the web and the app, say that the light is off. I added a capture of the state of the light and timestamp when it goes down the leg where no motion and light is on and the variable says true (light is on)…

2) What is the expected behaviour?
properly read the state of the light switch

3) What is happening/not happening?
detects light is on, when it is not

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


(UPLOAD YOUR IMAGE HERE)

5) Attach logs after turning logging level to Full

Hide/Show Logs

4/25/2020, 3:02:45 PM +131ms
+1ms ╔Received event [Home].time = 1587844966732 with a delay of -1601ms
+110ms ║RunTime Analysis CS > 34ms > PS > 35ms > PE > 41ms > CE
+113ms ║Runtime (39957 bytes) successfully initialized in 35ms (v0.3.110.20191009) (112ms)
+114ms ║╔Execution stage started
+127ms ║║Cancelling condition #5's schedules...
+128ms ║║Condition #5 evaluated true (2ms)
+343ms ║║Comparison (enum) on is (string) on = true (2ms)
+344ms ║║Condition #6 evaluated true (216ms)
+345ms ║║Cancelling condition #4's schedules...
+346ms ║║Condition group #4 evaluated true (state changed) (220ms)
+348ms ║║Cancelling statement #19's schedules...
+357ms ║║Executed virtual command setVariable (3ms)
+363ms ║║Executed virtual command setVariable (3ms)
+365ms ║║Cancelling statement #7's schedules...
+376ms ║║Executed physical command [Garage light].off() (7ms)
+376ms ║║Executed [Garage light].off (9ms)
+379ms ║║Cancelling statement #11's schedules...
+1525ms ║║Executed physical command [Echo - Garage].speak([Turning off garage light]) (1139ms)
+1526ms ║║Executed [Echo - Garage].speak (1141ms)
+1760ms ║║Executed physical command [Echo - Kitchen].speak([Turning off garage light]) (230ms)
+1761ms ║║Executed [Echo - Kitchen].speak (233ms)
+1766ms ║║Cancelling statement #22's schedules...
+1771ms ║╚Execution stage complete. (1658ms)
+1773ms ╚Event processed successfully (1772ms)
4/25/2020, 2:52:46 PM +623ms
+0ms ╔Received event [Garage Motion Sensor].motion = inactive with a delay of 82ms
+72ms ║RunTime Analysis CS > 16ms > PS > 16ms > PE > 41ms > CE
+75ms ║Runtime (39963 bytes) successfully initialized in 16ms (v0.3.110.20191009) (74ms)
+76ms ║╔Execution stage started
+82ms ║║Comparison (enum) inactive changes_to (string) active = false (1ms)
+83ms ║║Cancelling condition #2's schedules...
+84ms ║║Condition #2 evaluated false (5ms)
+85ms ║║Condition group #1 evaluated false (state did not change) (6ms)
+87ms ║║Cancelling statement #16's schedules...
+95ms ║║Executed virtual command setVariable (3ms)
+100ms ║║Executed virtual command setVariable (3ms)
+106ms ║║Comparison (enum) inactive stays (string) inactive = true (1ms)
+108ms ║║Adding a timed trigger schedule for condition 5
+110ms ║║Condition #5 evaluated false (8ms)
+111ms ║║Condition group #4 evaluated false (state did not change) (9ms)
+113ms ║╚Execution stage complete. (38ms)
+114ms ║Setting up scheduled job for Sat, Apr 25 2020 @ 3:02:46 PM CDT (in 599.995s)
+126ms ╚Event processed successfully (126ms)
4/25/2020, 2:52:31 PM +12ms
+1ms ╔Received event [Garage Motion Sensor].motion = active with a delay of 204ms
+100ms ║RunTime Analysis CS > 17ms > PS > 30ms > PE > 53ms > CE
+103ms ║Runtime (39966 bytes) successfully initialized in 30ms (v0.3.110.20191009) (101ms)
+104ms ║╔Execution stage started
+111ms ║║Comparison (enum) active changes_to (string) active = true (1ms)
+112ms ║║Cancelling condition #2's schedules...
+113ms ║║Condition #2 evaluated true (5ms)
+121ms ║║Comparison (enum) on is (string) off = false (1ms)
+123ms ║║Condition #3 evaluated false (9ms)
+124ms ║║Condition group #1 evaluated false (state did not change) (16ms)
+126ms ║║Cancelling statement #16's schedules...
+133ms ║║Executed virtual command setVariable (3ms)
+138ms ║║Executed virtual command setVariable (2ms)
+145ms ║║Comparison (enum) active stays (string) inactive = false (1ms)
+147ms ║║Cancelling any timed trigger schedules for condition 5
+148ms ║║Cancelling statement #5's schedules...
+149ms ║║Condition #5 evaluated false (8ms)
+150ms ║║Condition group #4 evaluated false (state did not change) (10ms)
+153ms ║╚Execution stage complete. (49ms)
+154ms ╚Event processed successfully (154ms)
4/25/2020, 2:49:20 PM +854ms
+2ms ╔Received event [Garage Motion Sensor].motion = inactive with a delay of 99ms
+89ms ║RunTime Analysis CS > 18ms > PS > 26ms > PE > 45ms > CE
+91ms ║Runtime (39963 bytes) successfully initialized in 26ms (v0.3.110.20191009) (89ms)
+92ms ║╔Execution stage started
+99ms ║║Comparison (enum) inactive changes_to (string) active = false (1ms)
+100ms ║║Cancelling condition #2's schedules...
+101ms ║║Condition #2 evaluated false (5ms)
+102ms ║║Condition group #1 evaluated false (state did not change) (6ms)
+104ms ║║Cancelling statement #16's schedules...
+113ms ║║Executed virtual command setVariable (3ms)
+118ms ║║Executed virtual command setVariable (2ms)
+125ms ║║Comparison (enum) inactive stays (string) inactive = true (1ms)
+127ms ║║Adding a timed trigger schedule for condition 5
+129ms ║║Condition #5 evaluated false (8ms)
+130ms ║║Condition group #4 evaluated false (state did not change) (9ms)
+132ms ║╚Execution stage complete. (40ms)
+134ms ║Setting up scheduled job for Sat, Apr 25 2020 @ 2:59:20 PM CDT (in 599.994s)
+143ms ╚Event processed successfully (143ms)
4/25/2020, 2:49:05 PM +678ms
+2ms ╔Received event [Garage Motion Sensor].motion = active with a delay of 693ms
+103ms ║RunTime Analysis CS > 28ms > PS > 34ms > PE > 41ms > CE
+106ms ║Runtime (39966 bytes) successfully initialized in 34ms (v0.3.110.20191009) (103ms)
+107ms ║╔Execution stage started
+114ms ║║Comparison (enum) active changes_to (string) active = true (1ms)
+116ms ║║Cancelling condition #2's schedules...
+117ms ║║Condition #2 evaluated true (5ms)
+124ms ║║Comparison (enum) on is (string) off = false (1ms)
+126ms ║║Condition #3 evaluated false (9ms)
+127ms ║║Condition group #1 evaluated false (state did not change) (16ms)
+129ms ║║Cancelling statement #16's schedules...
+136ms ║║Executed virtual command setVariable (3ms)
+143ms ║║Executed virtual command setVariable (4ms)
+150ms ║║Comparison (enum) active stays (string) inactive = false (1ms)
+152ms ║║Cancelling any timed trigger schedules for condition 5
+153ms ║║Cancelling statement #5's schedules...
+154ms ║║Condition #5 evaluated false (8ms)
+155ms ║║Condition group #4 evaluated false (state did not change) (9ms)
+158ms ║╚Execution stage complete. (50ms)
+159ms ╚Event processed successfully (158ms)
4/25/2020, 2:47:49 PM +730ms
+2ms ╔Received event [Garage Motion Sensor].motion = inactive with a delay of 95ms
+91ms ║RunTime Analysis CS > 20ms > PS > 29ms > PE > 41ms > CE
+93ms ║Runtime (39963 bytes) successfully initialized in 29ms (v0.3.110.20191009) (90ms)
+94ms ║╔Execution stage started
+101ms ║║Comparison (enum) inactive changes_to (string) active = false (0ms)
+103ms ║║Cancelling condition #2's schedules...
+104ms ║║Condition #2 evaluated false (5ms)
+105ms ║║Condition group #1 evaluated false (state did not change) (7ms)
+107ms ║║Cancelling statement #16's schedules...
+117ms ║║Executed virtual command setVariable (3ms)
+124ms ║║Executed virtual command setVariable (3ms)
+131ms ║║Comparison (enum) inactive stays (string) inactive = true (1ms)
+133ms ║║Adding a timed trigger schedule for condition 5
+135ms ║║Condition #5 evaluated false (9ms)
+136ms ║║Condition group #4 evaluated false (state did not change) (10ms)
+138ms ║╚Execution stage complete. (44ms)
+140ms ║Setting up scheduled job for Sat, Apr 25 2020 @ 2:57:49 PM CDT (in 599.994s)
+151ms ╚Event processed successfully (150ms)
4/25/2020, 2:47:33 PM +749ms
+2ms ╔Received event [Garage Motion Sensor].motion = active with a delay of 114ms
+88ms ║RunTime Analysis CS > 19ms > PS > 27ms > PE > 41ms > CE
+90ms ║Runtime (39965 bytes) successfully initialized in 27ms (v0.3.110.20191009) (88ms)
+91ms ║╔Execution stage started
+185ms ║║Comparison (enum) active changes_to (string) active = true (1ms)
+187ms ║║Cancelling condition #2's schedules...
+188ms ║║Condition #2 evaluated true (92ms)
+196ms ║║Comparison (enum) on is (string) off = false (1ms)
+198ms ║║Condition #3 evaluated false (8ms)
+199ms ║║Condition group #1 evaluated false (state did not change) (104ms)
+201ms ║║Cancelling statement #16's schedules...
+208ms ║║Executed virtual command setVariable (2ms)
+214ms ║║Executed virtual command setVariable (3ms)
+222ms ║║Comparison (enum) active stays (string) inactive = false (2ms)
+224ms ║║Cancelling any timed trigger schedules for condition 5
+225ms ║║Cancelling statement #5's schedules...
+226ms ║║Condition #5 evaluated false (9ms)
+227ms ║║Condition group #4 evaluated false (state did not change) (11ms)
+230ms ║╚Execution stage complete. (138ms)
+231ms ╚Event processed successfully (230ms)
4/25/2020, 2:39:22 PM +143ms
+1ms ╔Received event [Garage Motion Sensor].motion = inactive with a delay of 100ms
+116ms ║RunTime Analysis CS > 25ms > PS > 36ms > PE > 54ms > CE
+118ms ║Runtime (39965 bytes) successfully initialized in 36ms (v0.3.110.20191009) (116ms)
+119ms ║╔Execution stage started
+126ms ║║Comparison (enum) inactive changes_to (string) active = false (1ms)
+127ms ║║Cancelling condition #2's schedules...
+128ms ║║Condition #2 evaluated false (5ms)
+129ms ║║Condition group #1 evaluated false (state did not change) (6ms)
+131ms ║║Cancelling statement #16's schedules...
+140ms ║║Executed virtual command setVariable (3ms)
+146ms ║║Executed virtual command setVariable (2ms)
+152ms ║║Comparison (enum) inactive stays (string) inactive = true (1ms)
+154ms ║║Adding a timed trigger schedule for condition 5
+156ms ║║Condition #5 evaluated false (8ms)
+158ms ║║Condition group #4 evaluated false (state did not change) (9ms)
+160ms ║╚Execution stage complete. (41ms)
+161ms ║Setting up scheduled job for Sat, Apr 25 2020 @ 2:49:22 PM CDT (in 599.994s)
+170ms ╚Event processed successfully (170ms)
4/25/2020, 2:39:06 PM +290ms
+0ms ╔Received event [Garage Motion Sensor].motion = active with a delay of 244ms
+65ms ║RunTime Analysis CS > 14ms > PS > 18ms > PE > 34ms > CE
+67ms ║Runtime (39965 bytes) successfully initialized in 18ms (v0.3.110.20191009) (66ms)
+68ms ║╔Execution stage started
+74ms ║║Comparison (enum) active changes_to (string) active = true (0ms)
+76ms ║║Cancelling condition #2's schedules...
+76ms ║║Condition #2 evaluated true (4ms)
+83ms ║║Comparison (enum) on is (string) off = false (1ms)
+84ms ║║Condition #3 evaluated false (7ms)
+85ms ║║Condition group #1 evaluated false (state did not change) (14ms)
+87ms ║║Cancelling statement #16's schedules...
+93ms ║║Executed virtual command setVariable (2ms)
+97ms ║║Executed virtual command setVariable (2ms)
+103ms ║║Comparison (enum) active stays (string) inactive = false (1ms)
+105ms ║║Cancelling any timed trigger schedules for condition 5
+106ms ║║Cancelling statement #5's schedules...
+107ms ║║Condition #5 evaluated false (7ms)
+107ms ║║Condition group #4 evaluated false (state did not change) (8ms)
+110ms ║╚Execution stage complete. (41ms)
+110ms ╚Event processed successfully (110ms)
4/25/2020, 2:38:28 PM +282ms
+1ms ╔Received event [Garage Motion Sensor].motion = inactive with a delay of 92ms
+78ms ║RunTime Analysis CS > 18ms > PS > 24ms > PE > 36ms > CE
+80ms ║Runtime (39963 bytes) successfully initialized in 24ms (v0.3.110.20191009) (78ms)
+81ms ║╔Execution stage started
+88ms ║║Comparison (enum) inactive changes_to (string) active = false (0ms)
+89ms ║║Cancelling condition #2's schedules...
+90ms ║║Condition #2 evaluated false (5ms)
+91ms ║║Condition group #1 evaluated false (state did not change) (6ms)
+93ms ║║Cancelling statement #16's schedules...
+101ms ║║Executed virtual command setVariable (3ms)
+107ms ║║Executed virtual command setVariable (3ms)
+113ms ║║Comparison (enum) inactive stays (string) inactive = true (1ms)
+115ms ║║Adding a timed trigger schedule for condition 5
+117ms ║║Condition #5 evaluated false (8ms)
+118ms ║║Condition group #4 evaluated false (state did not change) (9ms)
+120ms ║╚Execution stage complete. (39ms)
+122ms ║Setting up scheduled job for Sat, Apr 25 2020 @ 2:48:28 PM CDT (in 599.995s)
+133ms ╚Event processed successfully (133ms)
4/25/2020, 2:38:13 PM +348ms
+2ms ╔Received event [Garage Motion Sensor].motion = active with a delay of 111ms
+93ms ║RunTime Analysis CS > 19ms > PS > 29ms > PE > 44ms > CE
+95ms ║Runtime (39964 bytes) successfully initialized in 29ms (v0.3.110.20191009) (91ms)
+96ms ║╔Execution stage started
+103ms ║║Comparison (enum) active changes_to (string) active = true (1ms)
+104ms ║║Cancelling condition #2's schedules...
+105ms ║║Condition #2 evaluated true (5ms)
+113ms ║║Comparison (enum) on is (string) off = false (1ms)
+115ms ║║Condition #3 evaluated false (9ms)
+116ms ║║Condition group #1 evaluated false (state did not change) (17ms)
+118ms ║║Cancelling statement #16's schedules...
+127ms ║║Executed virtual command setVariable (4ms)
+134ms ║║Executed virtual command setVariable (4ms)
+143ms ║║Comparison (enum) active stays (string) inactive = false (1ms)
+145ms ║║Cancelling any timed trigger schedules for condition 5
+146ms ║║Cancelling statement #5's schedules...
+147ms ║║Cancelling condition #5's schedules...
+148ms ║║Condition #5 evaluated false (11ms)
+150ms ║║Cancelling condition #4's schedules...
+151ms ║║Condition group #4 evaluated false (state changed) (13ms)
+153ms ║╚Execution stage complete. (58ms)
+155ms ╚Event processed successfully (154ms)
4/25/2020, 2:34:39 PM +94ms
+0ms ╔Starting piston... (v0.3.110.20191009)
+274ms ║╔Subscribing to devices...
+317ms ║║Subscribing to Garage Motion Sensor.motion...
+453ms ║║Subscribing to Echo - Garage...
+454ms ║║Subscribing to Echo - Kitchen...
+455ms ║╚Finished subscribing (198ms)
+500ms ║Comparison (enum) on is (string) off = false (2ms)
+502ms ║Cancelling condition #3's schedules...
+521ms ║Comparison (enum) inactive stays (string) inactive = true (2ms)
+523ms ║Cancelling condition #5's schedules...
+531ms ║Comparison (enum) on is (string) on = true (1ms)
+533ms ║Cancelling condition #6's schedules...
+534ms ║Cancelling condition #4's schedules...
+553ms ╚Piston successfully started (552ms)
4/25/2020, 2:34:34 PM +525ms
+1ms ╔Received event [Garage Motion Sensor].motion = inactive with a delay of 74ms
+64ms ║RunTime Analysis CS > 18ms > PS > 17ms > PE > 29ms > CE
+66ms ║Runtime (38919 bytes) successfully initialized in 17ms (v0.3.110.20191009) (64ms)
+67ms ║╔Execution stage started
+74ms ║║Comparison (enum) inactive changes_to (string) active = false (1ms)
+75ms ║║Cancelling condition #2's schedules...
+76ms ║║Condition #2 evaluated false (5ms)
+77ms ║║Cancelling condition #1's schedules...
+78ms ║║Condition group #1 evaluated false (state changed) (6ms)
+84ms ║║Comparison (enum) inactive stays (string) inactive = true (1ms)
+85ms ║║Adding a timed trigger schedule for condition 5
+87ms ║║Cancelling condition #5's schedules...
+88ms ║║Condition #5 evaluated false (8ms)
+89ms ║║Condition group #4 evaluated false (state did not change) (10ms)
+92ms ║╚Execution stage complete. (24ms)
+93ms ║Setting up scheduled job for Sat, Apr 25 2020 @ 2:44:34 PM CDT (in 599.994s)
+104ms ╚Event processed successfully (104ms)
4/25/2020, 2:34:18 PM +504ms
+1ms ╔Received event [Garage Motion Sensor].motion = active with a delay of 85ms
+65ms ║RunTime Analysis CS > 18ms > PS > 17ms > PE > 30ms > CE
+67ms ║Runtime (38924 bytes) successfully initialized in 17ms (v0.3.110.20191009) (65ms)
+68ms ║╔Execution stage started
+75ms ║║Comparison (enum) active changes_to (string) active = true (1ms)
+76ms ║║Cancelling condition #2's schedules...
+77ms ║║Condition #2 evaluated true (5ms)
+84ms ║║Comparison (enum) off is (string) off = true (1ms)
+85ms ║║Condition #3 evaluated true (7ms)
+86ms ║║Cancelling condition #1's schedules...
+87ms ║║Condition group #1 evaluated true (state changed) (15ms)
+89ms ║║Cancelling statement #9's schedules...
+99ms ║║Executed physical command [Garage light].on() (8ms)
+100ms ║║Executed [Garage light].on (10ms)
+102ms ║║Cancelling statement #13's schedules...
+109ms ║║Executed virtual command setVariable (2ms)
+114ms ║║Executed virtual command setVariable (3ms)
+116ms ║╚Execution stage complete. (48ms)
+117ms ╚Event processed successfully (117ms)
4/25/2020, 2:30:26 PM +699ms
+1ms ╔Starting piston... (v0.3.110.20191009)
+440ms ║╔Subscribing to devices...
+460ms ║║Subscribing to Garage Motion Sensor.motion...
+557ms ║║Subscribing to Echo - Garage...
+558ms ║║Subscribing to Echo - Kitchen...
+560ms ║╚Finished subscribing (135ms)
+595ms ║Comparison (enum) off is (string) off = true (1ms)
+609ms ║Comparison (enum) inactive stays (string) inactive = true (2ms)
+616ms ║Comparison (enum) off is (string) on = false (2ms)
+618ms ║Cancelling condition #6's schedules...
+619ms ║Cancelling condition #4's schedules...
+629ms ╚Piston successfully started (628ms)

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


#2

image


#3

You’ve got a second trigger on Line 38 buried under your ELSE statement that is going to cause the entire piston to reevaluate whenever there is a change in the Motion Detector. I’d have to get back to my desktop to figure out the best way to rewrite the piston, but my initial thought would be to try dragging that whole IF statement out from under the ELSE and putting it at the end of the piston.


#5

Here is my question before jumping in,

is there any situation in your garage where motion changes to inactive and light still remains on (another piston etc)

if it’s
Motion - turn the light ON
No motion x amount of time - turn the light off and make annoucement.

if the above is what you want, that should be easy.

waiting your answer before drafting something.


#6

Thanks both for looking at this.
The piston has 2 purposed,

  1. turn on light if it sees motion and light is off (nice for when coming into garage)
  2. if lights on and no activity, turn off the lights
    maybe there is a better way to write this : )

On the second question, if I understand it right…is there another piston that turns on the light… Nope.

I think I wll make a piston that speaks each time the light changes…


#7

A couple of explanations to make your piston simpler:

  • If the lights is OFF
    You don’t need this part because webcore will execute the piston regardless the lights is ON or OFF due to MOTION.
  • IF the light is ON
    you don’t need this condition either because if no motion your piston will be executed.

(There are some other aplications though, you will need those conditions. If the light is turned on manually then do this do that etc. But that is not your case)

This would be one of the the simplest way of doing this:

IF motions sensor 3 changes to ACTIVE
Then 
   With 
   Swith 4 TURN ON

_(Seperate IF block)_

IF motion sensor 3 STAYS INACTIVE for 10 minutes
Then
   With 
   Switch 4 do TURN OFF
   With
   Music player x,y,z
   Speak "Garage light turning OFF"

#8

I started to code it up but realized why I had it the way I had it…I do not want to announce I’m turning off the lights when they are off. I changed from an else to 2 separate if statements but kept in the check for whether the light WAS on. Thanks for looking at this. I keep learning from everyones advice !!


#9

Maybe I’m missing something in your setup.

1 - Do you - sometimes - turn the lights off by the wall switch manually while leaving the garage?
2 - Is this piston for “incase if I forgot to turn the lights off” ?


#10

Hi, answers below
1, yes
2. yes

FYI. the light switch for the garage is inside so you can’t see the light on when garage door is closed and you are inside.


#11

Ok that explains…
I believe a simple CANCEL PENDING TASKS will do the job…
I’ll be busy the next few hours but I’ll write you another draft this evening… (maybe 2 seperate pistons would be even better)


#12

Just had a couple of minutes
here is the draft

IF motion sensor 3 changes to ACTIVE
Then 
   With 
   Swith 4 TURN ON
   With
   set Variable garagelight = true

IF motion sensor 3 STAYS INACTIVE for 10 minutes
And
IF variable garagelight is = true
   With 
   Switch 4 do TURN OFF
   With
   Music player x,y,z
   Speak "Garage light turning OFF"
   with
   Set variable garagelight = false

Now for the manual turn off

IF switch 4 turns OFF
then
Set variable garagelight = false

#13

Thank you for taking the time to think through this… I have questions so I can understand this better : )

Below is the updated version I came up with…As I look at your design it appears that the difference is that you are tracking the state of the light switch in a variable vs in my case, I’m just depending on reading the state of the switch… why would the variable method be preferred ? Again trying to learn the finer points


#14

there are many different ways of writing the same piston and all have cons and pros.

looks like your last version works fine.
I’m just used to using variables for my house needs (if one room does that, the other room should do this etc) in this case, it’s nothing but a habit:))))


#15

If I may add my two cents…

Line 46 may not be reliable in piston qzuo0.

pic

The {light_on} variable may be set to either “on” or “off”…
(Depending on how quickly the last command and the update went thru)

This same thing was happening with your original post.

It’s not currently serving a purpose, but if you want that variable for some reason, I would likely just force the variable to what you want, without re-checking the current status of the switch. For example, line 46 can be: Set variable {light_on} = "off";


Here is a silly analogy:

If you ask your son to go buy a loaf of bread, and then a moment later, asked him what aisle he is on, there is a good chance that he has not moved yet, LOL


#16

thank you both for the input…and I see why line 46 could be problematic.
I would for SURE know the status of son after a few moments…& that is “No Motion detected” : )