guy Posted October 28, 2008 Posted October 28, 2008 Is there a way to check for how long a device was on before it was switched off? This will be useful in the following scenario: Turn on bathroom fan when bathroom light is turned off if the light was on for at least a minute or so. Thanks
Algorithm Posted October 28, 2008 Posted October 28, 2008 Hi Guy, Is there a way to check for how long a device was on before it was switched off? There is presently no way to do this. Timers (which can be started, stopped, and read under user control) have been requested along with variables (and I'm hopeful they may make their appearance at about the same time). This will be useful in the following scenario: Turn on bathroom fan when bathroom light is turned off if the light was on for at least a minute or so. As a work-around to address this scenario, you could try: Program 'Bath Light On Time' If Status 'Bath Light' is not Off Then Wait 1 minute Run Program 'Bath Light Time Flag' (Then Path) Else - No Actions - (To add one, press 'Action') When the bathroom light has been on your required amount of time, a flag is set. If the light is switched off before that amount of time, the program stops and the flag does not get set. Program 'Bath Light Time Flag' If - No Conditions - (To add one, press 'Schedule' or 'Condition') Then - No Actions - (To add one, press 'Action') Else - No Actions - (To add one, press 'Action') This program serves as a flag. Program 'Bath Fan Timer' If Control 'Bath Light' is switched Off And Program 'Bath Light Time Flag' is True Then Set 'Bath Fan' On Wait 5 minutes Set 'Bath Fan' Off Run Program 'Bath Light Time Flag' (Else Path) Else - No Actions - (To add one, press 'Action') When the bathroom light is switched off, if the flag is true, this program turns on the fan for a specified amount of time, then turns the fan off, and finally it resets the flag in preparation for the next time.
Algorithm Posted October 29, 2008 Posted October 29, 2008 Thanks Darrell, works like a charm. My pleasure. I'm glad that it fits your needs.
Recommended Posts