Jump to content

how to query- for how long a device was in prevous state.


guy

Recommended Posts

Posted

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

Posted

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.

Guest
This topic is now closed to further replies.

  • Recently Browsing

    • No registered users viewing this page.
  • Who's Online (See full list)

  • Forum Statistics

    • Total Topics
      37.2k
    • Total Posts
      372.4k
×
×
  • Create New...