Lights on/off due to time and presence


#1

Give a description of the problem
This piston works. I’m just wondering about the efficiency – is this ideal or is there a better way to achieve the same results?
I want my outside lights to turn on at sunset if one or both of our presence sensors are away and turn off at sunrise. Then, at night, if one of us leaves, turn on the lights. If we both return, turn them off.

Post a Green Snapshot of the piston!


#2

Just a quick read through…it looks good to me.


#3

I just have two suggestions…

  1. More efficent way is TRIGGERS first CONDITIONS later…

IF sensors changes (trigger)
and
IF time is between this and that (condition)

You can see the triggers with the little lightning icon…

  1. If you have just a few pistons thats fine but be careful with the timers
    I have seen problems with my system if multiple piston timers are executing simultaneously at sunset, sunrise etc…
    My suggestion is never executing timers at the the same time with other pistons…
    ie :
    Piston 1# timer executes at 2 minutes to Sunset
    Piston 2# timer executes at 3 minutes after Sunset
    Piston 3# timer executes at 6.04pm etc…

I have well over 100 pistons, maybe that was the reason but I have seen coders doing the same thing… FYI


#4

I have to agree with @ike2018 above. Generally, I prefer my triggers first, then conditions. I don’t have many pistons that rely on sunrise/sunset so I don’t seem to have an issue there. But you said that your piston is working. Usually, I end up breaking something when I try to improve what is already working :slight_smile: Your mileage may vary…


#5

Awesome – that’s what I wanted to hear! Thanks for the feedback!