From: ebroo <eb...@se...> - 2007-02-27 18:40:48
|
Hi all, I'm trying to evaluate a state before setting an action in motion, but the state never seems to change correctly. Using the below code, I hope to if motion sensor is active check the timer_garage to see if it's expired, if not set it to 60 second, then alert. If the timer is not expired, do nothing. When motion is seen, the timer is always zero, so there is always action - Any thoughts? $timer_garage = new Timer(); my @phrase = ("Somthing is stirring in the garage", "Cat wants in", "Doofus wants in", "guess who wants in"); if (state_now $motion1 eq 'motion' and inactive $timer_garage) { set $timer_garage 60; speak ("The cat wants in"); speak ( rooms=> "clyde", volume => "80", engine => "MS", voice => "Microsoft Mary", mode => "unmuted", text=> "The Cat is waiting to be let in." ); net_im_send(to => "IM1", text => "$phrase[rand @phrase] $Time_Date "); net_im_send(to => "IM2", text => "$phrase[rand @phrase] $Time_Date "); } TIA Edward |