Motion detection with different motion duration


#1

1) Give a description of the problem
I dont think my logic is right here
2) What is the expected behaviour?
Between sunset and 8PM
Motion detected: turn on light
If motion is active for less then 60s turn off the light
If motion is active for over a min, turn off light after 10 mins
3) What is happening/not happening?
Still waiting for sunset, please just let me know if it looks ok :slight_smile:
Thanks!

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

5) Attach logs after turning logging level to Full
(PASTE YOUR LOGS HERE THEN HIGHLIGHT ALL OF THE LOGS AND CLICK ON THE </> ICON TO FORMAT THEM CORRECTLY)


#4

In reference to your piston:

I am about to step away from my computer, but the quick answer:

Triggers (such as line 31 & 34), should be top level… Not buried inside another IF.
(remember, this is what kicks off the piston)

Also, without going into a giant explaination, I would encourage you to avoid using “ONLY WHEN” for now, and resort to indented IFs as conditions instead.

So basically, Triggers top level, with indented conditions,… Something like:

IF Kitchen's motion changes to active          <-- Trigger
Then
    IF Time is not between Sunrise and 8pm     <-- Condition
        Then Turn on Lights
    END IF
END IF

IF Kitchen's motion stays inactive for X mins  <-- Trigger
    Then Turn off Lights
END IF

Notice this is 2 top IFs as triggers, with a conditional IF inside the first one.


Pro Tip:

I also inverted your time so it no longer spans midnight


New Here, does this night light look ok
#5

Ok, so more like this?

I am confused by the time though, this is Sunset to 9pm, its a few hours?

But I should not span midnight, so how to 9PM to Sunrise?


#6

Your lightning bolt trigger is still indented inside another IF block…
(it should be far left… not-indented)

I would also do away with ELSE IF for at least 6 months or so… They are so rarely needed, and often complex something that should be simple.


#7

Sorry, I must have based that on the image you deleted…

In laymans terms, what time do you want it active?


#8

HAHA, yeah I have a couple that are exactly the same with dif lights at dif times, so got confused which one I was posting. Anyway…

Is this more what you mean? three sections


#9

Sorry I really do have to run… You changed the wording on all my suggestions…

  • 17 should be a trigger, not a condition
  • 24 should use STAY, also making it a trigger
  • 33 I have no idea
  • 36 should be combined with the STAY on line 24… Not sure if two STAYS will work in the same piston.

See my previous post for more details.


#10

Absolutely no issue, I just appreciate the help :slight_smile:

OK so I think this is more what you were saying.

So what I’m looking for here is:

  1. Motion turns light on
  2. If I walked in grabbed something and came out, the whole interaction taking less then 60 seconds. Just turn the light off.
  3. If i’m in the kitchen for over a min, then once motion stops wait 10 mins before turning off the light.

Let me know if this makes more sense and again, appreciate it.


#11

I understand your goals much better now. I need to ask you a strange question, but your answer might make the final code much easier to write, so my fingers are crossed.

Would you be willing to import and test the following piston?

pic

You can press:
pic

When importing it, please point it to the same Kitchen Motion Sensor…
(and afterwards, temporarily pause your other kitchen piston)

To properly test…

  • Make sure the kitchen is 100% clear for at least 2 minutes.
  • Clear the Log (to begin test)
  • Wave a hand in front of the kitchen sensor, and run away as fast as possible.
    (the goal here is to get out of sight ASAP)

Return to the piston and watch the log…

Once the log has settled down completely, please post the contents here.


A part two of that test (which is just as valuable, if you are willing), would be the same piston:

  • Make sure the kitchen is 100% clear for at least 2 minutes.
  • Clear the Log (save the results from your previous test first)
  • This time, walk in, grab something and come out… acting natural.

Return to the piston and watch the log…

Once the log has settled down completely, please post the contents here.


Part one of this test will tell us how long it takes for that particular sensor to time out.
(good to know, since each device is different)

Part two of that test gives me information that will help with better coding for you.


#12

Thanks so much for putting in all this effort, I really appreciate the help.

I’ve been playing with the logs and what I had was kinda working. But it always seemed to turn off to quick.

But anyway, here are the logs for the quick hand pass. I’m not sure how to do code snippets here so just let me know how to fix up the formatting if its not great.


