By Jason Snell
February 14, 2020 10:07 AM PT
Drying out a moldy bedroom – a HomeKit adventure
My house gets damp in the winter. Like, really damp. So damp that stuff starts growing on the ceiling. Since getting a new house isn’t really an option, I’m left with mitigating it as best I can.
So I tried to use smart-home tech to make it better.
It started when I had a HVAC guy out to the house for an unrelated issue, and asked him what made the most sense to combat the winter dampness in the house. Given the particular characteristics of my house, he suggested that I buy dehumidifiers and run them in the winter. The mold-removal guy agreed with that and added that maybe adding a ceiling fan in our bedroom would help too.
I had a small dehumidifier I bought a while ago, but it didn’t make a dent. What’s worse, if you cut the power to it while it was running and then plugged it back in, it would stay off. That’s a no-no if you’re hoping to make an appliance smarter by attaching it to a smart outlet, which I was. So I bought a bigger dehumidifier that retains its power state across outages. This winter I finally bought a ceiling fan for the bedroom, one with built-in HomeKit support.
With this setup, I was able to create simple automations in the Home app that would turn on the fan and dehumidifier every morning and run them until the evening. It worked, but I was a little dissatisfied. Right now we’ve gone a few weeks without any rain and it’s not particularly humid in the house, so running the dehumidifier seems wasteful. I wanted something smarter.
The answer was to get a HomeKit-compatible humidity sensor and put it in my bedroom. It turns out, I already have a sensor relaying humidity and temperature data to the Internet—it’s the console of my home weather station. Getting that data into something actionable proved to be trickier than I planned.
Let’s try complicated automations!
My first attempt to solve this problem involved building a complicated home automation, using the Home app. You may not realize this, but Apple offers a Shortcuts-style interface for building complex home automations within the Home app. Because home-automation tasks execute in the background on an Apple TV, iPad, or HomePod in your house, they don’t have access to all the rich commands that full Shortcuts do, but they can still be pretty intelligent.
My Mac mini server generates a text file of raw Weather Station data that’s useful for a few applications—I have one wired to a LaMetric Time that displays the time and outside temperature in my living room. I built a home automation that loaded that file via the web, parsed it for the internal stats, and then fired off an action based on the humidity (or, in the summer, temperature) in the bedroom.
My web server didn’t have an SSL certificate and Apple’s home automation shortcuts won’t load pages that aren’t loaded via https. Good grief. A few days of detour into installing certbot later, my local web server was now secure and I could proceed with the project.
I did finally get this to work, and last summer I built a simple automation that would fire off at 2pm, check to see the temperature in the bedroom, and if it was too hot, turn on the ceiling fan. Not a bad proof of concept.
Unfortunately, I ran smack into more home automation limitations. What this function really demands is the ability to fire off an automation on a regular basis—say, every 15 minutes—and turn things on and off depending on the current weather data. Shortcuts just won’t do that. (Consider this an iOS 14 wish-list item.) There’s also no way to duplicate an automation or copy the steps out of it, so if I wanted to build 10 copies of the automation, set to trigger every hour on the hour… it would take a very long time.
Let’s try fake HomeKit sensors!
Another idea presented itself. John Voorhees wrote about the Home+ app at MacStories. It’s an app that attempts to be a better version of Apple’s Home app. But more than that, it has access to additional home automation options that are part of the HomeKit APIs but not exposed in Apple’s app. (Let’s pause for a moment at how ridiculous that is.)
The automation type that caught my eye in Home+ is the ability to set a trigger based on when a sensor crosses a threshold. That’s perfect for an application like this: When the humidity gets above 45 percent in the back bedroom, turn on the dehumidifier and fan. When it gets below 40 percent, turn it off. Just what I wanted.
Here’s the catch: This approach doesn’t work with parsed URLs from my web server—it only works with actual sensors reporting data into HomeKit. Fortunately, there are so many smart sensors out there that aren’t HomeKit compatible but do offer web interfaces that someone wrote a plugin for HomeBridge that parses the contents of a web page and turns it into a virtual HomeKit sensor. In fact, they wrote two, one for humidity and one for temperature.1
Victory of a sort
With these sensors set up, I was able to use Home+ to build a new automation that runs during the daytime and activates my dehumidifier and fan when the bedroom is humid, and turns it off when it isn’t. I’d like to declare victory, but the truth is that these automations still seem unreliable. Sometimes they work, sometimes they don’t—and since HomeKit basically offers no real way to debug things, I have no idea what is going on.
Unless I can get this working reliability, I may try another path to see if I can get what I want. Using that HomeBridge switch plugin might be an option. Another one is to leverage the fact that my dehumidifier can be set to turn itself off when the humidity falls below a certain point, and it’s connected to a smart switch that reports the current amount of energy being drawn by whatever is plugged into it. I’ve toyed with the idea of setting up an automation that runs the ceiling fan only when the dehumidifier is pulling a lot of energy.
In other words, it’s Yet Another Home Automation Story: This stuff is cool, and fun, and interesting, and doesn’t work nearly as well as it should. My home is so stuffed full of sensors, computers, and Wi-Fi-enabled devices that I should get a project like this to work reliability with minimal effort. But that’s just not the case—at least not yet.
At least there’s nothing growing on the ceiling of my bedroom at the moment. A small victory.
- One method I didn’t try is to use an additional HomeBridge plugin to create a virtual switch that flips on or off based on sensor data. It’s easy to set up HomeKit automations that trigger when a switch is flipped. Cool hack. ↩
If you appreciate articles like this one, support us by becoming a Six Colors subscriber. Subscribers get access to an exclusive podcast, members-only stories, and a special community.