Ok, so another example of why I did not become a programmer. I have a rule that is supposed to raise a dimmer to 100% if there is motion on a sensor between sunset and sunrise-20. Then, if there is no motion for 10 minutes, lower the dimmer to 25%. Here's what I have:
I'm sure everyone can see the error - even I know why it doesn't work right... the ELSE statement runs because the trigger is activated - but the light is turning ON to 25% during the day.
So what is the "right" way to do this - change ELSE to ELSE IF and include the sunset-sunrise-20 statement again? or will that mess up the cancel operation if there is multiple motion changes?
I would try that to start with.
Do you also want the light to turn on and off at sunrise and sunset?
I would mirror the IF statement, and call it ELSE IF. But this time make the motion sensor inactive (or maybe NOT active would be better?). Not sure if your sensor reports activity, inactivity, or both and that would probably determine which way around to do this.
Keep the delay, and dim to 20 line as is, as the THEN part of your statement.
Triggers motion changed
IF NOT (time between sunset and sunrise -20mins) exit rule
IF(motion active) THEN
IF (PB = true) dim light 100%
Cancel delays actions
Set PB to false
Delay 10 mins (cancel)
Dim light 25%
Set PB true
motion sensor changed
if time then
if motion active
Dim 25% (delay 10 min) (Cancel)
Funny there are 3 of us with different ways to do this.
Yours would be good if he wants the light to come on at sunset, and then do the brighten/dim thing due to motion from that point on. I didn't consider that in my rule above.
I like this - trying it now.