15/10/2020, 20:48:21 +104ms
+2ms	â•”Received event [Kitchen Motion].motion = inactive with a delay of 56ms
+37ms	â•‘RunTime Analysis CS > 19ms > PS > 5ms > PE > 13ms > CE
+39ms	â•‘Runtime (37287 bytes) successfully initialized in 5ms (v0.3.110.20191009) (37ms)
+40ms	â•‘â•”Execution stage started
+47ms	â•‘â•‘Comparison (enum) inactive changes_to (string) active = false (1ms)
+48ms	â•‘â•‘Cancelling condition #2's schedules...
+49ms	â•‘â•‘Condition #2 evaluated false (5ms)
+50ms	â•‘â•‘Cancelling condition #1's schedules...
+51ms	â•‘â•‘Condition group #1 evaluated false (state changed) (7ms)
+53ms	â•‘â•‘Cancelling statement #3's schedules...
+61ms	â•‘â•‘Calculating (string) 48 + (string) : >> (string) 48:
+64ms	â•‘â•‘Calculating (string) 48: + (string) 21 >> (string) 48:21
+67ms	â•‘â•‘Calculating (string) 48:21 + (string) = INACTIVE >> (string) 48:21 = INACTIVE
+70ms	â•‘â•‘48:21 = INACTIVE
+71ms	â•‘â•‘Executed virtual command log (1ms)
+73ms	â•‘â•šExecution stage complete. (33ms)
+74ms	â•šEvent processed successfully (74ms)
15/10/2020, 20:47:19 +513ms
+1ms	â•”Received event [Kitchen Motion].motion = active with a delay of 104ms
+29ms	â•‘RunTime Analysis CS > 13ms > PS > 4ms > PE > 11ms > CE
+31ms	â•‘Runtime (37267 bytes) successfully initialized in 4ms (v0.3.110.20191009) (30ms)
+32ms	â•‘â•”Execution stage started
+39ms	â•‘â•‘Comparison (enum) active changes_to (string) active = true (1ms)
+40ms	â•‘â•‘Cancelling condition #2's schedules...
+41ms	â•‘â•‘Condition #2 evaluated true (5ms)
+42ms	â•‘â•‘Cancelling condition #1's schedules...
+43ms	â•‘â•‘Condition group #1 evaluated true (state changed) (8ms)
+45ms	â•‘â•‘Cancelling statement #5's schedules...
+54ms	â•‘â•‘Calculating (string) 47 + (string) : >> (string) 47:
+57ms	â•‘â•‘Calculating (string) 47: + (string) 19 >> (string) 47:19
+59ms	â•‘â•‘Calculating (string) 47:19 + (string) = ACTIVE >> (string) 47:19 = ACTIVE
+63ms	â•‘â•‘47:19 = ACTIVE
+64ms	â•‘â•‘Executed virtual command log (1ms)
+66ms	â•‘â•šExecution stage complete. (35ms)
+67ms	â•šEvent processed successfully (67ms)

And here is the standing in the kitchen for about 1 min

15/10/2020, 20:54:53 +864ms
+1ms â•”Received event [Kitchen Motion].motion = inactive with a delay of 46ms
+26ms â•‘RunTime Analysis CS &gt; 14ms &gt; PS &gt; 4ms &gt; PE &gt; 8ms &gt; CE
+28ms â•‘Runtime (37286 bytes) successfully initialized in 4ms (v0.3.110.20191009) (27ms)
+29ms â•‘â•”Execution stage started
+36ms â•‘â•‘Comparison (enum) inactive changes_to (string) active = false (0ms)
+38ms â•‘â•‘Cancelling condition #2's schedules...
+38ms â•‘â•‘Condition #2 evaluated false (5ms)
+39ms â•‘â•‘Cancelling condition #1's schedules...
+40ms â•‘â•‘Condition group #1 evaluated false (state changed) (7ms)
+42ms â•‘â•‘Cancelling statement #3's schedules...
+50ms â•‘â•‘Calculating (string) 54 + (string) : &gt;&gt; (string) 54:
+53ms â•‘â•‘Calculating (string) 54: + (string) 53 &gt;&gt; (string) 54:53
+56ms â•‘â•‘Calculating (string) 54:53 + (string) = INACTIVE &gt;&gt; (string) 54:53 = INACTIVE
+59ms â•‘â•‘54:53 = INACTIVE
+60ms â•‘â•‘Executed virtual command log (2ms)
+62ms â•‘â•šExecution stage complete. (33ms)
+63ms â•šEvent processed successfully (63ms)
15/10/2020, 20:53:53 +319ms
+1ms â•”Received event [Kitchen Motion].motion = active with a delay of 88ms
+25ms â•‘RunTime Analysis CS &gt; 13ms &gt; PS &gt; 4ms &gt; PE &gt; 8ms &gt; CE
+27ms â•‘Runtime (37291 bytes) successfully initialized in 4ms (v0.3.110.20191009) (25ms)
+28ms â•‘â•”Execution stage started
+35ms â•‘â•‘Comparison (enum) active changes_to (string) active = true (0ms)
+36ms â•‘â•‘Cancelling condition #2's schedules...
+37ms â•‘â•‘Condition #2 evaluated true (5ms)
+38ms â•‘â•‘Cancelling condition #1's schedules...
+39ms â•‘â•‘Condition group #1 evaluated true (state changed) (6ms)
+41ms â•‘â•‘Cancelling statement #5's schedules...
+48ms â•‘â•‘Calculating (string) 53 + (string) : &gt;&gt; (string) 53:
+51ms â•‘â•‘Calculating (string) 53: + (string) 53 &gt;&gt; (string) 53:53
+54ms â•‘â•‘Calculating (string) 53:53 + (string) = ACTIVE &gt;&gt; (string) 53:53 = ACTIVE
+57ms â•‘â•‘53:53 = ACTIVE
+58ms â•‘â•‘Executed virtual command log (2ms)
+60ms â•‘â•šExecution stage complete. (32ms)
+61ms â•šEvent processed successfully (61ms)

