Monitor your Raspberry Pis in Home Assistant using MQTT

Disclosure: This post contains affiliate links. If you click through and make a purchase, I will earn a commission, at no additional cost to you. Read my full disclosure here.

GitHub user Sennevds has put up a nifty Python script that lets you keep an eye on all your Raspberry Pis buzzing around your smart home. This comes in handy if you've got your Pis running different gigs – like one of them doing the job of an ad-blocker while another one pulling the strings as a Zigbee hub. The beauty of this script is that you can monitor critical system information like CPU usage and temperature. And guess what? For all you number nerds, you can even feast your eyes on this system information through bars and graphs on your Home Assistant dashboard.

Contents

How the Raspberry Pi monitoring script works

The Python script runs like clockwork every 60 seconds, gathering and sending system information data to an MQTT broker. If your Home Assistant is hitched to the same MQTT broker, it will naturally scoop up this data using MQTT auto-discovery. Next thing, you can showcase your Raspberry Pi's system information on your Home Assistant Dashboard. And yes, you can also use it in automations and scripts.

Here's what the script snoops on:

To get the script firing on all cylinders, you'll need to tweak a YAML file. There are a few must-have parameters like details on the MQTT broker, client ID and name, and your time zone. Plus, there are optional parameters, like the update interval and whether to measure the Wi-Fi signal strength.

How to use the system information data

Thanks to MQTT auto-discover, you won't have to tinker with Home Assistant, save for adding these lines to your configuration.yaml:

mqtt:
  discovery: true
  discovery_prefix: homeassistant
A screenshot of the Home Assistant Dashboard showing two cards monitoring Raspberry Pis.
Displaying Raspberry Pi system information in Home Assistant (source: GitHub)

Having your Raspberry Pis' system information right at your fingertips in Home Assistant can be a lifesaver. For one, you won't have to log into the Raspberry Pis every time you want to see how they're doing. Plus, you can set up notifications to ping your smartphone every time your Raspberry Pi's CPU crosses a certain threshold or if the storage is brimming full.

Sennevds, the creator of this script, has also shared their own Home Assistant Dashboard configuration. It's a slick blend of the vertical-stack-in-card, the mini-graph-card, and the bar-card. I must say, Raspberry Pi's system information does add a dash of panache to the Home Assistant dashboard.

A portrait photo oif Liam Alexander Colman, the author, creator, and owner of Home Assistant Guide wearing a suit.

About Liam Alexander Colman

is an experienced Home Assistant user who has been utilizing the platform for a variety of projects over an extended period. His journey began with a Raspberry Pi, which quickly grew to three Raspberry Pis and eventually a full-fledged server. Liam's current operating system of choice is Unraid, with Home Assistant comfortably running in a Docker container.
With a deep understanding of the intricacies of Home Assistant, Liam has an impressive setup, consisting of various Zigbee devices, and seamless integrations with existing products such as his Android TV box. For those interested in learning more about Liam's experience with Home Assistant, he shares his insights on how he first started using the platform and his subsequent journey.

Leave a comment

Share to...