Page 1 of 1

Turning a lamp off after a period of time

Posted: Fri Dec 19, 2003 9:57 am
by ScottBot
A common configuration need is to turn a lamp (or any device) off after a specified time out. For example, many times a motion detector will be used to trigger turning a lamp on. The lamp is then to remain on until a specified time has elapsed. If additional motion is detected while the lamp is on, the timeout timer should be reset.

While it would be easy to create a Task that turns the lamp on, waits for a specified time, and then turns the lamp off, it is not the recommended method. Using this method will not allow the timer/delay to be reset if more motion is detected while the timer is running. This is due to the fact that the Task is currently busy waiting and can not be executed again.

A common way to tackle this configuration is by using a Sleep Timer Device and two Tasks. Here’s a step-by-step describing the configuration.
  1. Create a Sleep Timer Device.
  2. Enable the Device
  3. Set the Sleep Time property to the amount of time that the lamp should remain on before switching off.
  4. Create a Task (Turns the lamp on and starts the timer)
    1. Enable it Task and set the Execution Mode to “When Conditions Are Met”.
    2. Add a condition to test for the motion detector. (Any condition can be tested.)
    3. Add an action to turn on the lamp.
    4. Add another action to change the value of the Sleep Timer Running Property to Yes.
  5. Create another Task (Turns the lamp off when the timer has expired)
  6. Enable it Task and set the Execution Mode to “When Conditions Are Met”.
  7. Add a condition to test the Sleep Timer Running Property to equal No.
  8. Add an action to turn the lamp Off.
A complete configuration sample that uses a dummy lamp Device can be downloaded from here. Install it into your HouseBot system by selecting File/Import Configuration from the HouseBot main menu. It includes a sample Theme that can be used to simulate tripping a motion detector to turn on a lamp.

Re: Turning a lamp off after a period of time

Posted: Fri Jan 23, 2009 1:58 am
by art
Hi Scott,

Just FYI the link in this post is broken. I don't need it just thought you might want to fix it for someone who might need it.

Re: Turning a lamp off after a period of time

Posted: Fri Jan 23, 2009 10:46 am
by ScottBot
Thanks for the info. I've updated the link to point to the correct location.