Bathroom Humidity Fan

I converted a humidity controlled fan I used in ST to hubitat. it looks for a change in humidity and turns on the fan. You can set when it turns off to be byhumidity, set time, etc. I am using a IRIS Motion V3 to get the humidity. It also can set a timeout for how long to run the fan if it is manually turned on.

Use Hubitat package manager to install

Code found here:

The Old Smart Humidity Fan has been Deprecated, I will only be supporting the Bathroom Humidity Fan from here on.


Sorry, newbie question. I noticed that the App says it can turn on and off humidity but I can't seem to get the setting right for turning it off. Her's what I got. I'm trying to control and outlet that has a humidifier plugged into it using this app. The sensor is the Zooz 4 in 1 for reporting humidity and going to a GE indoor outlet.
Sensor is reporting humidity ok. What I would like it to do is turn on at 19% and off at 30%. Where can I do that?

If you look at the code it’s pretty specific to a humidistat sensing a rapid rise of humidity. It won’t work as is to control a humidifier.

1 Like


You can just use rule machine to accomplish the same thing. You’ll have to create 2 rules though, one for ON and one for OFF as setting a different humidity for OFF doesn’t appear to be an option currently.

1 Like

Ah…2 rules. That’s why this newbie didn’t get it to work.
Thank you.

One rule works great if every trigger is binary (is/is not X), but to have separate values of the same trigger, two rules are needed.

This is just rule machine, so if you get into webcore, you can create more complex routines in a single rule.

@napalmcsr could you give a little more detailed explanation of the settings in this application? I also have the AEON Multi V6 and I have it connected via USB so I get updates very frequently.

It looks at the humidity increase rate for the last 20 minutes of all the humidity events and if there is an increase of over the rate turns the fan on.
It will also turn the fan on if the humidity goes over the threshold.
It turns off X minutes after humidity drops, or goes under the threshold.
The other setting is how it should turn off if someone manually turns on the switch, manual off, set time, or after a humidity drop.
I got the original code from smart things forum years ago and did some debugging to make it work for me.
Does that help?

Yes, very much so, thanks

Let me know if you want changes or if something is wrong, I use just a portion of the functionality.

So far it seems to work as expected. I wasn't clear what the "humidity threshold" setting was for, but your explanation answered that.

I like the fact that it doesn't trigger soley on humidity level but rather on rapid increase :+1:. That was something I couldn't seem to figure out using RM rules alone.

Not sure if this an issue, I tried this out today again. Fan turned on as expected at about 1:30p but it doesn't appear to be shutting off automatically even though humidity level dropped?

EDIT: Okay, now the fan shutoff, perhaps I just don't understand how the app determines "off by humidity"?

Log excerpt:

app:18542018-05-30 14:44:45.498:infoHumidityHandler: FanSwitch.currentValue = on

app:18542018-05-30 14:44:45.489:infoHumidityHandler: ManualControlMode = After Set Time

app:18542018-05-30 14:44:45.488:infoHumidityHandler: state.AutomaticallyTurnedOn = false

app:18542018-05-30 14:44:45.487:infoHumidityHandler: humidity = false

app:18542018-05-30 14:44:45.486:debugstates date is true

app:18542018-05-30 14:44:45.485:debugstates date is true

app:18542018-05-30 14:44:45.477:debugIsHumidityPresent: states is true

app:18542018-05-30 14:44:45.476:debugIsHumidityPresent: humidity: 45

app:18542018-05-30 14:44:45.475:debugIsHumidityPresent: humidity: 44

app:18542018-05-30 14:44:45.473:debugIsHumidityPresent: numStates is 2

app:18542018-05-30 14:44:41.450:inforunning humidity check

app:18542018-05-30 14:44:41.158:infoHumidityHandler: FanSwitch.currentValue = on

app:18542018-05-30 14:44:41.151:infoHumidityHandler: ManualControlMode = After Set Time

