I'm struggling trying to write this in rule machine. Pseudo code/logic is as follows
-
At Sunset, set Dimmer A and B to 50% brightness. Keep this brightness until 9 pm and then turn off.
-
From Sunset to Sunrise (so this would overlap #1 above for a few hours), if Motion is detected, then set dimmer A and B to 100% brightness.
-
Wait for further motion for 3 minutes, then if no motion has been detected do one of the following:
a) Set brightness back to 50% if the time is still under 9:00 pm
b) Set brightness to 0% (off) if the time is between 9:01 pm and Sunrise. #2 would then run any time motion is detected between 9:01 pm and Sunrise.
I know how to write the steps for #1 and #2 separately, but I'm confused how to make them overlap for #3 to work.
If Time is Sunset to 9 pm
{
Set Dimmer A and B Brightness to 50%
If motionDetected = true
{
Set Dimmer A and B Brightness to 100%
Wait 3 min
If motionDetected = false
{
Set Dimmer A and B Brightness to 50%
}
}
}
Else if Time is 9:01 pm to Sunrise
{
Set Dimmer A and B Brightness to 0% (off)
If motionDetected = true
{
Set Dimmer A and B Brightness to 100%
Wait 3 min
If motionDetected = false
{
Set Dimmer A and B Brightness to 0% (off)
}
}
}
}