#13

Yay! This is the best possible results for your goals!!

On the “Kitchen Motion” sensor, it times out (shifts to inactive) exactly one minute after the room has been cleared. This will reduce your triple trigger into two. :grin:


Beautiful! The exact same 1 minute delay!
(although notice it is 1 min after you enter the room, not leave)


Taking all of this into account, give me a few minutes, and I will whip you up a fresh new piston.
(I need coffee first though, LOL)


#14

The following piston has not been tested, but I believe it should work in all your scenarios.

One small caveat though… The sensor (and your SmartHome) has no clue whether you are in the kitchen for 1 sec or 59 sec. Both scenarios will turn “inactive” at about 60 seconds.

Here is what I did to work with this info:
When the 60 seconds has passed, if the kitchen is empty at that moment, it starts a 15 sec timer. After those 15 sec, if the kitchen is still empty, the lights will go out. (So your original goal of “off in 60 sec” is now “off in 75 sec”)

If, on the other hand, there is activity in the kitchen at the 75 sec mark, then the lights stay on.

… until the safety net… 10 minutes after the Kitchen has cleared, the lights turn off regardless.

Here you go… ready for testing:

Note: I added a few log commands to help you follow along in the log during troubleshooting.
(although if you have issues, we’d probably want to see the Full log)

Also, please pause your other piston when testing this one.
(we only want one piston to execute when that motion sensor changes)


To say this another way:

IF there is activity somewhere between 60-75 sec after you enter the room,
then the light stays on for at least 11 minutes

IF there is no activity between 60-75 sec after you enter the room,
then the lights turn off at the 75 sec mark.

IE: The only time this logic will fail is if you leave the kitchen before 59 sec, and return after 76 sec. Well, it won’t really fail. but the light will turn off at 75sec, and turn back on when you enter the room (to begin again at the top).


#15

Wow, that’s so elegant!

So basically when activated the sensor activates SmartThings for one minute, it’s the hardware itself?

The script will keep checking to see if the sensor is active with the “else condition” and once it becomes inactive, it sets a fifteen second timer.

Once the timer is complete, it checks it again and if the sensor is unactivated, it will turn off the light, if its activated, it then sets a new IF statement to turn off the light after ten minutes from that moment.

So beautifully simple, I’ve heard people say the word elegant in the context of programming, but this is the first time I knew enough about a thing (automation) to actually understand what they meant.

Thank you


#16

Close. It is likely a “battery saving” technique… Once an active is recognized, it sends a single update to the hub, then the device likely “powers down” for 60 seconds… (to conserve juice) When it wakes up, it looks for action. If there is none, it sends an “inactive” to the hub.


This one is not quite right either. Basically, webCoRE is “event driven”. (it never sits around waiting for something to happen) When an event happens, and the hub becomes aware, it executes all pistons that are subscribed to that particular device’s attributes. (IE: Basically, only the lightning bolts initiate a piston) Once it is running, it goes thru the code, top to bottom, and executes anything not blocked by conditions.

The ELSE block (usually avoided for newbies) only happens when when that specific trigger or condition fails. So, for example, the ELSE on line 29 only happens when Sensor changes to active at the wrong times. The ELSE on line 32 will execute every single time the sensor goes inactive. The 15 sec WAIT gives you time to be seen by the sensor… If it still does not see you, the piston continues going down thru all the code. (IE: lights off). If it does see you after the 15 sec, then it starts over at the top, and the lights stay on.


Glad to be able to help. I do this for a living, but honestly, the most time consuming thing for me (as a programmer) is getting all the information, for every possible scenario, and fully understanding the goals of my client. I have easily written over 50k pistons over the years, so once I have all the info, I can usually work my magic. :grin:


#17

Ok thats makes sense. Is this a manufacturer setting or SmartThings setting? I have three brands of sensor (always looking for the cheapest lol) so should I run the sensor test for each, or they are always one minute? What I’m really asking, Is this SmartThings polling, or hardware, if you know what I mean?

OK, i’m going to go backwards here for importance:

Line 42 has a lightning bolt. That means that whenever the Hubs polling reports back that the sensor has been inactive for ten minutes, it turns off the lights? So effectively, its turning off the lights every 10 mins forever? If right, I got that part and why.

Line 13 (other lighting bolt) So same thing starting at line 29, but running at every poll of the device (which returns either inactive, or wrong time?) It turns off the light?

