Hello, new Hubitat friends! I just purchased a few Zooz ZSE40 4-in-1 sensors, and have been playing around trying to use them to automate my bathroom exhaust fans based on their detected relative humidity levels. I found the Smart Humidity Fan port from SmartThings, but it wasn't quite working well for me -- I don't know if it was the fact that I live in Southwest Florida, where homes tend to be a bit higher in baseline humidity, or something else, but that led me to open its code with the intent to tinker around.
Once I did that, I decided to throw that code away and write something from the ground up for Hubitat. Naturally, I called it "Smarter Humidity Fan".
It works a bit differently than Smart Humidity Fan does, and is very much tailored to my own use case. That being said, I hope someone here finds it useful, too!
Looks like a lot of thought went into this. Good job!
One question......If the fan is manually turned on, but the smart threshold is not reached, will the auto-off check still turn the fan off? I can foresee situations where we manually turn the fan on, but the threshold is not reached, we forget to turn it off and the fan continues to run.
I've released v1.1.0, which simplifies setup a bit. Smart mode now just requires you to define your own range over which it engages -- the bottom should be higher (but only a little) than typical humidity, and any increase over the configured sensitivity within that range will trigger the fan until it drops back below that range, or the auto-off timer kicks in. Updated the screenshot in the first post.
Released v1.2.0, which adds an "excessive change threshold" to turn on the fan on the first report in a long while, if it exceeds a certain increase.
For those who saw my other post, I've gone all-in on the Aqara Temp/Humidity sensors, which I'm loving. I've only found two downsides:
They tend to be less chatty about their status than the Zooz sensors, in certain cases.
The more current driver, from Markus, doesn't allow for the option to send humidity events even if the humidity hasn't changed from a previous report, and "helpfully" even avoids sending events when it does change, if the change is small enough.
These two things conspire to sometimes yield a very long period between updates, which plays havoc with calculations of change rate based on a more reasonable reporting frequency. I considered a number of workarounds for this, but the one I felt would be the simplest for the user to understand is to simply trigger on a sufficiently-large increase regardless of how the math would indicate the change rate since last report to work out.
Hey Ernie,
I just installed your Smarter Humidity Fan app. Looks like exactly what I need and saves me writing my own RM code. Just a question on the absolute maximum humidity setting. When I set this to less than the current humidity reading (ie. Current humidity is 62% and I set smart max to 60%) should the fan be running? My fan has not turned on with this 60% maximum setting in the app parameters.
Steve
If the humidity is at that level on the sensor's next checkin, then yes, it should. Making the adjustment won't cause the fan to kick on, as smart fan control engages based on the humidity checkins from the sensor.
I you're sure there's been a checkin, then please send your logs my way and I'll have a look!
For reference, here's the relevant part of the code, which should hopefully be somewhat readable even if you don't write groovy, yourself
if (changeRate >= sensitivity) {
logDebug "Sensitivity criteria met. Humidity $change at $changeRate%/min."
sensitivityTriggered = true
}
if (state.smart) {
if (
state.humidityChange < 0 &&
currentHumidity < minHumidity
) {
logInfo "Humidity dropped to bottom of smart range ($minHumidity%)."
fanOff()
} else {
logDebug "Humidity still above $minHumidity%. No action taken."
}
} else { // State is not (yet) smart
if (
sensitivityTriggered &&
state.humidityChange > 0 &&
currentHumidity > minHumidity
) {
logInfo "Humidity passed $minHumidity% at $changeRate%/min."
fanOn()
} else if (
excessiveChange > 0 &&
state.humidityChange >= excessiveChange
) {
logInfo "Change of $state.humidityChange% exceeds configured " +
"excessive change threshold of $excessiveChange%."
fanOn()
} else if (currentHumidity > maxHumidity) {
logInfo "Humidity exceeded $maxHumidity%."
fanOn()
} else {
logDebug "Humidity change within defined thresholds. No action taken."
}
}
}