Jump to content

Checking for on/off for a length of time?


Eug

Recommended Posts

Another thing that doesn't seem obvious as I move from HomeSeer to ISY, but I assume it's there and I'm just not finding it.

 

In an "if" clause in a program, how do I check for a device having been on or off for a specific time? For example, if the bathroom fan is on, and the bathroom light has been off for five minutes, I want to turn the fan off.

Link to comment

It's your favorite Wait command :)

 

If
       Control 'Bathroom' is switched Off
   And Control 'Bathroom' is not switched On

Then
       Wait  5 minutes 
       Set 'Bathroom Fan' Off

Else
  - No Actions - (To add one, press 'Action')

 

By using the not switched On condition the program will be stopped is someone re-enters the room.

 

Rand

Link to comment

There's something very unintuitive about that, but I'll try it. But just to try to understand... when the program is triggered initially by the light being switched off, and it goes into the five-minute wait, does the light being switched back on (causing the "and" clause to be false) actually abort the program already in progress (in the wait)?

Link to comment

Yes it does cancel immediately. It will set the program to False and run the Else statements (in this case there are none, so it just quits).

 

There's something very unintuitive about that, but I'll try it. But just to try to understand... when the program is triggered initially by the light being switched off, and it goes into the five-minute wait, does the light being switched back on (causing the "and" clause to be false) actually abort the program already in progress (in the wait)?
Link to comment

Just to clarify,

Two simple programs would accomplish the same thing. After you write the first...

 

Fan Off:

If
       Control 'Bathroom' is switched Off

Then
       Wait  5 minutes 
       Set 'Bathroom Fan' Off

Else
  - No Actions - (To add one, press 'Action')

 

You will write the second program after a few uses:

 

Cancel Fan Off:

If
       Control 'Bathroom' is switched On

Then
       Stop program 'Fan Off'

Else
  - No Actions - (To add one, press 'Action')

 

The original example cantates the two by using the negative of the second program to negate the first program.

 

Just so to save you a step :)

 

I wondered that a lot when I started too, I hope this helps explain it.

 

Rand

Link to comment
No kidding? And a few of these running at once won't cause a problem?

 

Until you run out of RAM. If the ISY allows you to save the programs the programs are running.

 

Why does "control" work but not "status"? I'd like it to work regardless of whether the button turns it on or something else.

 

Status should work but it will take a change before the program triggers. The ISY has to be a member of the scene to see the changes.

 

Rand

Link to comment

Hmmm... meaning if ISY helped create the scene and/or triggers the scene then STATUS should work just as well as CONTROL?

 

What I did to get around it was to add and/or statements for each device in the scene:

If 
       Control 'Up.Bath' is switched Off 
   And Control 'Up.Bath' is not switched On 
   OR  Control 'Up.Bath.Sink' is switched Off 
   And Control 'Up.Bath.Sink' is not switched On 
   OR  Control 'Up.Bath.Bath' is switched Off 
   And Control 'Up.Bath.Bath' is not switched On   
Then 
       Wait  5 minutes 
       Set 'Up.Bath.Lights' Off 

Else 
  - No Actions - (To add one, press 'Action')

 

The three light switches are all part of the 'Up.Bath.Lights' scene, so it does what I'd hope: if any of them are switched on, start the timer. Still, there are other ways to turn the light on, so I'd prefer it just watch for it turning on ANY way - such as if the ISY does it.

 

You're saying that SHOULD work with STATUS instead of CONTROL but "will take a change before the program triggers". What do you mean? Any change? Like a control / switch turning it off or on? One that the ISY is aware of should have the same effect, right? It doesn't seem to.

Link to comment

STATUS will work fine, and is actually what I prefer because I have scenes that also turn lights/vents on. For example, a double-tap of my bathroom switch turns the lights and vents on. If I use STATUS, it doesn't matter how that light/vent is turned on - the timeout will work (which is what I want).

 

Here is what I use for one of my vents:

 

If
       Status  'Bathroom1stVent1' is not Off

Then
       Wait  30 minutes 
       Set 'Bathroom1stVent1' Off

Else
  - No Actions - (To add one, press 'Action')

 

Straightforward, and works fine.

 

Using the WAIT is a bit unintuitive, but once you understand how the ISY constantly evaluates conditions it makes more sense. The vent goes on, the WAIT command starts. If someone turns the vent off in the meantime, the IF condition is no longer true and the program stops running.

Link to comment

Archived

This topic is now archived and is closed to further replies.


×
×
  • Create New...