I use Node-Red and Mosquitto running on a Pi, with Blynk and Amazon Alexa plug-ins installed in Node-Red. I use the Blynk cloud server.
Why did I choose this method?
I was following @scargill Peter Scargill’s blog (https://tech.scargill.net) and at that point I haven’t decided on what my user interface would look like for my home automation projects. As an Apple user I thought it might be the Apple Home app, or possibly a HTML page.
I liked the simplicity of MQTT. For people who don’t know what MQTT is, think of it as being like having a series of ‘drop folders’ in Windows and dropping commands in there that will be executed when they’re picked-up. Multiple devices can monitor their own drop folder(s) and write messages into other folders for other devices if necessary.
I eventually tried Blynk and liked it’s simple yet powerful approach and the fact that I could integrate it with Node-Red.
Data from control widgets appears in Node-Red and logic can be applied to if before controlling a device with an MQTT message. Widgets can also be updated from Node-Red, changing their state, label text, colour etc.
Would I choose this approach again?
Yes.
For me, I like the fact that Blynk provides remote access to my home automation systems from anywhere in the world. But, digging-out your mobile phone or tablet isn’t always the easiest way to control things around the house, especially for non technical users. You could have a tablet mounted on the wall as a Blynk 24/7 control panel, but I prefer to use a Nextion touch screen instead, using the Blynk app or Alexa voice control when it suits me.
Blynk is fairly good at taking data from a variety of different systems and utilising it, but as an IOS user there are tools like Eventor missing from the toolbox that make some tasks more difficult. For me, automation using data from a variety of sources, and timed events, are easier to do in Node-Red than in Blynk.
Integrating Amazon Alexa is also easy in Node-Red, without the need to use Wemo simulation in the MCU code. By not using Wemo simulation you get more command types available, such as “Alexa, what is the Living Room Temperature”, which can be very handy.
Should everybody run Node-Red and Mosquitto?
Obviously not. I think it works well for home automation projects where you have multiple sensors and devices that you’re controlling and complex rules around how and when devices should respond to environmental data.
If you’re just looking for a simple garage door opener, or a way to control power sockets then a stand-alone Blynk system is by far the most sensible and efficient way to go.
It’s also easier to integrate Blynk with other home automation devices that also use MQTT, or where there is an MQTT bridge/gateway device available.
What are the drawbacks of this approach?
Obviously more hardware is involved, and you have to learn some Raspberry Pi stuff - which I find a bit of a pain!
There’s a learning curve with MQTT and Node-Red, but as Node-Red is a visual programming tool its’s quite easy to get started with basic flows. Writing your own functions is where the real power comes from, but the language isn’t that much different to C/C++ used in the Arduino IDE and there’s a large user base so plenty of examples are available on the interweb.
More hardware means more potential failure points, but being able to see the MQTT messages that are being passed around means that debugging can be simpler.
Overall, once you have a basic Wi-Fi/MQTT sketch template sorted-out it’s quite easy to add new devices or functionality to existing devices. Just to clarify, I don’t run any Blynk software on my MCU devices (usually Wemos D1 Minis), all of that is done in Node-Red. The up-side of that is that my void loop() can be as messy as I want, provided it doesn’t interfere with my MQTT client software
Edited to add…
Since writing this, I’ve created a topic about my home automation projects using Node-Red:
Pete.