Motion detection with different motion duration


#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 > 14ms > PS > 4ms > PE > 8ms > 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) : >> (string) 54:
+53ms ║║Calculating (string) 54: + (string) 53 >> (string) 54:53
+56ms ║║Calculating (string) 54:53 + (string) = INACTIVE >> (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 > 13ms > PS > 4ms > PE > 8ms > 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) : >> (string) 53:
+51ms ║║Calculating (string) 53: + (string) 53 >> (string) 53:53
+54ms ║║Calculating (string) 53:53 + (string) = ACTIVE >> (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

#23

Sorry, This might be better

It just seems to never trigger the 10mins stay on. But the light will stay on as long as its detecting motion. So I just stay in the kitching moving around the lights stay on. But as soon as I leave, to check the logs, off it goes.


18/10/2020, 13:39:06 +286ms
+77ms	║39:6 = INACTIVE at 60 sec
18/10/2020, 13:38:07 +44ms
+386ms	║38:7 = ACTIVE (ON)
18/10/2020, 13:37:57 +35ms
+1472ms	║37:58 = INACTIVE at 75 sec
18/10/2020, 13:37:38 +115ms
+175ms	║37:38 = INACTIVE at 60 sec
18/10/2020, 13:36:38 +582ms
+1739ms	║36:40 = ACTIVE (ON)

ST Logs for the Motion Sensor

b3d64edc-069e-4175-a321-5875021b069d 13:39:06: debug Kitchen Motion reset to no motion after 60 seconds
b3d64edc-069e-4175-a321-5875021b069d 13:38:07: debug Kitchen Motion Parse returned: [name:motion, value:active, descriptionText:Kitchen Motion detected motion]
b3d64edc-069e-4175-a321-5875021b069d 13:38:06: debug Kitchen Motion detected motion
b3d64edc-069e-4175-a321-5875021b069d 13:38:06: debug Kitchen Motion Parsing: read attr - raw: 7EC30104060800001801, dni: 7EC3, endpoint: 01, cluster: 0406, size: 8, attrId: 0000, result: success, encoding: 18, value: 01
b3d64edc-069e-4175-a321-5875021b069d 13:38:06: debug Kitchen Motion Parsing: read attr - raw: 7EC30104060800001801, dni: 7EC3, endpoint: 01, cluster: 0406, size: 8, attrId: 0000, result: success, encoding: 18, value: 01
b3d64edc-069e-4175-a321-5875021b069d 13:36:38: debug Kitchen Motion Parse returned: [name:motion, value:active, descriptionText:Kitchen Motion detected motion]
b3d64edc-069e-4175-a321-5875021b069d 13:36:38: debug Kitchen Motion detected motion
b3d64edc-069e-4175-a321-5875021b069d 13:36:38: debug Kitchen Motion Parsing: read attr - raw: 7EC30104060800001801, dni: 7EC3, endpoint: 01, cluster: 0406, size: 8, attrId: 0000, result: success, encoding: 18, value: 01

#24

You will need to capture at least 13 minutes worth of logs…
(or 12 minutes after the room has cleared)


Note to self:

This piston likely requires variables.
(I forgot to “disable” the sensor at the 75 sec mark)

I am a bit tied up at the moment, so it may take me 12 hours or so to be able to add this to your piston.


#25

Oh yeah, no worries, take your time. :slight_smile:

Anyway, here are the 14m of logs , kitchen needed a tidy up anyway HAHA

18/10/2020, 14:02:34 +287ms
+1799ms	║2:36 = INACTIVE at 75 sec
18/10/2020, 14:02:15 +857ms
+88ms	║2:15 = INACTIVE at 60 sec
18/10/2020, 14:01:15 +615ms
+120ms	║1:15 = ACTIVE (ON)
18/10/2020, 14:01:10 +901ms
+73ms	║1:10 = INACTIVE at 60 sec
18/10/2020, 14:00:03 +872ms
+143ms	║0:4 = ACTIVE (ON)
18/10/2020, 13:59:57 +97ms
+88ms	║59:57 = INACTIVE at 60 sec
18/10/2020, 13:58:57 +221ms
+131ms	║58:57 = ACTIVE (ON)
18/10/2020, 13:58:55 +93ms
+84ms	║58:55 = INACTIVE at 60 sec
18/10/2020, 13:57:55 +670ms
+120ms	║57:55 = ACTIVE (ON)
18/10/2020, 13:57:54 +819ms
+80ms	║57:54 = INACTIVE at 60 sec
18/10/2020, 13:56:52 +306ms
+145ms	║56:52 = ACTIVE (ON)
18/10/2020, 13:56:51 +910ms
+95ms	║56:51 = INACTIVE at 60 sec
18/10/2020, 13:55:51 +177ms
+143ms	║55:51 = ACTIVE (ON)
18/10/2020, 13:55:50 +138ms
+81ms	║55:50 = INACTIVE at 60 sec
18/10/2020, 13:54:50 +696ms
+145ms	║54:50 = ACTIVE (ON)
18/10/2020, 13:54:50 +370ms
+81ms	║54:50 = INACTIVE at 60 sec
18/10/2020, 13:53:49 +864ms
+215ms	║53:50 = ACTIVE (ON)
18/10/2020, 13:53:47 +126ms
+80ms	║53:47 = INACTIVE at 60 sec
18/10/2020, 13:52:47 +784ms
+998ms	║52:48 = ACTIVE (ON)
18/10/2020, 13:52:38 +65ms
+322ms	║52:38 = INACTIVE at 75 sec
18/10/2020, 13:52:19 +176ms
+71ms	║52:19 = INACTIVE at 60 sec
18/10/2020, 13:51:19 +182ms
+357ms	║51:19 = ACTIVE (ON)
18/10/2020, 13:50:23 +58ms
+2827ms	║50:25 = INACTIVE at 75 sec
18/10/2020, 13:50:03 +983ms
+76ms	║50:4 = INACTIVE at 60 sec
18/10/2020, 13:49:00 +344ms
+146ms	║49:0 = ACTIVE (ON)
18/10/2020, 13:48:57 +261ms
+71ms	║48:57 = INACTIVE at 60 sec
18/10/2020, 13:47:57 +541ms
+393ms	║47:57 = ACTIVE (ON)

As you can see, no mater how long I stay in there, it just never initiates the 10min timer


#26

I actually found one of your earlier posts on the same theme with variables. Im testing this now


#27

Yes, that is the general concept, but I think that example will fail with your particular motion sensor.

Even if you were doing a 1 hour marathon jumping-jack-session, your motion sensor will turn inactive every 60 seconds. (IE: 60 times that hour)

I will try to whip you up something tomorrow that takes that into account.


#28

If you have the time that would be great, but in the meantime i’m going to continue playing around. Have to learn somehow lol. I’m just going to keep updating my comments, to tell you where I got with it. But please, just ignore it till you have the time to look at it.

Yeah, I kind of thought this would be an issue and I’m trying to work that out.

I actually got the smart home solver guys Piston from his channel and Im trying to make that work now.

0vbr is the code for it.

Ill let you know how I get on and again, please just ignore my notes here till you get a bit of time for it lol. Enjoy your Sunday, or wherever you are :slight_smile:


#29

Tomorrow came early, LOL

Here is an improved version of my earlier piston, with a counter to keep track.
(as you will see in the logs)

This one is also untested, but it looks solid to me…
Please pause your other “Kitchen Motion” pistons when testing this one.

Note, the count will +1 at each “active”, and reset back to 0 once the room has been clear for 10 min


You could turn Logs completely off, and you will still get basic info at every event…
but if we have to troubleshoot, my first question will likely be for the Full logs., LOL.


#30

Sorry for the late response!

I’ve been neck deep in email server issues :frowning:

I’m in the office right now, Ill test this when I get home and let you know!

Thanks mate, always appreciate your help :slight_smile:


#31

Again, sorry for the slow responses. This email servers been killing me. BUT, finally fixed.

So just testing this now and it seems to work. If I duck in and out, it turns off pretty quickly. If I stay in there for a while its on a lot longer.

21/10/2020, 20:05:26 +177ms
+82ms	║5:26 = INACTIVE at 60 sec = #2
21/10/2020, 20:04:26 +448ms
+179ms	║4:26 = ACTIVE (ON) = #2

Short duration. Ill get the logs for the longer one tomorrow.

I’m going to keep testing over the next few days and ill let you know. But thanks so much for just taking the time to help me out with this. I really appreciate all the effort and information you have given me.

Mean a lot :slight_smile: