Create a Power Outage Alert with Node-RED

Learn how to set up a power outage alert using Node-RED and Amazon Alexa for smart home automation.

Posted by Jared Stone on May 01, 2025 · 5 mins read

Create a Power Outage Alert with Node-RED

Introduction

Imagine it’s a stormy night, and suddenly the lights go out. Whether it’s a brief flicker or a full blackout, you want to be informed, right? The good news is that with Node-RED, you can easily set up a power outage alert that uses Amazon Alexa to keep you in the know. In this post, we’ll walk through a step-by-step guide on how to create such a system. Not only will it give you peace of mind during outages, but it also adds another layer of automation to your smart home setup. Let’s dive in!

Step-by-Step Setup Guide

To set up your power outage alert using Node-RED, you’ll need a few tools and steps, but don’t worry; I’ll guide you through each one.

Prerequisites

  1. Raspberry Pi or any PC: Make sure you have Node-RED installed. If not, you can find instructions on the Node-RED website.
  2. Alexa-compatible device: For notifications, you’ll need an Amazon Alexa device.
  3. Node-RED Installations: Ensure you have the necessary Node-RED modules installed. Specifically, look for the node-red-contrib-alexa-notifyme package to send alerts to Alexa.

Step 1: Create a Flow in Node-RED

  1. Open your Node-RED editor by forwarding your browser to http://<your-local-ip>:1880.
  2. From the main workspace, drag and drop the following nodes:
    • Inject Node
    • Function Node
    • Alexa Notify Node

Step 2: Monitor the Power Status

  1. For this guide, we will simulate a power outage. In a real-world application, this may require a sensor or an additional module. You can use a Home Assistant setup for actual monitoring.
  2. Configure the Inject Node:
    • Set it to send a string (e.g., “Power is Out”) when triggered.

Step 3: Write a Function to Create a Message

  1. Click on the Function Node and add JavaScript code that formats the message you’d like Alexa to announce when the power goes out:

    msg.payload = { "msg": "Attention! The power is currently out!", "sessionId": "" }; return msg; </code>

  2. Make sure to fill in <unique-session-id> with something meaningful or randomly generated to ensure it’s distinct.

Step 4: Configure the Alexa Notify Node

  1. Drag the Alexa Notify Node to the workspace and connect it to the output of the Function Node.
  2. In the settings for the Alexa Notify Node, select your Alexa device which will announce the alert.

Step 5: Deploy Your Flow

Once everything is connected, click on the Deploy button in the top right corner to activate your flow. Now, trigger your Inject Node, and if configured correctly, your Alexa device should announce that the power is out!

Helpful Tip Block

  • Test Your Setup: After deploying, test your flow multiple times to ensure that it works as expected. Also, make sure your Alexa device is online to receive notifications.
  • Explore Additional Modules: Check out node-red flow examples for inspiration and additional functionalities that can enhance your project.
  • Keep it Local: For privacy reasons, consider utilizing node red alexa local configurations, which minimize data sent to the cloud.

Common Issues & Troubleshooting

  • No Announcement from Alexa: If Alexa isn’t announcing the notification, double-check that the Alexa Notify Node is properly configured and that your Alexa device is online.
  • Function Node Errors: If the function fails, ensure that your JavaScript code is error-free. Use the Node-RED debug feature to see logs and identify any issues.
  • Inject Node Not Triggering: Ensure the Inject Node is triggering as expected. You can check its status in the debug window of Node-RED.

Final Thoughts

Setting up a power outage alert with Node-RED is a simple yet effective way to stay informed during unexpected situations. This project not only enhances the intelligence of your smart home but also gives you actionable alerts that can help you manage crises with ease. Whether you’re a seasoned DIY smart home user or just dipping your toes into home automation, this guide is meant to boost your confidence with Amazon Alexa Node-RED projects!

Remember, the capabilities of Node-RED are nearly limitless, so let your creativity run wild! Experiment, add features, or even integrate other sensors to create a comprehensive home automation experience. Happy automating!