Crawl Space Automation

What is Crawl space Automation?

In my crawlspace, I have 3 fans all connected to the same extension cord which is powered by a smart plug. The automation I created will turn on the smart plug if certain outdoor humidity criteria are met and turn on/off if they are met.

This enables me to circulate the air and prevent stagnant humid air from causing damage in my crawlspace, it also allows me to avoid checking my weather app and manually turning on the fans.

What was the problem?

The crawlspace in my house was getting too humid and this was causing parts of the support structure to deteriorate faster than they should. A solution recommended by a professional was to install a series of fans in the crawlspace to increase circulation which in turn would help reduce the humidity in the crawlspace.

Instead of manually turning on/off the fans. I created a system that would automatically do the turning on/off for me based on external weather conditions.

What technologies were used?

  • OpenWeather API

  • JavaScript (ES6)

  • Google App Script

  • Google Sheets

  • Twilio Programmable SMS

  • IFTTT Webhooks

How did I execute?

Collected Data

To know when to turn on fans I need to know when the humidity in my crawlspace was the highest and when it was the lowest and what was causing it.

To find this out I put a Bluetooth-enabled humidity sensor in my crawlspace for 3 months to collect data on the crawlspace conditions. I then overlaid external weather data that I was able to fetch from OpenWeather’s API.

Through some analysis, I was able to find that the humidity inside my crawlspace was negatively correlated to the humidity of the outside. (See Below ↓)

This became the main criteria for when to turn on my fans. My thought was if I know when the external humidity is peaking I can turn on the fans to make sure the air is circulating as the humid air from the outside comes in and prevent the humidity from getting too high. Essentially, extending the humidity trough that you see on the blue line through until the next trough. (See Above ↑)

Event-Driven Data Collection

To control the fans I was using real-time data from OpenWeather’s API. I would make a GET request and then process the incoming JSON data. I would add the new data to historical data and then analyze it to determine if a peak in external humidity had been reached.

Connect to IFTTT Webhook

To have this script talk to the smart plug that was controlling the fan I created a webhook with IFTTT. This was an easy way to handle authorization that is needed to interact with the smart plug.


The last step was to visualize the results. I wrote a script that will show the last 5 days and the corresponding outdoor humidity and the number of hours that the fans ran. I created toggles that would allow me to view all the data or the last 2 or 5 days.

What did i learn?

How to do a GET Request

This was the first project that I ever made that interacted with APIs or Webhooks. Since this project, I have begun to lean heavily into using and even making my own APIs.