app:18542018-05-30 14:44:41.150:infoHumidityHandler: state.AutomaticallyTurnedOn = false

app:18542018-05-30 14:44:41.150:infoHumidityHandler: humidity = false

app:18542018-05-30 14:44:41.149:debugstates date is true

app:18542018-05-30 14:44:41.148:debugstates date is true

app:18542018-05-30 14:44:41.147:debugIsHumidityPresent: states is true

app:18542018-05-30 14:44:41.146:debugIsHumidityPresent: humidity: 44

app:18542018-05-30 14:44:41.145:debugIsHumidityPresent: humidity: 45

app:18542018-05-30 14:44:41.144:debugIsHumidityPresent: numStates is 2

app:18542018-05-30 14:44:40.007:inforunning humidity check

app:18542018-05-30 14:44:38.644:infoHumidityHandler: FanSwitch.currentValue = on

app:18542018-05-30 14:44:38.301:infoHumidityHandler: ManualControlMode = After Set Time

app:18542018-05-30 14:44:38.300:infoHumidityHandler: state.AutomaticallyTurnedOn = false

app:18542018-05-30 14:44:38.300:infoHumidityHandler: humidity = false

app:18542018-05-30 14:44:38.298:debugstates date is true

app:18542018-05-30 14:44:38.288:debugstates date is true

app:18542018-05-30 14:44:38.270:debugIsHumidityPresent: states is true

app:18542018-05-30 14:44:38.269:debugIsHumidityPresent: humidity: 45

app:18542018-05-30 14:44:38.268:debugIsHumidityPresent: humidity: 44

app:18542018-05-30 14:44:38.267:debugIsHumidityPresent: numStates is 2

app:18542018-05-30 14:44:21.450:inforunning humidity check

app:18542018-05-30 14:37:49.048:infoHumidityHandler: FanSwitch.currentValue = on

app:18542018-05-30 14:37:49.040:infoHumidityHandler: ManualControlMode = After Set Time

app:18542018-05-30 14:37:49.040:infoHumidityHandler: state.AutomaticallyTurnedOn = false

app:18542018-05-30 14:37:49.039:infoHumidityHandler: humidity = false

app:18542018-05-30 14:37:49.038:debugstates date is true

app:18542018-05-30 14:37:49.037:debugstates date is true

app:18542018-05-30 14:37:49.037:debugIsHumidityPresent: states is true

app:18542018-05-30 14:37:49.036:debugIsHumidityPresent: humidity: 46

app:18542018-05-30 14:37:49.035:debugIsHumidityPresent: humidity: 45

app:18542018-05-30 14:37:49.034:debugIsHumidityPresent: numStates is 2

app:18542018-05-30 14:37:48.258:inforunning humidity check

app:18542018-05-30 14:37:47.100:infoHumidityHandler: FanSwitch.currentValue = on

app:18542018-05-30 14:37:46.996:infoHumidityHandler: ManualControlMode = After Set Time

app:18542018-05-30 14:37:46.996:infoHumidityHandler: state.AutomaticallyTurnedOn = false

app:18542018-05-30 14:37:46.995:infoHumidityHandler: humidity = false

app:18542018-05-30 14:37:46.994:debugstates date is true

app:18542018-05-30 14:37:46.993:debugstates date is true

app:18542018-05-30 14:37:46.983:debugIsHumidityPresent: states is true

app:18542018-05-30 14:37:46.981:debugIsHumidityPresent: humidity: 45

app:18542018-05-30 14:37:46.979:debugIsHumidityPresent: humidity: 46

app:18542018-05-30 14:37:46.969:debugIsHumidityPresent: numStates is 2

app:18542018-05-30 14:37:21.010:inforunning humidity check

app:18542018-05-30 14:37:15.735:infoHumidityHandler: FanSwitch.currentValue = on

app:18542018-05-30 14:37:15.721:infoHumidityHandler: ManualControlMode = After Set Time

