automate your home using node-red and heroku

published on 19 Nov 2020
written by pranav chakkarwar
4 min to read


this is an outdated solution, take a look at my practical approach to home automation.

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 brokers. 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!