Thought I'd start a conversation about choosing a good, sustainable architecture to run Node-RED alongside HomeAssistant. This is a popular combination specifically for Home Automation, and for good reason. There seem to be many different options and considerations, which I've started to list below, and I would appreciate your input.
My main focus is on being able to restore in the event of an outage. Specifically I am always minded of running my home on a system that would fall flat on its face if I suffered injury or death - subjects that don't usually come up in forums like this. See this excellent blog / video on the topic by Jonathan Oxer (Superhouse.tv).
TL;DR - skip to the list at the end!
Why HomeAssistant? Right now I have pretty much everything working in Node-RED from multiple light dimming and scene control in each room to electric blankets, multi-room audio, heating, CCTV, and touchscreen control panels. Whilst I've found Node-RED fantastic as a standalone home automation system, there are some weaknesses with NR on its own as an automation system. It's not targeted towards home automation. Node-RED is so flexible, and this is an asset. But HomeAssistant can do a lot of the "heavy lifting"; storing state, grouping items, automatically discovering items, and more. Secondly I've found some of the nodes are not perfect. In most cases, I have been extremely impressed by how quickly Node-RED has let me just play and get stuff working quickly - but not in all cases!
Let me illustrate the above 2 points. I use Squeezebox extensively for multi-room audio. The SB plugin for Node-RED has left me scratching my head for hours. At first it's simple to send control messages to players, but then it's very difficult to get track name and artist back. Then I did a test install of HomeAssistant. Not only did it automatically find my Squeezebox server on the network, but also it showed me immediately what was playing in each room, completely with a nice graphic of the cover art, and the ability to send text to speech to a given player built right into the UI. This would have taken more than 4-5 hours - and a lot of additional coding than what's already available - to get working in Node-RED.
So, onto my musings / questions about architecture.
-
Server architecture. I am personally not convinced about the Raspberry Pi. It's great for tinkering but for those who need something more sustainable and resilient, we need a server with RAID, dual power supplies, etc. Probably a virtual server that could be rebuilt in 10 or even 15 years, with backups and updates in the meantime. For me personally this means Hyper-V running either Linux, Win Server, or both. For me it means backing up on a VM level to a local NAS. I'm a Win Server guy, I socialise with similar people, and I feel most comfortable in that world. Someone told me to give up Hyper-V and use Proxmox. I tested this but wasn't too impressed. Would like to hear more thoughts. Any good ideas or suggestions here?
-
How to install HomeAssistant and Node-RED together. This is where the options are too many:
- Node-RED and HomeAssistant both in the same Linux VM?
- Or in different Linux VMs?
- Node-RED and HomeAssistant in a Docker VM. Is this a way to create a templated installation? I don't really understand Docker yet.
- Node-RED running as a "plugin" for HomeAssistant using "The NotoriousBDG addon". This is suggested by popular YouTubers like DrZzs in this vid. I haven't tested this, but I feel there may be some conflicts, and a third party plugin creates an unnecessary dependency.
- What about installing Node-RED as per the documentation, Alternative install methods and HomeAssistant using its own documentation, then hooking them together with node-red-contrib-home-assistant? This seems like the most "native" way to do it. This obviously requires both to be set to run at startup.
- Actually I opted for this slightly different install method (this youtube vid) - nice clear instructions also including configuring Node-RED as a system service with systemctl. However I found that when I install the node-red-contrib-home-assistant I get "Install failed, check the log file". When I tried to check the log file, I read that logs are only output to console. There are alternative methods but I couldn't really determine what these were from the docs.
- Should HomeAssistant be run in a Python3 virtual environment, what are the benefits?
-
What about backing up? My default preference for backing anything and everything up is to take full VM backups of a machine from the Hyper-V server, using e.g. Windows Server Backup. I realise I'm probably not speaking the same language as many who read this! But it's incredibly stable and test restores work perfectly.
- I read about Node-RED Projects, and I was specifically interested in the phrase on that page "create a redistributable Node-RED application". What exactly does this mean? It sounds very impressive to be able to essentially back your Node-RED up to GitHub - is that correct? If you could put yourself in the shoes of a user who may not be familiar with GitHub (I am familiar, but I'm thinking about compiling systems for others to maintain), is this a good sustainable plan? Is it the kind of thing that could be documented clearly for a non-developer to implement a restore?
- What about @scargill's "Scargill's Node RED script"? Does this go some way to addressing some of the questions above?
- As well as backing up the whole infrastructure (for server failure), what about really clean ways of backing up settings (for user error)? Previously I ran openHAB on Windows, and the entire openHAB directory was stored on Dropbox, sync'd to the server, and so any changes made to configuration files were continuously backed up to the cloud that way. This is my personal favourite way of working. Is there a way to implement this with some elegance or simplicity in Linux, and with Node-RED and HomeAssistant?
Finally I'm interested in all architecture decisions. For example, one suggestion might be "no, don't mess around with HomeAssistant, life will be more simple if you just use Node-RED on its own"!
Any other points I've missed on this topic?