From: Mark Y. <my...@mi...> - 2001-05-16 18:03:01
|
Just to add to the TMTOWTDI-ness of this process... I have my porch light set up on a schedule, and there's a motion detector on the deck as well. The porch light is always on from, say, 5am to 7am, and again from 6pm to 11pm. Outside of those times, it's controlled by the motion sensor only if it's dark outside. The scheduled events go like this: 5am & 6pm: Turn porch light on, set flag $PorchLightScheduledOn to 1. 7am & 11pm: Turn porch light off, set flag $PorchLightScheduledOn to 0. I don't have the code in front of me, but the motion sensing logic goes something like this: if (M1 is ON && ! $PorchLightScheduledOn && $Dark) { set porch light on } # This ignores motion detected during the day if (M1 is OFF && ! $PorchLightScheduledOn) { set porch light off } # The motion detector sends a "no motion sensed in X minutes",=20 # so turn off the light if it's not scheduled to be on So I use the Hawkeye II's "no motion detected" value to determine when to turn off. This way, if I go out on the deck in the middle of the night for some reason, it won't turn off the porch light until X minutes after it detects the last bit of motion. This is particularly handy for, say, unloading groceries. I wouldn't want it to start a timer and turn off the porch light 2 minutes after it first detected motion. > -----Original Message----- > From: Clay Jackson [mailto:cl...@nw...]=20 > Sent: Wednesday, May 16, 2001 10:46 AM > To: mis...@li... > Subject: Re: [misterhouse-users] Ignoring motion detectors at=20 > certain times.......... >=20 >=20 > Chris - I've got exactly this setup working at home (I don't=20 > have the code here at work, but > I'll post it next time I'm at my computer at home). =20 > Meanwhile, here's the basics (please > excuse the lack of perfect syntax). >=20 > Light - A1 > Motion Detector J1 (which means the day/night sensor is J2) >=20 > if state_now J2 off ; it;s now dark out > set A1 on >=20 > if time =3D 11:30PM ; turn off the light at 11:30 > set A1 off >=20 > if state j2 off ; it's dark > and state A1 off ; but the lights off > set_with_timer A1 on 600 ; turn the light on for 10 minutes >=20 > if state_now j2 on ; it's now light out > set A1 off ; so turn off the lights=20 > (just to be sure) >=20 >=20 > My code's actually a bit more complicated - >=20 > I have the outside lights set to come ON at 6:30 in the=20 > morning, unless it's already light > out, I log motion even during the day, and I'm using some=20 > timers to "damp out" dark/light > transitions that occur within a few minutes of each other=20 > (I've discovered that during > twilight, the Hawkeye will "transition" anywhere from 2-10=20 > times before it settles down and > decides it's REALLY dark or REALLY light). >=20 > The key here is the difference between STATE and STATE_NOW. =20 > STATE_NOW only reports the > TRANSITION for ONE loop (edge triggering), whereas STATE=20 > reports the CURRENT state (EVERY > loop). >=20 > As an aside, this is one of the things I like about MH, the=20 > ability to be able to create both > edge and level triggered events. >=20 > Clay Jackson >=20 >=20 > Chris Harry wrote: >=20 > > This is what needs to happen: > > > > Before Sunset, leave the light off (taken care of by=20 > setting the HawkEye II to signal only > > at night). > > > > After Sunset, the light automatically turns on (via MH=20 > code) and then off at 11:30PM. > > Between the time it turns on and turns off, the light needs=20 > to be on all the time, > > regardless of what the motion sensor says. > > > > After 11:30PM, the light turns off, and the motion sensor=20 > can now control the light > > totally (on if motion detected, off if no motion for the=20 > sensor setting). > > > > So, basically during the time the light needs to be always=20 > ON, I need to take the OFF > > signal from the motion sensor and basically make it=20 > disappear. If I set the motion sensor > > to the same house/unit code as the light, the light reads=20 > the signal right from the sensor > > even before MH knows its there. To fix this, Ive tried=20 > changing the house/unit code of > > the motion sensor to something not hooked up, then had this=20 > code run against the light > > house/unit code itself. It works, but its very slow (i.e.=20 > 4 seconds between motion sense > > and light turn on). > > The solution would be A) have the OFF signal not work=20 > during "always on" time, or B) speed > > up the lag-time when having MH run the sensors by itself. > > > > Again, any ideas? > > > > -Chris > > > > Damon Hopkins wrote: > > > > > Chris Harry wrote: > > > > > > > > Attached is the code for my serial_item_test.pl. I=20 > defined the serial_items > > > > correctly, as far as I know, I just dont know what was=20 > causing me to get errors > > > > saying "no serial port found". > > > > > > > > This was with the light to turn on/off set to "X10I,=20 > A5" in items.mht. Yeah, I know > > > > it was the same as the motion sensor, but Im figuring=20 > there has to be a way to make > > > > this work. I've tried changing the motion sensor unit=20 > code to something not > > > > attached to an X10 module, and written the code to turn=20 > the light on based on that, > > > > but the delay between the trip of the motion sensor and=20 > the light going on makes it > > > > so that walking into my bedroom, I'm halfway thru=20 > before the light turns on. > > > > > > > > Is there any way we can bypass just the OFF sequence of=20 > a motion sensor? > > > just don't put the stuff in there... :) > > > <SNIP> > > > > if (state_now $x10_receive eq 'Bedroom light - motion=20 > detected') { > > > > print "Got movement\n"; > > > > if (time_greater_than "$bedroom_light_timeon") { > > > > set $BR_test_light ON; > > > > print "Motion detected, light turned on\n"; > > > > } else { > > > > print "Motion detected, light turned on\n"; > > > > set $BR_test_light ON; > > > > } > > > > } > > > This will turn on the light no matter when it is.. you=20 > could just leave > > > it out.. or change it so that at certain times the light=20 > won't come on > > > if there is motion.. > > > > > > > if (state_now $x10_receive eq 'Bedroom light - all is quiet') { > > > > print "Got all is quiet\n"; > > > > if (time_greater_than $bedroom_light_timeon) { > > > > print "Got all is quiet\n"; > > > > if (time_less_than $bedroom_light_timeoff) { > > > > print "Still not late enough,=20 > keeping the light on\n"; > > > > set $BR_test_light ON; > > > > } else { > > > > print "Normal mode, turning=20 > light off now\n"; > > > > set $BR_test_light OFF; > > > > } > > > > } > > > > } > > > if you don't want to use the off command then just=20 > leave this stuff > > > out.. you could set your own timers if you wanted to..=20 > say.. leave the > > > light on for 30 minutes during the day and 10 during the evening.. > > > > > > Damon Hopkins > > > > > > ________________________________________________________ > > > To unsubscribe from this list, go to:=20 > http://sourceforge.net/mail/?group_id=3D1365 > > > >=20 > ________________________________________________________ > > To unsubscribe from this list, go to:=20 > http://sourceforge.net/mail/?group_id=3D1365 >=20 >=20 >=20 > ________________________________________________________ > To unsubscribe from this list, go to:=20 > http://sourceforge.net/mail/?group_id=3D1365 >=20 >=20 |