I have a few rooms where I wanted a motion sensor to trigger lights but without the 1+ second delay that having only a program control them introduces. And I wanted the dimmer switches to behave nearly normal. Basically there are four states I wanted for the lights.
- Have the motion sensor not turn the lights on (set by off click or when it becomes not dark out)
- Have the motion sensor turn the lights to dim and turn off after x minutes (set by fast off (reset) or when it becomes dark out)
- Have the lights dim and not turn off (set by On click (when lights bright) or fade)
- Have the lights bright and not turn off (set by On click (when lights dim))
Although, some people seem to dislike them I have 11 motion sensors and have been pretty happy with them. I've had a few variants of programs that do similar things described above but I think my current set works pretty good and might help someone else out. Once one room is setup it's fairly easy to copy and adjust for another room.
The only thing I don't like about the setup is the lights could flash to the previous brightness setting when changing the brightness setting for a couple seconds. This is because the programs take a few seconds to update the scene and the motion sensor could trigger the lights with an old setting. If anyone has suggestions I'd love to hear them!
So, the programs below are for 2 lights controlled by one motion sensor set to only trigger on commands (jumper 5 set on the motion sensor and the option set in the ISY for only on commands). I also use one variable to keep track of what the brightness is supposed to be as this is more reliable than checking the light itself as it could be changing from one brightness to another. I also, use a state variable for all my light schedules to indicate when it's dark which is more robust than a schedule.
Living Room Off Timer
If
Control 'Main Floor / Living Room / Living Room Motion-Sensor' is switched On
Then
Wait 180 seconds
Set Scene 'Main Floor / Living Room / Living Room' Off
Else
- No Actions - (To add one, press 'Action')
This program will run everytime motion is detected and wait 3 minutes to shut lights off. Unless one of the other programs disabled it because lights were manually adjusted.
Living Room Set Motion Bright
If
$iLivingRoomLightLevel is 1
And (
Control 'Main Floor / Living Room / Living Room Hall Light' is switched On
Or Control 'Main Floor / Living Room / Living Room Lights' is switched On
)
Then
Stop program 'Living Room Set Motion Dim'
Stop program 'Living Room Set Motion Off'
$iLivingRoomLightLevel = 2
In Scene 'Main Floor / Living Room / Living Room Motion-Sensor' Set 'Main Floor / Living Room / Living Room Lights' 100% (On Level)
In Scene 'Main Floor / Living Room / Living Room Motion-Sensor' Set 'Main Floor / Living Room / Living Room Hall Light' 100% (On Level)
Run Program 'Living Room Set On Dim' (Then Path)
Disable Program 'Living Room Off Timer'
Wait 1 second
Set 'Main Floor / Living Room / Living Room Hall Light' 100%
Set 'Main Floor / Living Room / Living Room Lights' 100%
Wait 1 second
Set 'Main Floor / Living Room / Living Room Hall Light' 100%
Set 'Main Floor / Living Room / Living Room Lights' 100%
Wait 2 seconds
Set 'Main Floor / Living Room / Living Room Hall Light' 100%
Set 'Main Floor / Living Room / Living Room Lights' 100%
Wait 3 seconds
Set 'Main Floor / Living Room / Living Room Hall Light' 100%
Set 'Main Floor / Living Room / Living Room Lights' 100%
Else
- No Actions - (To add one, press 'Action')
If light switch turned on while lights are set to be dim
- stop other programs that may still be running and setting a different brightness
- set lights to go to 100% brightness via motion sensor
- set lights to go to dim brightness next on click (Lights will already have gone to 100% brightness based on existing scene setup)
- leave them on by disabling off program
- Set them to 100% bright a few times in case motion sensor triggers them to previous setting before scene is updated
Living Room Set Motion Dim
If
$iLivingRoomLightLevel is 2
And (
Control 'Main Floor / Living Room / Living Room Hall Light' is switched On
Or Control 'Main Floor / Living Room / Living Room Lights' is switched On
)
Or Control 'Main Floor / Living Room / Living Room Hall Light' is switched Fade Stop
Or Control 'Main Floor / Living Room / Living Room Lights' is switched Fade Stop
Then
Stop program 'Living Room Set Motion Bright'
Stop program 'Living Room Set Motion Off'
$iLivingRoomLightLevel = 1
In Scene 'Main Floor / Living Room / Living Room Motion-Sensor' Set 'Main Floor / Living Room / Living Room Lights' 50% (On Level)
In Scene 'Main Floor / Living Room / Living Room Motion-Sensor' Set 'Main Floor / Living Room / Living Room Hall Light' 50% (On Level)
Run Program 'Living Room Set On Bright' (Then Path)
Disable Program 'Living Room Off Timer'
Wait 1 second
Set 'Main Floor / Living Room / Living Room Lights' 50%
Set 'Main Floor / Living Room / Living Room Hall Light' 50%
Wait 1 second
Set 'Main Floor / Living Room / Living Room Lights' 50%
Set 'Main Floor / Living Room / Living Room Hall Light' 50%
Wait 2 seconds
Set 'Main Floor / Living Room / Living Room Lights' 50%
Set 'Main Floor / Living Room / Living Room Hall Light' 50%
Wait 3 seconds
Set 'Main Floor / Living Room / Living Room Lights' 50%
Set 'Main Floor / Living Room / Living Room Hall Light' 50%
Else
- No Actions - (To add one, press 'Action')
If light switch turned on while lights are bright or switch faded up or down
- stop other programs that may still be running and setting a different brightness
- set lights to go to dim brightness via motion sensor
- set lights to go to 100% brightness next on click (Lights will already have gone to dim brightness based on existing scene setup)
- leave them on by disabling off program
- Set them to dim brightness a few times in case motion sensor triggers them to previous setting before scene is updated
Living Room Set Motion Dim With Off Timer
If
Control 'Main Floor / Living Room / Living Room Lights' is switched Fast Off
Or Control 'Main Floor / Living Room / Living Room Hall Light' is switched Fast Off
Or $sDark is 1
Then
$iLivingRoomLightLevel = 1
In Scene 'Main Floor / Living Room / Living Room Motion-Sensor' Set 'Main Floor / Living Room / Living Room Lights' 50% (On Level)
In Scene 'Main Floor / Living Room / Living Room Motion-Sensor' Set 'Main Floor / Living Room / Living Room Hall Light' 50% (On Level)
Run Program 'Living Room Set On Bright' (Then Path)
Enable Program 'Living Room Off Timer'
Else
- No Actions - (To add one, press 'Action')
If light switch double-clicked off or it's now dark out (reset to normal)
- set lights to go to dim brightness via motion sensor
- set lights to go to 100% brightness next on click
- enable off timer program
Living Room Set Motion Off
If
Control 'Main Floor / Living Room / Living Room Hall Light' is switched Off
Or Control 'Main Floor / Living Room / Living Room Lights' is switched Off
Or $sDark is 0
Then
Stop program 'Living Room Set Motion Dim'
Stop program 'Living Room Set Motion Bright'
In Scene 'Main Floor / Living Room / Living Room Motion-Sensor' Set 'Main Floor / Living Room / Living Room Lights' 0% (On Level)
In Scene 'Main Floor / Living Room / Living Room Motion-Sensor' Set 'Main Floor / Living Room / Living Room Hall Light' 0% (On Level)
Run Program 'Living Room Set On Dim' (Then Path)
Wait 1 second
Set 'Main Floor / Living Room / Living Room Lights' Off
Set 'Main Floor / Living Room / Living Room Hall Light' Off
Wait 1 second
Set 'Main Floor / Living Room / Living Room Lights' Off
Set 'Main Floor / Living Room / Living Room Hall Light' Off
Wait 2 seconds
Set 'Main Floor / Living Room / Living Room Lights' Off
Set 'Main Floor / Living Room / Living Room Hall Light' Off
Wait 2 seconds
Set 'Main Floor / Living Room / Living Room Lights' Off
Set 'Main Floor / Living Room / Living Room Hall Light' Off
Else
- No Actions - (To add one, press 'Action')
If light switch turned off or no longer dark out
- stop other programs that may still be running and setting a different brightness
- set lights to go to 0% brightness via motion sensor
- set lights to go to dim brightness next on click (Lights will already have gone to 0% brightness based on existing scene setup)
- Set them to 0% brightness a few times in case motion sensor triggers them to previous setting before scene is updated
Living Room Set On Bright
If
- No Conditions - (To add one, press 'Schedule' or 'Condition')
Then
In Scene 'Main Floor / Living Room / Living Room Hall Light' Set 'Main Floor / Living Room / Living Room Hall Light' 100% (On Level)
In Scene 'Main Floor / Living Room / Living Room Hall Light' Set 'Main Floor / Living Room / Living Room Lights' 100% (On Level)
In Scene 'Main Floor / Living Room / Living Room Lights' Set 'Main Floor / Living Room / Living Room Lights' 100% (On Level)
In Scene 'Main Floor / Living Room / Living Room Lights' Set 'Main Floor / Living Room / Living Room Hall Light' 100% (On Level)
Else
- No Actions - (To add one, press 'Action')
Set the lights to go to bright setting next on click.
Living Room Set On Dim
If
- No Conditions - (To add one, press 'Schedule' or 'Condition')
Then
In Scene 'Main Floor / Living Room / Living Room Hall Light' Set 'Main Floor / Living Room / Living Room Hall Light' 50% (On Level)
In Scene 'Main Floor / Living Room / Living Room Hall Light' Set 'Main Floor / Living Room / Living Room Lights' 50% (On Level)
In Scene 'Main Floor / Living Room / Living Room Lights' Set 'Main Floor / Living Room / Living Room Lights' 50% (On Level)
In Scene 'Main Floor / Living Room / Living Room Lights' Set 'Main Floor / Living Room / Living Room Hall Light' 50% (On Level)
Else
- No Actions - (To add one, press 'Action')
Set the lights to go to dim setting next on click.