How to Set Up Node-RED for Off-Peak Charging

Learn how to automate off-peak charging using Node-RED for smart energy savings.

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

How to Set Up Node-RED for Off-Peak Charging

In today’s energy-conscious world, saving on electricity bills while contributing to a greener environment is more important than ever. One way to do this is by leveraging your smart home setup for off-peak charging. Whether it’s your electric vehicle, battery storage system, or other devices, utilizing off-peak hours can maximize your savings. And the best part? You don’t have to be a coding expert to get started! With tools like Node-RED, you can create a smart system that automates this process seamlessly. So let’s explore how to set up Node-RED for off-peak charging, step-by-step!

Step-by-step setup guide

Step 1: Install Node-RED

If you haven’t already installed Node-RED, it’s a straightforward process. You can install it on a Raspberry Pi, a local server, or even your PC. Here’s how to do it on a Raspberry Pi:

  1. Open your terminal.
  2. Type in the command: bash <(curl -sL https://raw.githubusercontent.com/node-red/Node-RED/master/install.sh)
  3. Once installed, you can start Node-RED by running: node-red-start

Step 2: Set up the Node-RED interface

  1. Open a web browser and go to http://localhost:1880 or http://your-ip-address:1880 if you’re accessing it from another device.
  2. You should see the Node-RED flow editor interface. Familiarize yourself with the palette on the left side.

Step 3: Create a basic flow for off-peak charging

  1. Add a time input node: Drag the Time Range node from the node palette onto the workspace.
    • This will define your off-peak hours. You can enter the time range when electricity rates are lower.
  2. Configuring the Time Range node:
    • Double-click on the node to configure it. Set your desired start and end times for off-peak hours.
  3. Add a Switch node: Drag a Switch node from the palette and connect it to the Time Range node output.
    • This will determine whether to send a signal based on the current time.
  4. Connect your device node: Depending on your device (like an EV charger), you might need to add a corresponding node (for example, an MQTT node if you’re communicating with a smart plug).
    • Configure this node accordingly to control charging.
  5. Wire the nodes: Connect the nodes so that the Time Range node connects to the Switch node, and the Switch node connects to your device node.

Step 4: Test your flow

After you’ve configured your basic flow, it’s time to test it out!

  1. Make sure Node-RED is running.
  2. Manually trigger the flow outside of the defined time to check the response.
  3. Check the debug panel to see if everything is working as it should.

Optional: Integrate with Alexa

If you’re already using voice commands to control your home setup, consider linking your Node-RED with Amazon Alexa. By using node red alexa, you can control your devices using simple voice commands.

To set this up:

  1. Install the necessary Alexa skill for Node-RED.
  2. Create a flow that responds to Alexa commands to start or stop off-peak charging.

Helpful Tip Block

Tip: Always check your electricity provider’s guidelines to ensure you’re aware of off-peak hours. You might also want to consider setting up notifications or reminders using Node-RED to alert you when it’s time to start charging.

Common Issues & Troubleshooting

Issue 1: Node-RED doesn’t start

  • Solution: Make sure all your dependencies are updated. You can update Node-RED using the following command: npm update -g node-red

Issue 2: Flows not executing as expected

  • Solution: Verify connections between nodes. Use the debug node to output messages at various points to see where the flow may be breaking.

Issue 3: Alexa does not respond

  • Solution: Check your Alexa integration. Ensure that the skill is enabled in the Alexa app and that your Node-RED setup is correctly configured.

Final thoughts

Setting up Node-RED for off-peak charging is an excellent way to optimize your energy consumption and reduce costs. It harnesses the power of automation and smart home technology to create an intuitive and energy-efficient system. As you get more comfortable with creating flows, you can expand your setup by adding additional features, such as remote control via your smartphone or integration with other smart devices.

Don’t forget to explore the wide variety of node-red flow examples available online to inspire your next project! Happy automating!