Bare minimal configuration with Raspberry Pi

Hi HA developers and users!

First, great product! I use it every day and have been using it for 2+ years. I know my use case is very special hence doesn’t apply to everyone, but I just want to share my two cents.


tl;dr my bare minimal configuration contains many tweaks; I only need HA for its frontend; I stripped down HA to a bare minimal.


HA provides very good automation facilities, but my fear of putting HA in the centre of my home automation is that if HA fails, my entire system fails.

My goal is to create a home automation environment that

  • works 24/7
  • works without the internet (or mandatory cloud)
  • doesn’t need taking care of
  • doesn’t need frequent code change (once a month is OK)
  • degrades gracefully (i.e. if one component fails, other will still work)
My current solution is an MQTT bus (mqtt + TLS) with microservice architecture.

I have zigbee2mqtt running on another computer. I have also written other gateways such as bluetooth2mqtt (handles my switchbots too), irkit2mqtt, rpitx2mqtt. I also made my own power meter that posts MQTT messages regularly.

For automation I have a nodeJS-based automator that listens to the MQTT messages and posts relevant automation messages. The idea is to have the system degrade gracefully in case a component fails.

  • if my internet is broken, my home automation still works
  • if HA fails, my automation still works
  • if HA fails, I still have zigbee2mqtt UI to inspect the status of each of my devices (hoping to write a status webapp for that)
  • if my automation app fails, each device still works

I deploy HA on a RaspberryPi 4 running raspbian OS lite. my installation is in a python3.11 venv locating on an NFS mount. My previous HA installation on a USB flash drive has stopped working after 1 year after excessive writing (although I have already stripped loggon to a bare minimal).

  • I have also realised that HA breaks easily especially when an update is applied. I think stability is of utmost importance so my installation is fixed at 2023.03. My zigbee2mqtt version is also fixed.
  • I don’t want to tinker with the HA codebase but there are too many bloat components
    • energy - (I don’t even know what juicenet is). My energy meter reports kWh and A readouts every 30 second. A numerical meter is all I need.
    • cloud - I manage my automation myself with Discord and LINE chatbots, I also have homebridge that links my MQTT infra to iOS. I use cloudflare zerotrust tunnel to log into my HA instance when I’m not home. I maintain full control on exactly what my cloud will look like.
      I’ll not get outage if Nabu Casa one day decides to stop their cloud.
    • bluetooth - my bluetooth is managed separately with a bluetooth2mqtt gateway that I made myself. I don’t need HA to manage my bluetooth.

I have managed to modify homeassistant/components/default_config/manifest.json and stip off most components except MQTT and the bare essentials. If I buy a new device I just add it to zigbee2mqtt and/or write my own MQTT gateway for it. As long as HA can pick up the MQTT message I’ll never need to update HA.

I tried running HA over docker but sadly docker doesn’t work with NFS mounts and writes very frequently to the disk, making it less than ideal for raspberry pi. By the way, my Raspi has OverlayFS and a readonly root partition enabled.

My entire HA instance is on an NFS mount so theoretically if my raspberry pi fails for any reason, I will be able to start it on another. I haven’t tried it - hopefully I don’t have to.

Am I abusing HA ??? Are there any other people who use HA like I do? What’s your configuration??

Cheers

Welcome!

Interesting use case. I think I understand where you’re coming from, and it makes sense for you, which is all that matters.

I came at HA from a different direction, but my goals line up well with yours: 24/7 uptime, unattended operation, no cloud dependencies, minimal tinkering or updates, minimize single points of failure.

Mine has been running on a RPi 3B+ for over four years now. I resist the temptation to apply updates more often than once a month. I resist the temptation to try “new and exciting” extensions, integrations or additional protocols (like MQTT). Just plain old HA, doing whatever comes natively with it.

I do have a Zigbee/Z-Wave dongle and have found ZHA to work well for me. I’d like to try Z-Wave but I really can’t justify another protocol to worry about breaking changes with.

I’m more focused on monitoring than automating. My automations are mostly involved with capturing and recording long-term data or giving my home a lived-in look while I’m away. Other than that, I’m OK with deciding for myself when I want lights on or what kind of music to play. This allows me the luxury of one more requirement: Most things must still work even if HA were unavailable. For example, if I’m not around, guests can still figure out how to turn on the lights.

Right now the biggest hole in my approach is that my house only has one internet connection. That went down while I was away last week. I had no way of knowing whether my house had lost power or just internet. As it turned out, the power never failed and all my automations continued to run. More importantly, my sump pumps and heating system were fine. Had it been a bad rain storm, or below freezing temperatures, knowing the status of these systems would have been critical. With only one internet provider in town, I have limited options here. 5G roll-out is getting closer though. Once that single point of failure is eliminated I’ll sleep better.

Hi Tom! Thanks for your reply.
It took me quite a while to realise that HA is an “enthusiast product” designed by people who are more inclined to “design just to design”. I do that too so I understand where they come from.

Mine has been running on a RPi 3B+ for over four years now. I resist the temptation to apply updates more often than once a month. I resist the temptation to try “new and exciting” extensions, integrations or additional protocols (like MQTT). Just plain old HA, doing whatever comes natively with it.

I did it first on a 3b+ too, and it was a bit laggy! I reckon a 4b plus 8G RAM does the work better, and rock-solid-old HA is as good as what can get!

Most things must still work even if HA were unavailable. For example, if I’m not around, guests can still figure out how to turn on the lights.

Metrics collection using HA seems interesting. I was wondering have you considered anything more real-world like Prometheus/Grafana?

I do have a Zigbee/Z-Wave dongle and have found ZHA to work well for me. I’d like to try Z-Wave but I really can’t justify another protocol to worry about breaking changes with.

I’ve been wanting to try ZWave too, but my system is almost exclusively built on zigbee. To make source code maintenance easier I’d, like you do, keep the # of moving parts to a minimal.

Interesting about internet connection redundancy. I never thought of that. I suppose you’d have to use 2 routers and (at least for one node) connect to both connections and keep sending heartbeats? You mentioned single point of failure , which I have looked over - I think I’ll need two mqtt brokers, two HAs, two of everything … in case one breaks down. I’ve been thinking of deploying Kubernetes but two~three raspi 4b’s probably isn’t enough (I’m more used to deploying it on virtualized infrastructure)… Might have to keep looking!

Cheers

Since this is now a philosophical discussion…

I don’t even come close to taxing the resource of my RPi 3B+. It sits at single-digit or very rarely low teens CPU utilization and around 50% memory utilization. Frankly, it’s over-powered for my use. I do no streaming or anything like that which might challenge it.

To be honest I only occasionally look at any metrics beyond the past few days. When I want to look at long-term trends (say, heating fuel burn rates) I just use Excel. My justification for using HA (or any “smart home” system) is to monitor my critical systems. In my climate, a heating system failure can be very costly. Of course, once you set up monitoring for catastrophic failures, it’s easy enough to expand into keeping real-time metrics on all kinds of things which can help improve efficiency.

I like the analogy of keeping “moving parts” to a minimum. It’s a good way to explain my philosophy regarding HA integrations, protocols and add-ons. I suspect a lot of people are making HA much harder for themselves to support by jumping on every possible option, without any real justification.

I know there are routers which allow multiple WAN pathways. It’s done on boats, for example, to use the marina WiFi when in port, and a (more expensive) satellite connection when underway. I haven’t researched it too deeply though. The problem with any bleeding-edge technology is that it makes no sense to research it until you’re ready to buy. Whatever you learn today will be obsolete tomorrow.