Narrative:
This set of macros turn on my bathroom lights when someone enters the bathroom. However, due to the layout of the bathroom, there is no way to place one motion sensor such that it can see someone at the sink or someone in the shower. Thus, I use two motion sensors. The one by the sink turns on the lights fully if it is daylight, or dims them down to 45% if it is after midnight but before 7:05 AM. The second motion sensor overwatches the shower, and simply sets a flag in AHP. These two sensors are positioned such that the sensor by the door will always be the last one triggered. Thus, my bathroom lights off macro checks to see if the shower motion flag is cleared, then turns the lights off. If the flag is not cleared, then the lights stay on. Presumably if the lights stay on, someone will at a later time get out of the shower, which will trigger the motion sensor by the sink, and then when it sends the off signal once again, the shower flag will be checked and if off the lights will go off. If not, repeat. I've been running this for a while, and it has performed flawlessly.
Flags:
2: SET when Master Bath lights go ON
CLEARED when Master Bath lights are turned OFF
Purpose: Keep multiple trips of Master Bath motion sensor from
brightening/dimming lights multiple times per occupancy.
3: Goes ON (SET) at 0001
Goes OFF (CLEARED) at 0705
Purpose: Allows a way to turn bathroom lights on at a lower level in
the middle of the night, to help from disturbing sleep.
Modules:
MS14A Base Address M13 (Sink Motion Sensor)
MS14A Base Address M15 (Shower Motion Sensor)
Decora Wall Switch Address M5
Macro Name:
MBath Motion Set
Trigger & Conditions:
M15 On
Actions:
Set Flag 7 (Motion present in shower)
Macro Name:
MBath Motion Clear
Trigger & Conditions:
M15 Off
Actions:
Clear Flag 7 (No motion present in shower)
Macro Name:
MBath Lights ON DAY
Trigger & Conditions:
M13 ON
Flag 2 OFF (Lights are not already on)
Actions:
Set Flag 2 (Prevents multiple triggers)
M5 ON (Turn on bathroom lights)
Macro Name:
MBath Lights ON NIGHT
Trigger & Conditions:
M13 ON
Flag 2 OFF (Lights are not already on)
Flag 3 ON (Between Midnight and 0705)
Actions:
Set Flag 2 (Prevents multiple triggers)
M5 ON (Turn on bathroom lights)
M5 Absolute Dim 45% (Dim bathroom lights to 45%)
Macro Name:
MBath Lights OFF
Trigger & Conditions:
M13 OFF
Flag 7 OFF (No motion in shower)
Actions:
Clear Flag 2 (Turn off multiple trigger prevention flag)
M5 OFF (Turn off bathroom lights)
Hope this helps someone else. It isn't limited to bathrooms, but would be useful for any sort of room where there are areas that one motion sensor can't see all of. The only problem is that it is a flag hog.
Cheers,
--Lee