All right, I’m now going to apply this to my other lights, including the night light, so ill close off that post when Im done.

Lastly, is this your product? it doesn’t seem to say anywhere but 50k pistons, sounds like it must be LOL

And thanks again :slight_smile:


#18

It is a manufacturer setting (hardware) or a Device Handler setting (software).
(SmartThings is not polling… the device is reporting to SmartThings)

Personally, I test every model number, because next years version will likely be different, LOL


In the future, when referring to line numbers, please use the numbers in the posted image. (since that is the only thing that we can both see)

In this case, the triggers are on line 18 & 47.

OK, on to your question:

No, this is very incorrect. Let me break it down. Let’s assume we have a piston with only ONE trigger:

IF DeviceA's motion changes to active

This trigger will run thru the code, top to bottom, when DeviceA’s motion changes to active OR inactive. Basically, we are “subscribing” to “DeviceA’s motion”… and anytime it changes, (at all), this piston will run thru the entire code.


Let me expand on this a bit. Lets say we have another piston, with only ONE trigger:

IF Location mode changes to Home

The same concept applies here. It will run top to bottom at any change to the Location mode. IE:

IE: Home, Work, Day, Night, Away, Vacation etc

All of these events will run thru the entire code, top to bottom, and executes anything not blocked by conditions.


The STAY command on line 47 is a tricky little bugger… Remember we just demonstrated how the piston only executes when Sensor’s motion changes to anything at all? Well, it starts at the top (as always), but if it changed to inactive, then, when it gets to line 47, it sets a 10 minute wakeup timer. Here is the kicker… IF nothing happens during that 10 minutes, the piston continues, and the light turn off.

On the other hand, if something triggers the piston again (motion changing to active), then the piston starts all over at the top, the timer is usually aborted, and the light turns on (or stays on).


#19

I would be cautious… The STAY command works great, but only in specific situations.


I cannot take credit for writing webCoRE… @ady624 is the genius behind webCoRE.
(he now works for SmartThings)

I am just a tech-geek, who has been installing and programming SmartHomes since 2001… Thru many different ecosystems… The latest of which is SmartThings and webCoRE.
(with the whole pandemic, lately my installs are rare, so my focus has mostly been on the coding aspect)

For reference:
My main house has over 500 pistons, which is less than 1% of what I have created for others.


#20

How long does it take before I can just post normally LOL, Its not my first day anymore!

No worries :slight_smile:

Ok, so the thing i’m missing here, top to bottom. I think I had the wrong ideas about what lightning bolts are. But it just means, here are the events or triggers that will do a thing. Here are the subscriptions, more than independent initiators?

LOL, its fine, I haven’t deleted the SmartThings Automations, they are just off and… Lets be honest, better then my piston attempts HAHA (Im new after all). Its not work, no CAB to worry about HAHA

Wow, 500, once im done here, i’m going to start checking out some ideas. I want some better ideas for the bathroom, similar to what we are doing here, but maybe with more wiggle room for duration. Not sure, see how it goes. There must be something better then, sensor turns on light, no motion for 10 mins turn off light LOL

Testing over the last couple of nights, its not working to extend the lights timeout when it checks the sensor again.

This is a Piston where I’ve changed the lights and added a lux sensor as part of the trigger.

The logs are pretty confusing, how can you tell which condition it’s talking about?

I’m guessing its #17, but how do I match them up?

|+1059ms|â•‘â•‘Comparison (enum) active stays (string) inactive = false (1ms)|
|---|---|
|+1061ms|â•‘â•‘Cancelling any timed trigger schedules for condition 17|
|+1062ms|â•‘â•‘Cancelling statement #17's schedules...|
|+1063ms|â•‘â•‘Condition #17 evaluated false (8ms)|
|+1064ms|â•‘â•‘Condition group #16 evaluated false (state did not change) (9ms)|

All the logs from spending about 4-5 mins in the kitchen.

