Automatically Controlling a Dehumidifier with a Nest

1*x3HLXF4_Eq1CyWxpeyp-Dw.jpeg

On the desk I have a Nest. For those that don’t know, the Nest is a “smart” thermostat. Along with being able to do Thermostat things smartly, it can also detect humidity.

Wouldn’t it be cool if, when the Nest detects that the humidity has risen past a certain threshold, the dehumidifier is turned on and is turned off again when it goes below the threshold? Of course it would be…

Graphs are awesome too, so let’s throw a graph in there, showing outside temperature, inside temperature and humidity.

To get started, you’re going to need a few things:

IFTTT Setup

I created two recipes; one to turn on the dehumidifer and one to…well…turn off the dehumidifer.

The recipes are simple. They use the Maker channel and the Wemo switch channel.

The Maker channel basically exposes a URL that we can trigger by sending POST or GET requests too.

Installing Recipes

Off Recipe

  • Visit here
  • Set Event Name to low_humidity
  • Select your Dehumidifier’s Wemo Switch
  • Click Add

On Recipe

  • Visit here
  • Set Event Name to high_humidity
  • Select your Dehumidifier’s Wemo Switch
  • Click Add

Maker URL’s

You need to get your Maker URL. You can get this by:

  • Visiting here
  • Click “How to Trigger Events”

Now copy that URL. It should look something like:

https://maker.ifttt.com/trigger/{event}/with/key/XXXXXX

Next, we need to create two URL’s. One with low_humidity event and one with high_humidity. You should now have:

https://maker.ifttt.com/trigger/low_humidity/with/key/XXXXXX
https://maker.ifttt.com/trigger/high_humidity/with/key/XXXXXX

Deploy To Heroku

  • Go to this Github repo
  • Click the magic Deploy To Heroku button

Almost there, just two more things. Heroku should now ask you for some environment variables.

  • Nest email address
  • Nest password
  • IFTTT turn on URL (high_humidity event)
  • IFTTT turn off URL (low_humidity event)
  • Humidity threshold
  • Forecast IO API Key

Last but not least you need to setup the Heroku Scheduler.

When viewing your application in Heroku, there should be a “Heroku Scheduler” addon. Click it. Add a job to run rake collect_reading every 10 minutes. It should look something like this.

1*Ue-kbT-f1s9IRgh90UF66g.png

Result!

You should now have a webpage.

To test everything out, you can go to your application settings in Heroku and change the HUMIDITY_THRESHOLD config variable to something really low. When the scheduler next runs your dehumidifer should turn on!

Now if I could only automate emptying the dehumidifer…