So I am trying to automate my humidifier solenoid control with a z-wave relay module. The solenoid will be energized/de-energized based on a comparison of the average indoor relative humidity (RH_Avg) and a setpoint generated in another script (RH_SP). If the average indoor relative humidity is less than the desired setpoint, then the demand to turn on the solenoid (Humid_Demand) is set to True, otherwise it is False. This would seem a relatively simple if/then/else statement, but i think I may have a syntax issue. I am trying to run it as an embedded script that runs periodically (on a schedule) or I may consider setting it up based on a trigger at some point (for example when the furnace kicks on). Right now I am just trying to get it to evaluate correctly, but testing shows that it does not. Each time the script runs, all it does is flip the state of Humid_Demand from True to False or vice-versa (toggles back and forth). This doesn't make sense since I know the expression can only evaluate to one state and the variables (RH_Avg and RH_SP) are not changing. Obviously this won't work for controlling the solenoid valve.
Any ideas or suggestions as to what I am doing wrong would be appreciated.
- Code: Select all
RH_Avg = indigo.variables[83180808] # "Humid_Avg_Indoor"
RH_SP = indigo.variables[370832338] # "Humidity_SP"
if RH_Avg < RH_SP:
indigo.variable.updateValue(indigo.variables[91486408], unicode(True)) # "Humid_Demand" set to True
else:
indigo.variable.updateValue(indigo.variables[91486408], unicode(False)) # "Humid_Demand" reset to False