From: Mark T. <ma...@th...> - 2005-12-06 18:10:36
|
Thomas Harding wrote: > if (state_now $motion eq ON) { > if ((state $motion_unit) eq 'hall') { > if ((state $hall_flag) eq OFF) { > if ((time_greater_than '03:05 AM') and > (time_less_than '04:30 AM')) { > run_voice_cmd "good morning"; > set $hall_flag ON; > } > } > } > } This can be simplified a bit (no need for nested if's) if ( state_now $motion eq ON and state $motion_unit eq 'hall' and state $hall_flag eq OFF and time_greater_than '03:05 AM' and time_less_than '04:30 AM' ) { run_voice_cmd "good morning"; set $hall_flag ON; }; -- Mark. |