Jump to content

Variable Doesn't Reset after Wait


Bob P.

Recommended Posts

This program turns on my humidifier when the humidity is above 63%, whch works fine. The problem is that it doesn't set my "Dehumidify" state variable back to zero, or turn off the dehumidifier after the wait time is over. I've experienced this with other similar programs using Wait functions as well. Does anyone know why this doesn't work?

 

post-5633-0-09958800-1414904694_thumb.png

 

 

Link to comment

The Program  changes the value of variable $Dehumidifier.  When the Wait is issued the Program is triggered because the variable has changed value except now the If is False driving the Else clause.  The statements after the Wait never execute.  If the change to the variable should not trigger the Program the variable should be an Integer rather than a State variable.

 

If the variable is an integer already the change in Humidity as the dehumidifier runs will also trigger the Program again.  The value of 1 in the variable will make the if False so the statements after the Wait will not execute.

 

A solution to both situations is have this Program invoke Program 2 which has the existing Then logic.  That way when Program 1 is triggered again and runs the Else it will not affect Program 2. 

 

EDIT: Wait and Repeat statements allow a Program to be triggered again when the conditions in the If have changed.  See this Wiki section which covers Wait and Repeat statements.

 

http://wiki.universal-devices.com/index.php?title=ISY-99i/ISY-26_INSTEON:Scope,_Precedence_and_Execution_Order

Link to comment

Thanks for the help, Lee.

 

It's a bit confusing, but I think I get it.

 

I rewrote with two programs to separate the "If" and "then" functions. I also changed my variable from a state to an integer.

 

Since I wanted the humidifier to keep running if it was still humid, and not cycle off and back on, I added a second wait after resetting my variable, but before turning off the dehumidifier. This seems to work the way I want it to.

 

 

 Here are my programs:

 

post-5633-0-28316100-1414952842_thumb.png

post-5633-0-32434000-1414952831_thumb.png

 

Thanks again,

 

Bob

Link to comment

Archived

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


×
×
  • Create New...