Please login or register.

Login with username, password and session length

Author Topic: Control house lights from dusk sensor - with conditions/flags different days  (Read 12229 times)


  • Full Member
  • ***
  • Helpful Post Rating: 1
  • Posts: 57

AHP 3.233 (Europe)
Runs from the interface
These interlinked macros provide a way of triggering house lights from a dusk sensor (on second module address H16 of my MS13E PIR) throughout the year, but with these provisos ~ lights must not turn on before 16:15 on MTWTh or before 14:00 on FSaSu (to fit in with house occupancy), and there should be minimal risk of unwanted actions (i.e. lights 100% and dim) caused by unexpected activations of the sensor due to passing dark clouds/operation of lights near the sensor etc.
Previously, my lights had been controlled using the dusk times generated by AHP for my time zone, however, often as not, lights would come on too early or too late because of prevailing weather conditions.

See attached word doc (at the very bottom of this message) for overview of the timers and macros ...

I've set DST resolution to maximum (daily) to be sure that the clock time changes on the correct day in Spring and Autumn (Fall).

Macro Names:
   'H13 On - set flag 2 - MTWTh'   set using timed macro H13 (on at 16:14 MTWTh)
   'H12 On - set flag 3 - FSaSu'     set using timed macro H12 (on at 13:59 FSaSu) 
   'H16 On - dusk signal'   dusk signal from the sensor clears flags 2 & 3 and switches lights on if flag 2 or flag 3 are already set at this time
   'H16 On - set flag 8 - dusk signal'   if dusk signal is received before 13:59 FSaSu, or before 16:14 MTWTh (i.e. neither flag 2 OR 3 is set) then set flag 8
   'H14 On - timed'   switches lights on in sequence starting at 16:15 on MTWTh (only runs if dusk sensor has activated before 16:14 on MTWTh - i.e. if flag 8 is set)
   'H11 On - timed'   switches lights on in sequence starting at 14:00 on FSaSu (only runs if dusk sensor has activated before 13:59 on FSaSu - i.e. if flag 8 is set)
   'H14 Off - timed'   timed macro switches lights off in sequence (starting 23:00 every night)
   'H16 Off - dawn signal'   clear flag 8 - i.e. if light level rises after a dark cloud has passed by, flag 8 needs clearing

1  Trigger & Conditions: Lights triggered by dusk sensor
   H16 On and
   Flag Status On exactly 2 OR 3
   ELSE set flag 8

   Clear flags 2 & 3 (to prevent unwanted effects from further sensor activations) and switch lights on in sequence (using delays between each) 
   ELSE, as the result of neither flags 2 OR 3 being set when the sensor activates, flag 8 becomes set, causing macro 2 or 3 (below) to run...

2&3  Lights triggered by timers

2  Trigger & Conditions:                                               3  Trigger & Conditions:
   H14 On (timed to commence at 16:15 MTWTh) and           H11 On (timed to commence at 14:00 FSaSu) and
   Flag Status On exactly 8                                                  Flag Status On exactly 8

   Clear flags 2 & 3 and switch lights on in sequence on MTWTh or FSaSu (i.e. a series of 'module on' commands with delays between each)

4  Trigger & Conditions: dawn sensor
   H16 Off
   Clear flag 8.

5  Trigger & Conditions: lights off - triggered by timer
   H14 Off (timed to commence at 23:00 each night)
   Clear flags 2 & 3 ('belt and braces') 
   Lights switch off in timed sequence (i.e. a series of 'module off' commands with delays between each)


Flag 8 - If it gets sufficiently dark to activate the dusk sensor before 13:59 FSaSu or before 16:14 MTWTh, and then light level subsequently rises and activates the dawn sensor, 'H16 Off' runs to clear flag 8. This prevents lights coming on earlier than required (lights would come on at exactly 14:00 FSaSu or 16:15 MTWTh had flag 8 had not been cleared in this situation).

Flags 2 & 3, in addition to determining whether lights start on a timer or are triggered by the dusk sensor, these flags are also used to prevent unwanted effects from repeat dusk activations when lights are already on (caused by an increase in light followed by darkening i.e. sky brightening followed by passing dark clouds, or from other lights being switched on/off close to the dusk sensor). Flags 2 & 3 are cleared as soon as any of the 'lights on' macros run. For example, this will prevent 'H16 ON - dusk signal' from re-running with its associated lights on 100% and dim actions.

« Last Edit: December 14, 2008, 05:40:53 AM by dash »
Automation is great - but really frustrating when it doesn't work as expected !! | About X10 | X10 Security Systems | Cameras| Package Deals
© Copyright 2014-2016 All rights reserved.