From: Matthew W. <mat...@us...> - 2006-03-24 13:57:17
|
Tim Sailer wrote: >> if ((state $mode_sleeping eq "nobody") and (state_now $Dining_PIR eq >> 'motion')){ >> set_with_timer $Dining_Light 'on', 600; # Leave at original >> light setting for 10 minutes >> } >> >> So what happens is during the day the light is turned on to 100% for ten >> minutes. >> After ten minutes the light is atomically turned off. >> If movement is detected prior to the ten minutes expiring the timer is >> reloaded again with ten minutes. > > Accoring to the docs, this isn't right. > > set_with_timer($state, $time, $return_state) > : Like set, but will return to $return_state after $time. > If $return_state is not specified, it toggles $state. > If $return_state is previous, it returns to the > previous state. > If set is called before the timer expires, the timer > will be unset. > > > See the last line? Tim, I believe that David's code is correct as he is not calling the set method, but the set_with_timer method. The set_with_timer method allows multiple calls, with each call simply overwriting the previous timer, if a previous timer is still active. The docs are correct in that a normal set will stop the timer from running, but this is not what is happening here. Matt __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com |