How to make WiFi-enabled smart humidifier from a regular one

So there was a simple air humidifier… Actually this post is a good example on how to make your regular boring home appliance little smarter. The main part of my humidifier will be the Wemos (or Lolin) D1 mini board based on ESP8266 WiFi chip.

My air humidifier has no automatic turn on and off, no timers, only a regulator that also works like switch. The idea is to make it a WiFi friendly and work with Home Assistant through MQTT.

Actually I was pretty lucky with this device because there is another models of it with built in sensor, screen and other stuff so the hardware was prepared to connect additional modules. But we don’t want to measure humidity inside humidifier right? So the sensor will be a separate part of system.


What’s inside

So it has an AC/DC power supply. Now we need to find 5v power line for our additions. All internal parts are powered with 12V DC so we need a step down module. In my case there was an empty 12V connector right on the factory board:


So we will connect there a regulated power down module and set it up to a 5V output:

Now the main hardware. It is a Wemos D1 Mini ESP8266 based board (well almost because in my case it is a no-name copy of it, don’t buy it please) and a beautiful relay brick from Itead Studio:

Connect it all together. Wemos D1 mini can be powered with stable 5V DC power connected to its 5V pin:

Now we need to unsolder the wires from a factory button or switch and connect it to our relay:

The last step will be a gluing all new parts inside our device. Don’t repeat my mistake and glue WiFi board with microUSB port pointing outside of humidifier, not inside it:

The code

Here is a sketch of my smart humidifier:


  • Connects to WiFi
  • Connects to MQTT broker
  • Reconnects after disconnection
  • Sends its state after success MQTT connection. Topic: edwin/humidifier/state,
  • payload: on or off
  • Subscribes to command topic: edwin/humidifier/power, payload: 1 or 0
  • Change relay state according to MQTT commands
  • Sends its state after every relay state change

Home Assistant

Now we need to add our new device to Home Assistant. It will be an MQTT platform switch:

  – platform: mqtt
    name: "Humidifier"
    state_topic: "edwin/humidifier/state"
    command_topic: "edwin/humidifier/power"
    state_on: "on"
    state_off: "off"
    payload_on: "1"
    payload_off: "0"

Leave a Reply

Your email address will not be published. Required fields are marked *