app:18542018-05-30 14:37:15.720:infoHumidityHandler: state.AutomaticallyTurnedOn = false

app:18542018-05-30 14:37:15.719:infoHumidityHandler: humidity = false

app:18542018-05-30 14:37:15.718:debugstates date is true

app:18542018-05-30 14:37:15.710:debugstates date is true

app:18542018-05-30 14:37:15.706:debugIsHumidityPresent: states is true

app:18542018-05-30 14:37:15.705:debugIsHumidityPresent: humidity: 46

app:18542018-05-30 14:37:15.704:debugIsHumidityPresent: humidity: 45

app:18542018-05-30 14:37:15.702:debugIsHumidityPresent: numStates is 2

app:18542018-05-30 14:37:10.876:inforunning humidity check

app:18542018-05-30 14:30:07.531:infoHumidityHandler: FanSwitch.currentValue = on

app:18542018-05-30 14:30:07.397:infoHumidityHandler: ManualControlMode = After Set Time

app:18542018-05-30 14:30:07.396:infoHumidityHandler: state.AutomaticallyTurnedOn = false

app:18542018-05-30 14:30:07.395:infoHumidityHandler: humidity = false

app:18542018-05-30 14:30:07.394:debugstates date is true

app:18542018-05-30 14:30:07.386:debugstates date is true

app:18542018-05-30 14:30:07.349:debugIsHumidityPresent: states is true

app:18542018-05-30 14:30:07.348:debugIsHumidityPresent: humidity: 47

app:18542018-05-30 14:30:07.347:debugIsHumidityPresent: humidity: 46

app:18542018-05-30 14:30:07.345:debugIsHumidityPresent: numStates is 2

app:18542018-05-30 14:29:50.674:inforunning humidity check

When it automatically turns on, it automatically turns off after the humidity starts to decrease plus "Turn off how long after humidity begins to drop (minutes): *"

Based on my logs, it would seem it says the fan did NOT automatically turn on, which it did. Also, is the "begins to drop" supposed to be about the same percentage as the increase threshold?

Thanks again,

Line 76 is lying to the log about automatically turned on "HumidityHandler: state.AutomaticallyTurnedOn = ${state.AutomaticallyTurnedOn}"

would be the correct code, I updated GIT
I also added to line 100
log.debug "HumidityHandler:Turn Fan off in ${HumidityDropTimeout} minutes."

The begins to drop is 1%. My humidity never dropped faster than that.

1 Like

The update you posted resolved the log errors. However, my automations started to become very laggy and the UI of the hubitat became unresponsive while the app was installed. To confirm, I removed app and everything returned to normal. Not 100% sure the app is responsible.

It looks like from the log, the humidity handler is getting called a couple times a minute, are you getting that may humidity events? Mine is every 5min. I can see how that could cause several runin commands to be running in parallel, will have to think about how to guard against that.

Here is my execution this morning, I am only running every 5 min.

app:462018-05-31 06:46:12.364:debugHumidityHandler:Turn Fan off in 45 minutes.

app:462018-05-31 06:46:12.362:infoHumidityHandler: FanSwitch.currentValue = on

app:462018-05-31 06:46:12.359:infoHumidityHandler: ManualControlMode = After Set Time

app:462018-05-31 06:46:12.358:infoHumidityHandler: state.AutomaticallyTurnedOn = true

app:462018-05-31 06:46:12.357:infoHumidityHandler: humidity = false

app:462018-05-31 06:46:12.356:debugIsHumidityPresent: returning false

app:462018-05-31 06:46:12.354:debugIsHumidityPresent: states date is true

app:462018-05-31 06:46:12.353:debugIsHumidityPresent: states date is true

app:462018-05-31 06:46:12.352:debugIsHumidityPresent: states date is true

app:462018-05-31 06:46:12.351:debugIsHumidityPresent: states is true

app:462018-05-31 06:46:12.351:debugIsHumidityPresent: humidity: 49

