Driveway Lighting not working as desired


#1

1) Give a description of the problem
Lights are turning off at approximately 2200-2300 hours
Lights do not turn on (if off) when a presence sensor arrives. Other actions (using Smartthings) trigger properly based off of presence

2) What is the expected behavior?
Driveway Lights activate near sunset & turn off at 2100 hours. If presence sensor arrives after 2100 hours, lights turn on for 15 min and then turn off.
(Bonus if will turn on between 0200 - (30 min before sunrise) if motion is seen by ring doorbell - IE: I’m leaving the house to go to my car early)

3) What is happening/not happening?
Lights are not turning off as scheduled. They end up being turned off at 2200-2300 hours when another script runs that turns off all the lights in the house.
Lights do not turn ON when a presence sensor arrives after they are off.

**4) Post a Green Snapshot of the piston![image|45x37]


#2

Move the second IF Block that is in the ELSE Block outside of the first IF Block and make it it’s own block.


#3

Try what @jkp suggested to see how that works, but I’m not sure the 2nd IF block is going to work as you want it to.

If my understanding of how WAIT works, after the 15 min wait period, the condition will be re-evaluated. If the conditions are no longer met when it’s re-evaluated, your action isn’t going to fire. So if after waiting 15 minutes, if the time isn’t between 1 minute to sunset and 2045, the light isn’t going to turn off. It also isn’t going to turn off if it gets turned on later because your IF limits when it can turn off.

I’d approach this by writing 3 non-nested IFs:

  1. IF the time changes to this, turn on the light
  2. IF the time changes to this, turn off the light
  3. IF someone arrives AND it’s between this and this, THEN turn on the light, wait 15 mins, turn off the light.

#4

Or timer blocks :slight_smile:

Every day at blah turn on light
Every day at blah turn off light


#5

Well, I paused the script I posed and I’m going to give it a shot this way. I’ll report back if it works.


#6

Yep, what @jkp said. I was having a coding block . . . :crazy_face: