Just replying to my own thread for the possible benefit of others who may be considering a similar script.
I found a minor typo in Jay's suggested script; The line that says
- Code: Select all
indigo.devices.turnOn(54321, duration=1200) # Insert ID of exhaust fan
needed to be changed to
- Code: Select all
indigo.device.turnOn(54321, duration=1200) # Insert ID of exhaust fan
Note the absence of the "s" in indigo.device....
After making that change I realized that there was actually no reason to have the fan run for 20 minutes each time the logic triggered it. Since the action fires whenever the bathroom humidity sensor reports a change I could just put a smaller run-time in (I settled on 5 minutes). If the humidity hasn't yet come down enough (but is still changing) the trigger fires again.
Tried this out today by purposely not turning the fan on when I showered. Sure enough a few minutes into the shower the fan kicked on. It stayed running until some time after the differential returned to a satisfactory range.
Some may be wondering why I wanted to do this. I live in central FL and mold/mildew is a constant threat. I wanted to be sure that bathroom exhaust fans ran whenever somebody showered to keep humidity low not just in the bathroom but in the whole house.