Objective
We got ourselves a Glade automatic air freshener for our bathroom. It can be set to spray every 9, 18, or 36 minutes. The manufacturer advertises that a single canister should last about two months if you use the longest interval. The freshener itself isn’t too pricey, but the refills? They cost more than refreshener, kind of like how printers are cheap but the ink costs a fortune. Of course I won’t go bankrupt because of them, but having to remember to get new refills every couple of months is a pain I often forget about. I also disliked a general inefficiency by spraying when no one was around.
With few mods and automation, the freshener now only triggers when when the toilet is flushed by adding a door sensor to the flush mechanism. This adjustment has greatly increased the lifespan of the canisters. Here are the details:
The company says a canister will last 60 days on a 36-minute spray interval.
Here’s the math: Daily sprays: 1440 minutes / 36 = 40 Sprays over two months: 40 x 60 = 2400
So, a canister runs out after 2400 sprays. But according to few months of poop statistics, the big flush button is used four times a day.
This means the canister’s lifespan has increased from two months to 600 days (2400 / 4), or 20 months — effectively tenfold.
Next up, I’m thinking of installing a sensor to detect volatile organic compounds (VOC) above the toilet, because VOC levels go up with heavy bathroom use. I already track VOCs in our living areas to keep an eye on air quality, but haven’t set it up in our bathrooms yet. This should make the system even more efficient, especially because not every bathroom visit is… you know, equally smelly.
Hardware Setup
The air freshener is a Glade automatic air freshener. The modifications included integrating an ESP8266 microcontroller with an ESP01 relay:
I also modded it to run directly from a 230V outlet instead of batteries, which furtherly reduces the maintenance.
The discovery that gave me the idea for mod was that disconnecting and reconnecting the power supply to the freshener causes an immediate spray, regardless of the interval setting. The ESP01 relay’s role is to normally keep the freshener unpowered. However, when a command from Home Assistant is received, it powers the device for just enough time for one initial spray before cutting the power again. This gave me control over air freshening via the Home Assistant.
Below you can see the modded air refresher with the ESP01 on the right side. It is connected to relay installed on the back and is not visible in the picture. On the left there is a DC-DC converter that adjusts the voltage to the same level as battery.
Additionally, a door sensor was installed in the large toilet flush button using a Mi Window and Door Sensor, allowing Home Assistant to detect flushes.
Integration into Home Assistant
The ESP01 module is flashed with ESPHome and communicates with Home Assistant through an API. The door sensor uses Zigbee and integrates with the Home Assistant using ZHA integration.
ESP config:
|
|
Automation Logic
The automation logic is straightforward: pressing the large toilet button changes the sensor status to “open”. Home Assistant then instructs the ESP01 to activate the relay for a few seconds, triggering the air freshener to release a burst of fragrance.
Screenshot of Home Assistant automation:
The potential for further automation includes additional refresh triggers, such as turning on the bathroom lights or upon returning home after an extended period.