I’m trying to create a piston to turn off several lights if motion isn’t detected on two sensors after 30 minutes. Right now it’s…
If each of Motion Sensor A,B,C was inactive for at least 30 minutes… turn off switch D.
The problem here is the light doesn’t turn off after 30 minutes UNLESS, sensor A,B,C is tripped again. That is, 30 minutes pass. The light is still on. I walk past sensor A (waking it up?), then light turns off.
The sensors are either SmartThings or directly paired Hue motion sensors. The switches are either Lutron or Leviton.
This behaviour happens on two separate routines and lights so it’s my logic that’s at fault, or something else?
Thanks. Seems like I needed to think about this a different way. So the end result looks like…
If…
Each of MOTIONA, MOTIONB or MOTIONC is inactive. <— current state true, which is good
Using location…
Wait 30 minutes, Task cancellation policy {cancel on condition state change}
Using SWITCH1, SWITCH2 > Turn Off
Sound right?
Web. Core. Uh. I better look that up. I know I’ve published it (just because it’s in the repo) but haven’t used it 
Thanks much! There’s my next spare time block gone 
Ok time to watch that video. Unfortunately what I proposed didn’t work. I used it at two locations with same result.
All switches and lights were off.
Turned on the light using switch.
Walked into the room, tripping a motion sensor.
It’s been more than 30 minutes since the sensor was active.
The room light turned off in about 10 seconds (processing time I guess).
Light1, Light2 on.
Sitting down for 30 minutes not moving.
Walk past sensor.
Turn off light 1 by switch.
Same code but added a second condition of AND Iight 1 is off.
In 10 seconds, light 2 also turns off.
In both cases it took the 30 minutes as already elapsed… and either didn’t save the condition or check for change amd cancel.
Oh, I’ll give that a try. I thought it was serial meaning if the previous action didn’t execute, it just stops.
Hmmmm not seeing how to put them in the same block. Going to have to use the webcore and pull the code.
Oh that makes so much sense now. I never realized that WAIT (and other options) are exposed after selecting a device. I always though WAIT was exposed only when using the LOCATION (first toggle). This explains why some other experiments with WAIT doesn’t work.
Ok, so where you have “Using Bathroom…” should be “Using…” whatever needs to be affected such as light 1 light 2 light 3… wait 15 minutes, then turn off.
Ok, now all this logic makes sense and it will probably work now – I was just misunderstanding how to add a wait (thought it was an independent statement).
1 Like
I love CoRE, but unless i’m missing something, this is super easy to setup in smart lighting.