Build a Temperature and Humidity Monitor with Alexa Alerts

Learn to build a temperature and humidity monitor with Alexa alerts for your smart home in this step-by-step guide.

Posted by Nina Alvarez on April 23, 2025 · 5 mins read

Build a Temperature and Humidity Monitor with Alexa Alerts

Introduction

Have you ever wished you could receive alerts about the temperature and humidity in your home without having to check a weather app or a physical thermometer? With the power of smart home technology, specifically using Node-RED, you can create a temperature and humidity monitor that integrates with Amazon Alexa and notifies you when the climate conditions change. Whether you’re a seasoned DIYer or just starting your smart home journey, this project is fun, educational, and surprisingly easy to execute!

Let’s dive right into how you can set up this smart home project and start receiving alerts directly through your Alexa-enabled devices.

Step-by-Step Setup Guide

What You’ll Need:

  1. A Raspberry Pi or any computer running Node-RED
  2. DHT11 or DHT22 temperature and humidity sensor
  3. Jumper wires
  4. Breadboard (optional)
  5. Node-RED installed (check Node-RED for installation instructions)
  6. An Amazon Alexa device
  7. Node-Red Alexa module (You’ll need to install the module from here)

Step 1: Setting Up the Sensor

  1. Connect your DHT sensor to your Raspberry Pi:
    • Connect the VCC pin to a 3.3V or 5V GPIO.
    • Connect the GND pin to the Ground GPIO.
    • Connect the Data pin to a GPIO pin you will reference in Node-RED.

    If you’re using a breadboard, plug the sensor into it for easier connections.

Step 2: Setting Up Node-RED

  1. Start Node-RED by entering http://localhost:1880 in your web browser.
  2. Install the required Node-Red nodes:
    • Open the Node-RED menu, navigate to “Manage palette,” and search for nodes related to DHT sensors and Alexa integration.
    • Install the node-red-contrib-dht and node-red-contrib-alexa-home-skill modules for ease of sensor data handling and Alexa integration.
  3. Create your first flow:
    • Drag the DHT node onto your workspace and configure it with the GPIO pin to which the sensor is connected.
    • Use a debug node to check if you’re receiving temperature and humidity data.

Step 3: Send Alerts via Alexa

  1. Create a flow to handle alerts:
    • Add a function node to decide when conditions are met (for example, if temperature exceeds a certain threshold).
    • Use a switch node to route the message based on the conditions (for instance, temperature above 30°C).
    • Finally, connect an Alexa announcement node (available in your installed Alexa module) to send an announcement.

    Here’s a simple function to get you started:

    if (msg.payload.temperature > 30) { msg.payload = "Alert! Temperature is above 30 degrees!"; return msg; } return null;

Step 4: Deploy Your Node-RED Flow

  1. Click the red “Deploy” button on the top right of the Node-RED interface to save and run your flow.
  2. Test your setup by adjusting the temperature within your setup or simulating higher readings.

Helpful Tip Block

  • Ask Alexa for the current conditions: After setting this up, you can ask your Alexa device, “Alexa, what’s the temperature?” You can also use custom commands if you’ve set up Alexa routines.
  • Secure your DHT sensor: Ensure that your sensor is kept in an area where environmental readings are not affected by direct sunlight or drafts.
  • Check Node-RED flow examples: Visit node-red flow examples for inspiration on additional smart home automations.

Common Issues & Troubleshooting

  • Not receiving notifications: Double-check your Node-RED configuration and ensure all nodes are connected properly. Test the function node with different conditions.
  • Sensor data is inconsistent: Ensure you have a stable connection to the GPIO pins. Also, confirm that the sensor is not exposed to conditions affecting its readings (like cold drafts).
  • Alexas not responding to announcements: Check if your Alexa is connected to the same network as your Node-RED server. Ensure you’ve enabled the skill necessary for Node-RED to communicate with your Alexa device.

Final Thoughts

Congratulations, you’ve created a functional temperature and humidity monitor that alerts you through Amazon Alexa! This project not only enhances your smart home but also gives you a taste of how powerful automations can be with Node-RED. You can build upon this project, adding more sensors, creating complex logic or even integrating other smart devices.

Remember, the DIY smart home journey is all about experimentation and learning. Don’t hesitate to tweak your flows and explore more capabilities of Node-RED involving Alexa, such as Node-Red Alexa commands or routines. Happy building!