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