Why pay the premium for smart devices???

Code and schematics soon on Github once polished.

We all know how important it is for our health to control the humidity in the house. That’s why I wanted to get a dehumidifier (my area never suffer from too low humidity). But going to the store I realised that the smart version of the exact same model was 40-50% more expensive! That’s insane. Adrenaline quickly kicked in and I imagined that by simply using HestiaPi and a Sonoff smart plug I could have a simple on/off control with humidity setpoints.

So a few minutes after I went home I ended up with this:

Sonoff smart plug controlling my shy dehumidifier

My dehumidifier has this feature called “Resume after power failure” which means that if the power is cut while it is on, reconnecting power will make it start too. If power was cut while it was off, reconnecting power will do nothing. So as long as I control it exclusively from Sonoff I start and stop it as needed.

So there you have… My dumb dehumidifier is now semi-smart (without the price tag)! By the way MQTT over WiFi is used for communication.

This setup worked for a few months with no problems but I realised these points I had to address on my V2 iteration:

  • Pressing the button on the actual dehumidifier will get HestiaPi and the dehumidifier out of sync keeping it always off regardless of what I tell it to do
  • If I (erm, my wife) wanted to move it around and “forgot” to move it with the plug – bye bye smart dehumidifier
  • The buzzer of the water tank being full is too loud
  • The loud buzzer is still not loud enough if I am downstairs and the dehumidifier is upstairs at the bedrooms

My idea was to fit something inside the dehumidifier that would register the presses on the touch panel for power and also detect the full tank indicator.

So my beloved ESP8266 came again to the rescue!

My task list:

  • Connect easily to my WiFi > CHECK
  • Fit inside the dehumidifier > Easy
  • Read “Power” LED for staying in sync
  • Read “Full tank” LED for alerting
  • Read touch event from power button > Skipped as reading the “Power” LED would be enough
  • Mimic touch event on power button

Reading the LEDs would be easy. It is easy! Use a photoresistor (LDR – light depending resistor) and read the analog value in an analog pin on ESP. So I quickly hot-glued 2 LDR on the 2 LEDs I wanted…

LDR hot-glued to read the illumination of 2 LEDs

…and went ahead to connect them to A0 and A….1? Where is A1?

ESP8266 supports only 1 analog pin!

ESP3266 supports more exotic features but my relationship so far with 3266 hasn’t been great. Bugs and minimal support of well-known packages are just a few.

So I was stuck with 8266. I had to make it work. I had lying around a board for LDR that output a digital signal 1/0 – preset with a pot, so quickly I used D1, adjust the pot to not read neighbour LED and I had both LED register correctly on my ESP and log over USB-to-serial to my computer.

While I was at it, I hot-glued that piezo buzzer to reduce A LOT that beep. I felt really good doing so 🙂

Next and last task, mimic the touch event.

The touch button had a spring like coil below the plastic panel that would detect capacitance change. Apparently if you short this contact to ground and disconnect, you get a touch event. To avoid ground loops and other unpleasant situations involving smoke, I used an optocoupler to completely isolate my circuit with the dehumidifier. That’s it below lying on its back. Yellow is the ground. The soldered pin is the coil contact. The other 2 pins are to go to 3.3V via that (10K?) resistor and the furthest to D0 for signal.

My optocoupler lying on its back

Insulating everything from electricity and stray light rays I added my favourite 3.3V isolated regulated power supplies from Hi-Link.

Some last debugging and loading the NO_DEBUG version of my code before closing
Tie wrap to look posh
All that space for me!

My dehumidifier had a very large empty partition at the top like it knew I would need it! Being at the top doubles as the furthest away place from that WiFi-blocking metal compressor!

Connect mains, and WiFiManager starts in 2 seconds your UI to configure your WiFi details:

Apart from your SSID, password and HestiaPi’s static IP enter these:

Subscribe topic:
hestia/local/stat/humiditystate
Publish topic:
hestia/local/cmnd/humiditystate/POWER

Using the items, rules and sitemap from our Github add these:

custom.items

Number HumiTank "Water Tank" { mqtt="<[mosquitto:hestia/local/stat/humiditystate/tank:state:default]" }
String HumiTankText "Water Tank [%s]" <alarm>

custom.rules

The state “Empty” or “FULL” are colour coded – #becauseIcan

rule "DehumidifierTank"
when
  Item HumiTank changed
then
  logInfo("Default","HumiTank changed");
  if (HumiTank.state == 0) {
    HumiTankText.postUpdate("Empty")
    logInfo("Default","HumiTank empty");
  } else {
    HumiTankText.postUpdate("FULL")
    sendNotification("myopenhab-account-email-here", "Dehumidifier water tank is full!")
    logInfo("Default","HumiTank full!");
  }
end

default.sitemap

Add the last line on the existing block like this:

  Frame label="Humidity" {
    Switch item=HumiMode mappings=[ "ON"="ON", "OFF"="OFF"/*, "Schedule"="SCHEDULE"*/, "Boost"="BOOST"]
    Text item=MyHumiProxy
    Setpoint item=HumiBoostTime minValue=10 maxValue=120 step=10 icon="clock"
    Setpoint item=HumiSetpoint minValue=0 maxValue=100 step=5 icon="humidity"
    Text item=HumiTankText  valuecolor=[HumiTank==1="red", HumiTank==0="green"]
  }

And you end up like this:

So to recap… all 4 points that need to be addressed are solved and I get notifications of full tank on my phone so that I can decide if I want to act upon or not wake up at all in the middle of the night because my phone is on silent.

Beat that [CONSUMER_BRAND_HERE] smart dehumidifier!

Code and schematics soon on Github once polished.

We have put a “coming soon” page for our crowdfunding campaign page here where you can leave your email to be notified when it starts! The page gets continuously updated with new stuff so this is a “quiet” announcement. When it is ready (Feb 2019) we will shout!