[RELEASE] Smarter Humidity Fan

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". :joy:

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!

20 Likes

For this alone you deserve kudos. :wink: I've seen others trying to automate this using rules, etc. Hopefully they'll find this and find it useful!

2 Likes

Hahah, thank you! I hope it helps someone, too.

1 Like

Really well done!

2 Likes

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.

1 Like

It will! Hitting the smart threshold will reset the timer to the point at which it was hit (by design), but otherwise it works as you would expect.

1 Like

Can this be installed with the Hubitat Package Manager app?

1 Like

I've been having some issues with the port so I will check this out

1 Like

I've submitted the PR for that earlier today. As soon as it's merged it will be.

5 Likes

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.

1 Like

Just following up to say this is now available on HPM!

2 Likes

Thank you! This is exactly what I needed to keep my bathroom humidity in check ( with three daughters).

1 Like

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:

  1. They tend to be less chatty about their status than the Zooz sensors, in certain cases.
  2. 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.

Hope this is useful!

2 Likes

@erniemiller.... I have used this app for a couple of days now and it works great. No problems or issues. Thanks!

So glad to hear this!!

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

Hey @steve007,

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 :smiley:

  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."
    }
  }
}

Thanks Ernie, all good now. The RH refreshed and the fan kicked on. Great app, thanks for sharing.

2 Likes

Glad it’s working for you!

1 Like

Loving the app, but the update has confused me, my fan comes on bit doesn't seem to go off. I'm assuming I have my settings wrong