[APP] Smarter Humidity Fan *FORK for Testing*

Some background: I have been testing out both of the commonly used Bath Fan automating apps. Both I felt were missing a feature that the other had so I was torn. This app from Ernie, Smarter Humidity Fan (SHF), uses a true RATE of change (with math and stuff), the other app just uses a simple delta since the last report (called Excessive Change Threshold in SHF). But I then felt SHF was lacking the option to use a second sensor for a baseline to determine the minimum of the smart range due to massive swings in base humidity where I live. SHF has a much better code base, more organized and easier to follow, so the one I chose to modify.

I did not want to blow the original author up with people having issues without testing this first, so I invite anyone to test it with me before I submit a PR. Then I may submit a PR or possibly post a new separate version.

Main Changes:

  • Added optional comparison sensor mode to set the Minimum Smart Range
  • Added toggle for the automatic child device (on by default) - WARNING if you turn this off it will delete the child device.
  • Added option for Excessive Change to honor the Smart Range
  • Added more detail to some of the debug logging to help test
  • Changed the namespace so it can be identified in the code list if you install both

Updated Code on gist for now, while testing. Can replace the original app code or install as a new app.

Original App Post: [RELEASE] Smarter Humidity Fan
Original Source Code: hubitat/smarter-humidity-fan.groovy at main · ernie/hubitat · GitHub

@erniemiller Giving the OK: [RELEASE] Smarter Humidity Fan - #67 by erniemiller


I've been using "bathroom humidity fan". Can you explain what you mean by a true rate of change with maths and stuff? Just curious about how that's different.

The Bathroom Humidity Fan (BHF) app uses a delta since the last report, as in just the difference in rate. If the last report was an hour ago, and it reports now and changes by 5% the "rate" (not really a rate) is being called 5%. This could possibly trigger an automation. If it was an actual rate it would be change / time.

SHF however records the last report and time, then takes the delta of both and does the rate change / time change. This gives you a true rate. So 1hrs * 60mins = 60 total mins. 5% / 60Mins = Rate of 0.083 %/min. This is very unlikely to trigger an automation on its own.

BUT if you do have a lazy sensor that sometimes does not report very often you can set the Excessive change threshold in SHF, which defaults to 5%, so you can force the app to trigger in this case if you need to (either all the time or only if it is in the smart range with my new setting).

I actually was using BHF before also, because of the comparison sensor feature, but due to the rate not really being a rate I was getting false triggers if I set it too low, and if I set it to high it would not trigger at all sometimes. I looked at changing it to be a true rate but lets just say the coding style in that app looked like it was making it way more complicated than it needed to be and scared me away.

Okay, that makes total sense. I also started using BHF after trying a couple of different apps for the comparison to another sensor feature. I use @bptworld's averaging app to get an average humidity for the house and compare the humidity in the bathroom to that. Your description tells me why I sometimes seem to have it trigger when I normally wouldn't expect it to.

Unfortunately, my averaging app is broken and the new code is in bundle manager and not HPM. So I need to set aside a little time when I can sort that out, but when I do I'll test your fork of SHF.

@jtp10181 Jeff, I've felt exactly the same way. I like SHF better, but the fact that it lacks a humidity reference point makes it difficult to keep optimized as the seasons change (at least here in the midwest where it goes from freezing cold to burning hit).

So I love you idea in principle. If you want, I'll install the app, and beta test?

Edit: one nerdly, painfully semantical clarification: I'm guessing the smart range offset is denominated in "percentage points" rather than "%", correct? For example, 50% rh is 25% more humid than 40% rh or you could say it's 10 p.pts. higher. I suppose you mean the latter even though the UI says the former.

Midwesterner here also, same struggles. Yes I posted it for more long term testing. Good point about the label I will need to re word that so it is clear.

UPDATED: I think this simple switch of the % to be before Offset makes more sense, saying it is an Offset to the Minimum %.



Just got the Zen30 installed in the bathroom. First question; How do you set this up for two different rooms?

Install the code once, but from the "add user app" menu add two instances of it.

Oh... I didn't realize you could add the same app more than once.

Next question... what is the virtual device used for? Is it needed to make things work?

Did you see the built in instructions which can be expanded? Maybe it is not explained good enough. Virtual device was automatically created in the original app but I don't use it so I made it optional. When the fan is being automatically controlled the virtual switch turns on. You can use that in other automations if you want to know when the fan is being controlled. Personally, I just use the switch on/off status of the fan itself because I don't care how its being controlled but if someone has the fan on I don't want the lights to go off on them!

1 Like

The fan is turning on and off every couple of minutes. Though, it seems like it should be based on the settings. The house average humidity is 58% and in the bathroom it's been fluctuating between about 62% - 70%. I'm at work, so I'm not really sure why the bathroom humidity is so high. Maybe my wife took a shower earlier and it normally stays high for a while. Don't know. But I'm using the default fan behavior settings, so the fan would come on above 65% percent regardless.

But I think there maybe needs to be an option of "Run for X minutes after re-entering smart range" or something like that to maybe prevent it from cycling like that. I'd probably set it to run for an additional 10 minutes before turning the fan off.

Also, side question, do you know of an easy way to record the humidity over time to easily see how it changes?

Did you see the built in instructions which can be expanded?

I just saw the fan behavior instructions, but now that you point it out, I see the device instructions at the top. I don't think I have a use case for the virtual device.

If your house is around 58% already you may need to raise the max to 70% or more.
Also, you might want to check that your bath fan exhaust has flaps on the exterior vent? It almost seems like external air is coming back in to keep raising the humidity? Unless someone, like you said took a shower, and then maybe even shut the door or something.

But yeah, I could probably add a setting for a minimum runtime when turned on, so hopefully it will get it dropped down low enough so it wont cycle.

I just saw this earlier today, looks pretty easy to setup.

Or you go the full blown awesome way and setup a database and Granfana


There's also Hubigraphs (no longer maintained, but still works) Or, something like Splunk.

@jtp10181 Jeff I’ve been messing with this for a little while. I think it’s super. Combines the best of the two previous versions of exhaust fan automation logic.

On the list of nice-to-have’s: parent/child structure to make multiple instances easier. Beyond that, I encourage you to go the PR route unless you have other ideas.

Thanks again for this. Awesome work.

1 Like

This just got released, looks good for basic charts.

@jtp10181 Jeff, two thoughts on this:

  1. The fork has been around long enough now, and a few of us have put it through its paces, I wonder if we should merge it back, or add to HPM as Y/A SHF app?

  2. I’ve been playing with Dew Point recently (couple good threads around these parts). I’m not a developer but I’ve been thinking about whether Td would be a better metric than RH since, strictly speaking, it measures the point at which H2O condensates. Not sure though. Thoughts?

All that said …. appreciate this app, exactly as it is.

Point taken on releasing. I think I will create a separate app since there is decent interest and other people have more ideas for upgrades. I just don't want it to turn into the other app that is so complex I could barley figure out how to configure it.

The dew point probably would be most accurate, it is related to humidity and temperature which most sensors have both. I would assume most bathrooms would be around the same temp though? Not sure how much 5F +/- would change the dewpoint, I would have to do some math and make a little chart.

If done right I wonder if you could just have it be almost totally automatic based on the dew point and maybe an offset setting. Once you get it to the point where water wont condensate anymore you could turn the fan off.

You make a great point about Dew. While theoretically better, my guess is that it won’t actually make a difference in exhaust behavior. But I haven’t done the math either.

Is one side indoor temp and the other outdoor temp?