app:462018-05-31 06:46:12.350:debugIsHumidityPresent: humidity: 48

app:462018-05-31 06:46:12.349:debugIsHumidityPresent: humidity: 46

app:462018-05-31 06:46:12.348:debugIsHumidityPresent: numStates is 3

app:462018-05-31 06:46:12.270:infoHumidityHandler:running humidity check

app:462018-05-31 06:41:12.418:infoHumidityHandler: FanSwitch.currentValue = on

app:462018-05-31 06:41:12.415:infoHumidityHandler: ManualControlMode = After Set Time

app:462018-05-31 06:41:12.414:infoHumidityHandler: state.AutomaticallyTurnedOn = true

app:462018-05-31 06:41:12.413:infoHumidityHandler: humidity = true

app:462018-05-31 06:41:12.412:debugIsHumidityPresent: humidity rate above incrate

app:462018-05-31 06:41:12.411:debugIsHumidityPresent: states date is true

app:462018-05-31 06:41:12.410:debugIsHumidityPresent: states date is true

app:462018-05-31 06:41:12.409:debugIsHumidityPresent: states date is true

app:462018-05-31 06:41:12.408:debugIsHumidityPresent: states is true

app:462018-05-31 06:41:12.407:debugIsHumidityPresent: humidity: 47

app:462018-05-31 06:41:12.406:debugIsHumidityPresent: humidity: 49

app:462018-05-31 06:41:12.406:debugIsHumidityPresent: humidity: 48

app:462018-05-31 06:41:12.404:debugIsHumidityPresent: numStates is 3

app:462018-05-31 06:41:12.289:infoHumidityHandler:running humidity check

app:462018-05-31 06:36:12.372:infoHumidityHandler: FanSwitch.currentValue = on

app:462018-05-31 06:36:12.369:infoHumidityHandler: ManualControlMode = After Set Time

app:462018-05-31 06:36:12.368:infoHumidityHandler: state.AutomaticallyTurnedOn = true

app:462018-05-31 06:36:12.367:infoHumidityHandler: humidity = true

app:462018-05-31 06:36:12.366:debugIsHumidityPresent: humidity rate above incrate

app:462018-05-31 06:36:12.365:debugIsHumidityPresent: states date is true

app:462018-05-31 06:36:12.364:debugIsHumidityPresent: states date is true

app:462018-05-31 06:36:12.363:debugIsHumidityPresent: states is true

app:462018-05-31 06:36:12.362:debugIsHumidityPresent: humidity: 46

app:462018-05-31 06:36:12.362:debugIsHumidityPresent: humidity: 47

app:462018-05-31 06:36:12.361:debugIsHumidityPresent: humidity: 49

app:462018-05-31 06:36:12.360:debugIsHumidityPresent: numStates is 3

app:462018-05-31 06:36:12.280:infoHumidityHandler:running humidity check

app:462018-05-31 06:31:12.425:infoHumidityHandler: FanSwitch.currentValue = on

app:462018-05-31 06:31:12.421:infoHumidityHandler: ManualControlMode = After Set Time

app:462018-05-31 06:31:12.421:infoHumidityHandler: state.AutomaticallyTurnedOn = true

app:462018-05-31 06:31:12.420:infoHumidityHandler: humidity = true

app:462018-05-31 06:31:12.419:debugIsHumidityPresent: returning true

app:462018-05-31 06:31:12.418:debugIsHumidityPresent: states date is true

app:462018-05-31 06:31:12.417:debugIsHumidityPresent: states date is true

app:462018-05-31 06:31:12.416:debugIsHumidityPresent: states is true

app:462018-05-31 06:31:12.415:debugIsHumidityPresent: humidity: 46

app:462018-05-31 06:31:12.414:debugIsHumidityPresent: humidity: 47

app:462018-05-31 06:31:12.413:debugIsHumidityPresent: numStates is 2

