From: Mike D. <md...@mi...> - 2000-11-02 00:43:21
|
>I would like to move these motion sensors from direct control of the lights >to MH.... I don't know how close this comes to what you need, but here's what I did for something similar. I have a driveway motion sensor for a "visitor annunciator" system. I created a generic object to control the state of the system: GENERIC, Annunciator_Enabled, Annunciators Then I have a bunch of conditional statements to link the motion sensor with the actual annunciator. A timer prevents multiple motion signals from getting through the system. $state = state_now $Driveway_Motion; if ($state) { if (inactive $drivewayMotionTimer) { # If motion is detected, take the appropriate action. If the # state is ON, do something. If the state is OFF, it's because # the timer expired, so ignore it. # if ($state eq ON) { # Set a timer to ignore driveway motion for 45 seconds, # then set $Driveway_Motion OFF, since the motion sensor # doesn't send OFF itself. # set $drivewayMotionTimer 45, 'set $Driveway_Motion OFF'; # Take action on driveway motion the annunciator system # is turned on and if the current time is between the # designated times. # if (state $Annunciator_Enabled eq ON && time_greater_than($DRIVEWAY_MONITOR_ON_TIME) && time_less_than($DRIVEWAY_MONITOR_OFF_TIME)) { set_with_timer $Chime_1 ON, 2; # Sound the chime $logAddendum = "Sounding chime"; # Change log addendum } logMessage(" *** Motion in the driveway - " . $logAddendum); } } else # If detected motion before timer expires.. { set $Driveway_Motion OFF; # ..reset the object } } I'm suddenly innundated with tired daughters needing homework help, so that's all you're going to get from me tonight. Hope it helps. Mike ------ Mike Dodd - Montpelier, VA Modeling Virginian Railway, 1956 http://www.mindspring.com/~mdodd/vgn_main.htm |