Sachelis Posted November 10, 2015 Posted November 10, 2015 (An optional title for this post might be, "Setting a variable when a 2477S switch is turned on.") I am trying to have a light turn on/off based on motion, but also allow the light switch to override the motion sensor. I have a variable named bMotionLightOn that gets set to 1 when the light is turned on by motion. This lets me know if lack-of-motion should turn the light off. Here are my programs: Motion On: If From Sunset To Sunrise (next day) And Status 'Motion' is On And Status 'Light' is Off Then Set 'Light' On $bMotionLightOn = 1 ' So I know the light was turned on by motion. Motion Off: If Status 'Motion' is Off And $bMotionLightOn is 1 Then Set 'Light' Off $bMotionLightOn = 0 Here is where I'm stumped. If the user turns the light on using the 2477S wall switch, I want to set bMotionLightOn to 0. That would prevent the "Motion Off" program from turning off the light when there isn't any motion. Is this the right approach? Can I set the variable when the user turns on the light using the switch? Thanks!
jerlands Posted November 10, 2015 Posted November 10, 2015 Here is where I'm stumped. If the user turns the light on using the 2477S wall switch, I want to set bMotionLightOn to 0. That would prevent the "Motion Off" program from turning off the light when there isn't any motion. Is this the right approach? Can I set the variable when the user turns on the light using the switch? Use "Control" in a separate program. If 'Light' is switched On Then $bMotionLightOn = 0 Else - No Actions - (To add one, press 'Action') This does not address the switch being turned off.. Jon.,.
Sachelis Posted November 10, 2015 Author Posted November 10, 2015 Thanks Jon! I didn't know about Control events...
oberkc Posted November 10, 2015 Posted November 10, 2015 (edited) I find variables an unnecessary complication in this case. I use a simple program such as: if control light switch is switched on an control light switch is not switched off then nothing else nothing Once a program like this is in place, I use the program status (TRUE or FALSE) as a condition to my motion program. Obviously, these additional complications eliminate the use of scenes between motion sensor and light, so it would all be done via programs. Also I assume the light switch controlling the motion program is the same one controlling the light. If not, there may be a few details different. Assuming I have it correct, only a manual activation of the switch, itself, will disable the motion response. Furthermore, if the light is on from motion and you turn on the switch, the timer is halted and the switch stays on indefinitely. Turning off the switch while the timer is active will, obviously turn off the light. if control motion sensor is turned on and status first program is false then turn on light light switch wait a little while turn off light else nothing Edited November 10, 2015 by oberkc
Recommended Posts