app:462018-05-31 06:31:12.296:infoHumidityHandler:running humidity check

app:462018-05-31 06:26:12.422:infoHumidityHandler: FanSwitch.currentValue = on

app:462018-05-31 06:26:12.419:infoHumidityHandler: ManualControlMode = After Set Time

app:462018-05-31 06:26:12.418:infoHumidityHandler: state.AutomaticallyTurnedOn = true

app:462018-05-31 06:26:12.417:infoHumidityHandler: humidity = true

app:462018-05-31 06:26:12.416:debugIsHumidityPresent: returning true

app:462018-05-31 06:26:12.415:debugIsHumidityPresent: states date is true

app:462018-05-31 06:26:12.414:debugIsHumidityPresent: states date is true

app:462018-05-31 06:26:12.413:debugIsHumidityPresent: states is true

app:462018-05-31 06:26:12.412:debugIsHumidityPresent: humidity: 45

app:462018-05-31 06:26:12.411:debugIsHumidityPresent: humidity: 46

app:462018-05-31 06:26:12.410:debugIsHumidityPresent: numStates is 2

app:462018-05-31 06:26:12.298:infoHumidityHandler:running humidity check

app:462018-05-31 06:21:12.424:infoHumidityHandler: FanSwitch.currentValue = on

app:462018-05-31 06:21:12.420:infoHumidityHandler: ManualControlMode = After Set Time

app:462018-05-31 06:21:12.419:infoHumidityHandler: state.AutomaticallyTurnedOn = true

app:462018-05-31 06:21:12.418:infoHumidityHandler: humidity = true

app:462018-05-31 06:21:12.418:debugIsHumidityPresent: humidity rate above incrate

app:462018-05-31 06:21:12.417:debugIsHumidityPresent: states date is true

app:462018-05-31 06:21:12.416:debugIsHumidityPresent: states date is true

app:462018-05-31 06:21:12.415:debugIsHumidityPresent: states is true

app:462018-05-31 06:21:12.414:debugIsHumidityPresent: humidity: 43

app:462018-05-31 06:21:12.413:debugIsHumidityPresent: humidity: 45

app:462018-05-31 06:21:12.412:debugIsHumidityPresent: numStates is 2

app:462018-05-31 06:21:12.305:infoHumidityHandler:running humidity check

app:462018-05-31 06:16:12.463:infoFanSwitchHandler::Switch changed

app:462018-05-31 06:16:12.428:debugHumidityHandler:Fan On

app:462018-05-31 06:16:12.427:infoHumidityHandler: FanSwitch.currentValue = off

app:462018-05-31 06:16:12.423:infoHumidityHandler: ManualControlMode = After Set Time

app:462018-05-31 06:16:12.422:infoHumidityHandler: state.AutomaticallyTurnedOn = false

app:462018-05-31 06:16:12.422:infoHumidityHandler: humidity = true

app:462018-05-31 06:16:12.421:debugIsHumidityPresent: humidity rate above incrate

app:462018-05-31 06:16:12.419:debugIsHumidityPresent: states date is true

app:462018-05-31 06:16:12.418:debugIsHumidityPresent: states date is true

app:462018-05-31 06:16:12.417:debugIsHumidityPresent: states is true

app:462018-05-31 06:16:12.417:debugIsHumidityPresent: humidity: 39

app:462018-05-31 06:16:12.416:debugIsHumidityPresent: humidity: 43

app:462018-05-31 06:16:12.415:debugIsHumidityPresent: numStates is 2

I have my Aeotec sensor running off USB so I figured that having it report more frequently would be a good thing for responsiveness. I can decrease the report frequency if you think this is actually unnecessary.

Edit: I'm actually using "selective reporting" as recommended by Aeotec when powered via USB so that it sends a report when humidity changes by more than 1 percent. I can disable that and just have it report on a basis of time intervals, but again I thought having it report more frequently would be good for having the fan activate more quickly in response to change.