Home Automation Using Node-Red and Heroku

Published on 19 Nov 2020
Written by Pranav Chakkarwar
4 min to read


This is an outdated and infeasible solution for home automation. Take a look at my better approach

Home, Office, Industrial Automation, and control using Node-Red, Heroku, MQTT, Raspberry Pi, other edge IoT devices (like esp8266, Arduino, etc.)

Advantages of Using This Solution

  1. It is an open-source solution (So you are the one in control of the critical internal data, not a multi-national conglomerate).

  2. The dashboard is available over the internet but password protected. For more security, we can use a free OpenVPN server (in the cloud or on our Raspberry Pi)

  3. It’s free, so why NOT!!! (Except you need to pay for the hardware lol)

  4. Your Node JS app will never sleep.

Features

  1. Access the Control center from anywhere in the world.

  2. Control will be transferred locally to the Raspberry Pi (ex - in case of internet failure)

  3. Easily change automation rules or rewire controls with instant deployment.

  4. Automation rules can get as complex as you like.

  5. It is effortless to integrate third-party APIs like the OpenWeatherMap.

  6. AND MUCH MORE TO EXPLORE.

Requirements

Hardware

  1. Edge IoT devices (I am using esp-01 for demonstration)

  2. Raspberry Pi for local control and override rules (Note: The Raspberry Pi control center can also be accessed remotely on demand)

  3. Relay boards or Custom PCB boards

  4. And other devices like CCTV’s (optional)

Other Requirements

  1. App platform to deploy the project (I am using Heroku)

  2. MQTT provider (I am using Hive Public MQTT Broker for testing purposes) Not recommended for final deployments

Initial Setup and Deployment

Final Setup

  1. Deploy the app to Heroku using the git deployment method (choose the forked repo)

  2. Once the app build is completed, you can access the node-red editor at the /admin path.

  3. Gather information and learn to use Node-Red.

  4. Next we will install the dashboard and core nodes.

  5. Setup the MQTT connections in Node-Red and click deploy in Node-Red.

  6. Your Control Center/Dashboard will be accessible at yourappname.herokuapp.com

  7. Flash the hardware (in this case esp8266) with MQTTclient program.

  8. Test the connection.

  9. NOTE that the app is deployed internally in Heroku and will not persist across app failures or reboots. (Read helpful notes for a solution to this problem)

Helpful Notes

For any suggestions or queries feel free to send me a message. Now go DIY!



That's it!

I hope you enjoyed this article, as there are - No ads. No trackers. No paywall. No shilling. No affiliate links. No baised opinions. I put a lot of thought into each article, but I'm not perfect. Feedback is always appreciated.

Explore other articles
Contact me
Hire me
Subscribe