Motion sensors - keeping the lights on

James Sentman james at sentman.com
Fri Jan 18 10:53:18 EST 2019


I do similar things, but I don’t have any script that runs constantly to keep lights in a state they should be in. I use motion sensors and other states of pseudos or other sensors to control what should happen when. When there is a state of something like the TV using power that won’t continue to generate events like a motion sensor does instead I use a script rather than a direct event to turn off the lights there. That script will then check the state of the TV and if it’s still on then it will rechedule itself to run in another 10 minutes or so and check for that.

Another example of that extra complexity are the overhead lights in the garage. I want to keep them on while I’m out there working on stuff and that just uses the motion sensors, but I also don’t want them to go out while the garage doors are open so that if I leave them open nobody can think they can come in and sneak around my garage or anything like that. My logic for that is that whenever any door is opened or any motion sensor goes off it turns on the garage overhead lights and then schedules a script to run in 15 minutes that I called “check for garage lights” That script running is put off by the motion sensors the same way that you’d put off turning off a light that was turned on by a motion sensor or exactly as Brian does below, but instead of suspend event “name of the unit” I use suspend event “name of the script” (you guys did know that you can do that right? The Suspend event verb works with either units or scripts if they have events coming up that were created via the “in” or “for” parameters to the unit control commands, or the execute script command.) 

When the script runs it checks to make sure the state of all the garage doors and the door to the house is closed and if they are then it turns off the lights. If any door is still open then it reschedules itself for another 15 minutes later. 

I do something also similar with my Son’s overhead lights. When he’s working at his computer he often doesn’t set off the motion sensor enough to keep all his lights from switching off. he’s got his machine on a UPS and I put a raspberry pi zero running the APCUPS software and the relatively new XTension plugin for that ;) That gives me the load on the UPS so I can tell if he’s using his computer or not and a similar script checks for that and won’t turn the lights off while he’s working on it. Once it goes to sleep then it will do so.





> On Jan 17, 2019, at 4:03 PM, Brian Williams <brwill at me.com> wrote:
> 
> As most know, motion sensors are not occupancy sensors; just sitting & watching TV won’t keep them triggered. I, too, have had all the living room lights go off late in the evening even while we had guests (no, that doesn’t mean that it’s time for you to go.)
> 
> My solution was to create flags with timeouts of 15 minutes. If any of the sensors detects motion, the flag gets pushed out. The ON script for those motion sensors is: execute script "MD ULA”, and global script MD ULA is:
> 
> turnon "Flag ULA"
> 
> try
> 	suspend event "Flag ULA" for ULATime
> 	
> on error
> 	
> 	turnon "Flag ULA" for ULATime
> 	
> end try
> 
> There are other downstream events when the Flag turns off. ULA is Upper Level Active. I have several ‘zones’ that are treated in this manner. Essentially, no motion in Zone X for 15 minutes turns off all the lights in Zone X. Usually, with company in the living room, one or more sensor will trigger before the flag timeout.
> 
> BUT, if watching TV, there is little motion, so timeout can, and does occur. So, I have the TV plugged into an Aeotec Smart Switch 6, and if the value of that unit is greater than 50 watts, then the lights are not turned off.
> 
> There is much more to this. My household light audit routine runs every 15 seconds to ensure that lights are in the state that they should be throughout the day, taking into account motion, time-of-day, level of daylight, level of interior light, and more. Evening and nighttime lighting (interior and exterior) is the same whether we are home or not. Variance comes with Sunrise, Sunset, and XT smarts.
> 

Thanks,
 James


James Sentman                       http://www.PlanetaryGear.org		http://MacHomeAutomation.com




-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.machomeautomation.com/pipermail/xtensionlist/attachments/20190118/0c2fb5bd/attachment.html>


More information about the XTensionList mailing list