18/10/2020, 11:34:32 +800ms
+2ms	â•”Received event [Kitchen Motion].motion = active with a delay of 133ms
+81ms	â•‘RunTime Analysis CS > 22ms > PS > 5ms > PE > 53ms > CE
+83ms	â•‘Runtime (42154 bytes) successfully initialized in 5ms (v0.3.110.20191009) (80ms)
+84ms	â•‘â•”Execution stage started
+91ms	â•‘â•‘Comparison (enum) active changes_to (string) active = true (1ms)
+92ms	â•‘â•‘Cancelling condition #2's schedules...
+93ms	â•‘â•‘Condition #2 evaluated true (5ms)
+94ms	â•‘â•‘Cancelling condition #1's schedules...
+95ms	â•‘â•‘Condition group #1 evaluated true (state changed) (7ms)
+136ms	â•‘â•‘Comparison (time) 41672897 is_between (time) 1602961800000 .. (time) 1603008660000 = true (9ms)
+137ms	â•‘â•‘Time restriction check passed
+138ms	â•‘â•‘Condition #13 evaluated true (41ms)
+148ms	â•‘â•‘Comparison (integer) 166 is_less_than_or_equal_to (integer) 200 = true (2ms)
+149ms	â•‘â•‘Condition #24 evaluated true (10ms)
+150ms	â•‘â•‘Condition group #12 evaluated true (state did not change) (53ms)
+152ms	â•‘â•‘Cancelling statement #14's schedules...
+1104ms	â•‘â•‘Executed physical command [null].on() (946ms)
+1105ms	â•‘â•‘Executed [Kitchen Strip 1 ST].on (948ms)
+1113ms	â•‘â•‘Calculating (string) 34 + (string) : >> (string) 34:
+1116ms	â•‘â•‘Calculating (string) 34: + (string) 33 >> (string) 34:33
+1119ms	â•‘â•‘Calculating (string) 34:33 + (string) = ACTIVE (ON) >> (string) 34:33 = ACTIVE (ON)
+1123ms	â•‘â•‘34:33 = ACTIVE (ON)
+1124ms	â•‘â•‘Executed virtual command [Kitchen Strip 1 ST].log (1ms)
+1131ms	â•‘â•‘Comparison (enum) active stays (string) inactive = false (1ms)
+1133ms	â•‘â•‘Cancelling any timed trigger schedules for condition 17
+1134ms	â•‘â•‘Cancelling statement #17's schedules...
+1135ms	â•‘â•‘Condition #17 evaluated false (8ms)
+1136ms	â•‘â•‘Condition group #16 evaluated false (state did not change) (9ms)
+1138ms	â•‘â•šExecution stage complete. (1054ms)
+1139ms	â•šEvent processed successfully (1139ms)
18/10/2020, 11:34:28 +122ms
+0ms	â•”Received event [Home].time = 1602981269207 with a delay of -1085ms
+80ms	â•‘RunTime Analysis CS > 33ms > PS > 5ms > PE > 42ms > CE
+83ms	â•‘Runtime (42151 bytes) successfully initialized in 5ms (v0.3.110.20191009) (81ms)
+83ms	â•‘â•”Execution stage started
+107ms	â•‘â•‘Comparison (enum) inactive is (string) inactive = true (1ms)
+108ms	â•‘â•‘Condition #9 evaluated true (8ms)
+110ms	â•‘â•‘Condition group #8 evaluated true (state did not change) (10ms)
+112ms	â•‘â•‘Cancelling statement #10's schedules...
+1373ms	â•‘â•‘Executed physical command [null].off() (1257ms)
+1374ms	â•‘â•‘Executed [Kitchen Strip 1 ST].off (1259ms)
+1383ms	â•‘â•‘Calculating (string) 34 + (string) : >> (string) 34:
+1386ms	â•‘â•‘Calculating (string) 34: + (string) 29 >> (string) 34:29
+1388ms	â•‘â•‘Calculating (string) 34:29 + (string) = INACTIVE at 75 sec >> (string) 34:29 = INACTIVE at 75 sec
+1392ms	â•‘â•‘34:29 = INACTIVE at 75 sec
+1393ms	â•‘â•‘Executed virtual command [Kitchen Strip 1 ST].log (2ms)
+1404ms	â•‘â•‘Comparison (enum) inactive stays (string) inactive = true (2ms)
+1406ms	â•‘â•‘Adding a timed trigger schedule for condition 17
+1408ms	â•‘â•‘Condition #17 evaluated false (12ms)
+1409ms	â•‘â•‘Condition group #16 evaluated false (state did not change) (12ms)
+1411ms	â•‘â•šExecution stage complete. (1327ms)
+1412ms	â•‘Setting up scheduled job for Sun, Oct 18 2020 @ 11:44:29 AM AEDT (in 599.995s)
+1419ms	â•šEvent processed successfully (1419ms)
18/10/2020, 11:34:14 +106ms
+2ms	â•”Received event [Kitchen Motion].motion = inactive with a delay of 58ms
+62ms	â•‘RunTime Analysis CS > 17ms > PS > 4ms > PE > 41ms > CE
+65ms	â•‘Runtime (42151 bytes) successfully initialized in 4ms (v0.3.110.20191009) (62ms)
+65ms	â•‘â•”Execution stage started
+72ms	â•‘â•‘Comparison (enum) inactive changes_to (string) active = false (0ms)
+74ms	â•‘â•‘Cancelling condition #2's schedules...
+75ms	â•‘â•‘Condition #2 evaluated false (6ms)
+76ms	â•‘â•‘Cancelling condition #1's schedules...
+77ms	â•‘â•‘Condition group #1 evaluated false (state changed) (7ms)
+79ms	â•‘â•‘Cancelling statement #3's schedules...
+87ms	â•‘â•‘Calculating (string) 34 + (string) : >> (string) 34:
+89ms	â•‘â•‘Calculating (string) 34: + (string) 14 >> (string) 34:14
+92ms	â•‘â•‘Calculating (string) 34:14 + (string) = INACTIVE at 60 sec >> (string) 34:14 = INACTIVE at 60 sec
+95ms	â•‘â•‘34:14 = INACTIVE at 60 sec
+96ms	â•‘â•‘Executed virtual command log (1ms)
+99ms	â•‘â•‘Executed virtual command wait (1ms)
+100ms	â•‘â•‘Requesting a wake up for Sun, Oct 18 2020 @ 11:34:29 AM AEDT (in 15.0s)
+104ms	â•‘â•šExecution stage complete. (39ms)
+105ms	â•‘Setting up scheduled job for Sun, Oct 18 2020 @ 11:34:29 AM AEDT (in 14.996s)
+120ms	â•šEvent processed successfully (119ms)
18/10/2020, 11:33:25 +137ms
+0ms	â•”Received event [Home].time = 1602981206248 with a delay of -1112ms
+84ms	â•‘RunTime Analysis CS > 27ms > PS > 7ms > PE > 51ms > CE
+88ms	â•‘Runtime (42147 bytes) successfully initialized in 7ms (v0.3.110.20191009) (87ms)
+90ms	â•‘â•”Execution stage started
+92ms	â•‘â•šExecution stage complete. (2ms)
+93ms	â•šEvent processed successfully (93ms)
18/10/2020, 11:33:14 +263ms
+1ms	â•”Received event [Kitchen Motion].motion = active with a delay of 113ms
+54ms	â•‘RunTime Analysis CS > 13ms > PS > 4ms > PE > 37ms > CE
+57ms	â•‘Runtime (42154 bytes) successfully initialized in 4ms (v0.3.110.20191009) (55ms)
+57ms	â•‘â•”Execution stage started
+64ms	â•‘â•‘Comparison (enum) active changes_to (string) active = true (0ms)
+66ms	â•‘â•‘Cancelling condition #2's schedules...
+66ms	â•‘â•‘Condition #2 evaluated true (5ms)
+67ms	â•‘â•‘Cancelling condition #1's schedules...
+68ms	â•‘â•‘Condition group #1 evaluated true (state changed) (7ms)
+103ms	â•‘â•‘Comparison (time) 41594334 is_between (time) 1602961800000 .. (time) 1603008660000 = true (9ms)
+104ms	â•‘â•‘Time restriction check passed
+105ms	â•‘â•‘Condition #13 evaluated true (35ms)
+113ms	â•‘â•‘Comparison (integer) 158 is_less_than_or_equal_to (integer) 200 = true (1ms)
+115ms	â•‘â•‘Condition #24 evaluated true (9ms)
+116ms	â•‘â•‘Condition group #12 evaluated true (state did not change) (45ms)
+118ms	â•‘â•‘Cancelling statement #14's schedules...
+125ms	â•‘â•‘Skipped execution of physical command [null].on([]) because it would make no change to the device. (4ms)
+126ms	â•‘â•‘Executed [Kitchen Strip 1 ST].on (6ms)
+135ms	â•‘â•‘Calculating (string) 33 + (string) : >> (string) 33:
+138ms	â•‘â•‘Calculating (string) 33: + (string) 14 >> (string) 33:14
+141ms	â•‘â•‘Calculating (string) 33:14 + (string) = ACTIVE (ON) >> (string) 33:14 = ACTIVE (ON)
+144ms	â•‘â•‘33:14 = ACTIVE (ON)
+145ms	â•‘â•‘Executed virtual command [Kitchen Strip 1 ST].log (1ms)
+153ms	â•‘â•‘Comparison (enum) active stays (string) inactive = false (2ms)
+155ms	â•‘â•‘Cancelling any timed trigger schedules for condition 17
+155ms	â•‘â•‘Cancelling statement #17's schedules...
+156ms	â•‘â•‘Condition #17 evaluated false (8ms)
+157ms	â•‘â•‘Condition group #16 evaluated false (state did not change) (9ms)
+159ms	â•‘â•šExecution stage complete. (102ms)
+160ms	â•šEvent processed successfully (160ms)
18/10/2020, 11:33:11 +138ms
+2ms	â•”Received event [Kitchen Motion].motion = inactive with a delay of 61ms
+71ms	â•‘RunTime Analysis CS > 20ms > PS > 8ms > PE > 43ms > CE
+73ms	â•‘Runtime (42151 bytes) successfully initialized in 8ms (v0.3.110.20191009) (71ms)
+74ms	â•‘â•”Execution stage started
+81ms	â•‘â•‘Comparison (enum) inactive changes_to (string) active = false (0ms)
+83ms	â•‘â•‘Cancelling condition #2's schedules...
+84ms	â•‘â•‘Condition #2 evaluated false (5ms)
+85ms	â•‘â•‘Cancelling condition #1's schedules...
+85ms	â•‘â•‘Condition group #1 evaluated false (state changed) (7ms)
+87ms	â•‘â•‘Cancelling statement #3's schedules...
+95ms	â•‘â•‘Calculating (string) 33 + (string) : >> (string) 33:
+98ms	â•‘â•‘Calculating (string) 33: + (string) 11 >> (string) 33:11
+101ms	â•‘â•‘Calculating (string) 33:11 + (string) = INACTIVE at 60 sec >> (string) 33:11 = INACTIVE at 60 sec
+104ms	â•‘â•‘33:11 = INACTIVE at 60 sec
+105ms	â•‘â•‘Executed virtual command log (1ms)
+108ms	â•‘â•‘Executed virtual command wait (1ms)
+109ms	â•‘â•‘Requesting a wake up for Sun, Oct 18 2020 @ 11:33:26 AM AEDT (in 15.0s)
+113ms	â•‘â•šExecution stage complete. (39ms)
+114ms	â•‘Setting up scheduled job for Sun, Oct 18 2020 @ 11:33:26 AM AEDT (in 14.997s)
+124ms	â•šEvent processed successfully (124ms)
18/10/2020, 11:32:19 +158ms
+1ms	â•”Received event [Home].time = 1602981139995 with a delay of -837ms
+74ms	â•‘RunTime Analysis CS > 24ms > PS > 5ms > PE > 45ms > CE
+77ms	â•‘Runtime (42146 bytes) successfully initialized in 5ms (v0.3.110.20191009) (75ms)
+78ms	â•‘â•”Execution stage started
+79ms	â•‘â•šExecution stage complete. (2ms)
+80ms	â•šEvent processed successfully (80ms)
18/10/2020, 11:32:11 +747ms
+2ms	â•”Received event [Kitchen Motion].motion = active with a delay of 169ms
+69ms	â•‘RunTime Analysis CS > 20ms > PS > 9ms > PE > 40ms > CE
+72ms	â•‘Runtime (42154 bytes) successfully initialized in 9ms (v0.3.110.20191009) (69ms)
+73ms	â•‘â•”Execution stage started
+80ms	â•‘â•‘Comparison (enum) active changes_to (string) active = true (1ms)
+82ms	â•‘â•‘Cancelling condition #2's schedules...
+82ms	â•‘â•‘Condition #2 evaluated true (5ms)
+83ms	â•‘â•‘Cancelling condition #1's schedules...
+84ms	â•‘â•‘Condition group #1 evaluated true (state changed) (7ms)
+121ms	â•‘â•‘Comparison (time) 41531834 is_between (time) 1602961800000 .. (time) 1603008660000 = true (9ms)
+123ms	â•‘â•‘Time restriction check passed
+124ms	â•‘â•‘Condition #13 evaluated true (38ms)
+135ms	â•‘â•‘Comparison (integer) 157 is_less_than_or_equal_to (integer) 200 = true (1ms)
+136ms	â•‘â•‘Condition #24 evaluated true (11ms)
+138ms	â•‘â•‘Condition group #12 evaluated true (state did not change) (51ms)
+140ms	â•‘â•‘Cancelling statement #14's schedules...
+150ms	â•‘â•‘Skipped execution of physical command [null].on([]) because it would make no change to the device. (6ms)
+151ms	â•‘â•‘Executed [Kitchen Strip 1 ST].on (8ms)
+159ms	â•‘â•‘Calculating (string) 32 + (string) : >> (string) 32:
+162ms	â•‘â•‘Calculating (string) 32: + (string) 11 >> (string) 32:11
+165ms	â•‘â•‘Calculating (string) 32:11 + (string) = ACTIVE (ON) >> (string) 32:11 = ACTIVE (ON)
+168ms	â•‘â•‘32:11 = ACTIVE (ON)
+169ms	â•‘â•‘Executed virtual command [Kitchen Strip 1 ST].log (1ms)
+176ms	â•‘â•‘Comparison (enum) active stays (string) inactive = false (1ms)
+178ms	â•‘â•‘Cancelling any timed trigger schedules for condition 17
+179ms	â•‘â•‘Cancelling statement #17's schedules...
+180ms	â•‘â•‘Condition #17 evaluated false (8ms)
+181ms	â•‘â•‘Condition group #16 evaluated false (state did not change) (9ms)
+183ms	â•‘â•šExecution stage complete. (111ms)
+184ms	â•šEvent processed successfully (184ms)
18/10/2020, 11:32:04 +896ms
+1ms	â•”Received event [Kitchen Motion].motion = inactive with a delay of 52ms
+59ms	â•‘RunTime Analysis CS > 16ms > PS > 5ms > PE > 39ms > CE
+61ms	â•‘Runtime (42151 bytes) successfully initialized in 5ms (v0.3.110.20191009) (59ms)
+62ms	â•‘â•”Execution stage started
+69ms	â•‘â•‘Comparison (enum) inactive changes_to (string) active = false (0ms)
+71ms	â•‘â•‘Cancelling condition #2's schedules...
+72ms	â•‘â•‘Condition #2 evaluated false (5ms)
+73ms	â•‘â•‘Cancelling condition #1's schedules...
+73ms	â•‘â•‘Condition group #1 evaluated false (state changed) (7ms)
+76ms	â•‘â•‘Cancelling statement #3's schedules...
+84ms	â•‘â•‘Calculating (string) 32 + (string) : >> (string) 32:
+87ms	â•‘â•‘Calculating (string) 32: + (string) 4 >> (string) 32:4
+90ms	â•‘â•‘Calculating (string) 32:4 + (string) = INACTIVE at 60 sec >> (string) 32:4 = INACTIVE at 60 sec
+93ms	â•‘â•‘32:4 = INACTIVE at 60 sec
+94ms	â•‘â•‘Executed virtual command log (2ms)
+97ms	â•‘â•‘Executed virtual command wait (1ms)
+98ms	â•‘â•‘Requesting a wake up for Sun, Oct 18 2020 @ 11:32:19 AM AEDT (in 15.0s)
+102ms	â•‘â•šExecution stage complete. (40ms)
+103ms	â•‘Setting up scheduled job for Sun, Oct 18 2020 @ 11:32:19 AM AEDT (in 14.996s)
+161ms	â•šEvent processed successfully (162ms)
18/10/2020, 11:31:04 +176ms
+1ms	â•”Received event [Kitchen Motion].motion = active with a delay of 281ms
+48ms	â•‘RunTime Analysis CS > 13ms > PS > 4ms > PE > 31ms > CE
+51ms	â•‘Runtime (42154 bytes) successfully initialized in 4ms (v0.3.110.20191009) (48ms)
+51ms	â•‘â•”Execution stage started
+58ms	â•‘â•‘Comparison (enum) active changes_to (string) active = true (1ms)
+59ms	â•‘â•‘Cancelling condition #2's schedules...
+60ms	â•‘â•‘Condition #2 evaluated true (5ms)
+61ms	â•‘â•‘Cancelling condition #1's schedules...
+62ms	â•‘â•‘Condition group #1 evaluated true (state changed) (6ms)
+95ms	â•‘â•‘Comparison (time) 41464240 is_between (time) 1602961800000 .. (time) 1603008660000 = true (8ms)
+97ms	â•‘â•‘Time restriction check passed
+98ms	â•‘â•‘Condition #13 evaluated true (34ms)
+105ms	â•‘â•‘Comparison (integer) 159 is_less_than_or_equal_to (integer) 200 = true (1ms)
+107ms	â•‘â•‘Condition #24 evaluated true (7ms)
+107ms	â•‘â•‘Condition group #12 evaluated true (state did not change) (44ms)
+109ms	â•‘â•‘Cancelling statement #14's schedules...
+1033ms	â•‘â•‘Executed physical command [null].on() (919ms)
+1034ms	â•‘â•‘Executed [Kitchen Strip 1 ST].on (921ms)
+1042ms	â•‘â•‘Calculating (string) 31 + (string) : >> (string) 31:
+1045ms	â•‘â•‘Calculating (string) 31: + (string) 5 >> (string) 31:5
+1048ms	â•‘â•‘Calculating (string) 31:5 + (string) = ACTIVE (ON) >> (string) 31:5 = ACTIVE (ON)
+1051ms	â•‘â•‘31:5 = ACTIVE (ON)
+1052ms	â•‘â•‘Executed virtual command [Kitchen Strip 1 ST].log (1ms)
+1059ms	â•‘â•‘Comparison (enum) active stays (string) inactive = false (1ms)
+1061ms	â•‘â•‘Cancelling any timed trigger schedules for condition 17
+1062ms	â•‘â•‘Cancelling statement #17's schedules...
+1063ms	â•‘â•‘Condition #17 evaluated false (8ms)
+1064ms	â•‘â•‘Condition group #16 evaluated false (state did not change) (9ms)
+1066ms	â•‘â•šExecution stage complete. (1015ms)
+1067ms	â•šEvent processed successfully (1067ms)

#21

Just looking at your Log and Trace tips and I can see the trace, Its having issues with the “stay” ?

Ill keep digging :slight_smile:


#22

Your log looks solid to me…

  • 11:31:04 = Active = Lights on
  • 11:32:04 = Inactive = Set wakeup for 15 sec
  • 11:32:11 = Active = Lights remain on
  • 11:32:19 = Timer = 15 sec wakeup here, but nothing happens
  • 11:33:11 = Inactive = Set wakeup for 15 sec
  • 11:33:14 = Active = Lights remain on
  • 11:33:25 = Timer = 15 sec wakeup here, but nothing happens
  • 11:34:14 = Inactive = Set wakeup for 15 sec
  • 11:34:28 = Timer = 15 sec wakeup, Lights turn OFF, Set wakeup for 10 min
  • 11:34:32 = Active = Lights on