Hi I am Mike and I am a Nerd !!!
Home automation is something that I have been playing with for quite sometime and combining my other skill areas such as communications and Internet I felt that getting in to Internet Of Things was a perfect move. When I started using Node-RED
I was familiar with old style programming and I kept looking for functions such as if, then etc. Node-RED can perform these functions but does it in a very different way. The Node-RED code that I used to produce was ‘ugly’ and not flexible and trying to debug although enjoyable was a challenge. Overtime I have learnt to improve the code and become more organised and the purpose of this tutorial is to demonstrate what I have learnt.


Key concepts

  • Devices you wish to control should be decoupled from Node-Red using a broker via MQTT.
  • Code should be produced in sections / tabs and linked creating clarity to your code.
  • If your code looks messy you are likely doing it wrong !!
  • Try and run the same code on all your IOT devices – I use Tasmota.


  • A Raspberry Pi
  • Node-Red running on the Pi3
  • Tasmota
  • Mosquitto also running on the Pi3
  • Echo dot AND Google home
  • Broadlink Mini
  • Sonoff devices
  • Arduino Compiler and programmer
  • Good WiFi – preferably a mesh.
  • External MQTT server
  • Time and patience.
  • Low cost
  What we want our systems to do will vary by household however for me I want
  • Voice control
  • Voice and email notifications
  • Control TV, audio system, lights and appliances.
  • Create a security system monitoring doors and movement.
  • Lets get building
  I will assume you have a Pi3 already built and using a debian image (raspbian is fine). Install Node-Red and Mosquitto This can usually be done using
apt-get install mosquitto mosquitto-clients
To install Node-RED on a Pi3, it is best to use the pre-prepared script available via
bash <(curl -sL https://raw.githubusercontent.com/node-red/raspbian-deb-package/master/resources/update-nodejs-and-nodered)
There are many guides already available on installing this software so I will assume you already have these running.