Jump to content

Question on a timer program


thedishking

Recommended Posts

Posted

Hello,

 

I am sorry if this question has been asked in the past. I have not found an answer, so I thought I'd post for all to see.

 

I would like to setup a timer for my bathroom fan, to turn the fan off, after the light has been off for 10 minutes.

 

I understand I can use light turning off as a trigger, and then wait 10 minutes and turn fan off.

 

However, this leads to problems when multiple people are coming and going.

 

In other words, if I turn the light off, this is the trigger, and the timer starts counting down.

 

If someone comes in to the bathroom 7 minutes later, the fan will then turn off in 3 minutes.

 

I would like to avoid this, as I want to keep the fan on, until the light has been off (and stayed off) for 10 minutes.

 

Does anyone have any advice?

 

Thanks!!!

Posted

if 
   status bathroom light is off

then
  wait 10 minutes
  set bathroom fan off

else

 

 

If the light is turned back on during the wait, status changes and the wait is canceled.

 

Should do exactly what you want.

 

-Xathros

Posted

Unspoken regarding this suggestion is that programs with "wait" statements will be interrupted should an initial condition (such as "status") change. So...when the light is turned off, then back on, this will halt the execution of the program, starting it again when the light is turned off the second time.

 

In some cases, this can be undesireable. In this case, however, it is a nice capability.

Guest
This topic is now closed to further replies.

×
×
  • Create New...