Swith on with presence at certain time and off unless motion continues?


#1

I’m trying to design a piston that will turn on a Switch and Outlet in my Office Daily @ 600AM and off again @ 600PM Mon-Fri as long as I am present, This part I know how to do. The intricate part I’m trying to add is having it not shut off if Motion continues after 600PM. There are days where I’m working a little later than normal and don’t want stuff to turn off. So I need it to come on at 6AM and Off at 6PM unless motion is still detected then stay on until 20 minutes after motion stops. Any help from the pro’s would be greatly appreciated

Jimmy


#2

You did not include your piston, but this portion can simply be:

IF Sensor's motion stays inactive for 20 min  <-- Trigger (top-level)
Then
    IF Time is after 6pm                      <-- Condition (indented)
    Then
        Turn off switch
    END IF
END IF

Note: Having multiple triggers in this piston can break the STAY trigger.


#3

Thanks, I’ll put the piston together and post it if I have any issues.


#4


#5

Unfortunately, a trigger (line 36) inside of a trigger (line 31) will rarely work…

Basically, lines 31-44 can be replaced with my snippet above.


Edit:

If you want a safety net, just add a separate “EVERY DAY AT” block to the bottom:

Every Day at 7pm
    Turn off switch
END EVERY

#6

Awesome thanks for the pointers. I’ll make some changes. and we’ll see how it works.

Thanks again.