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:
- CPU: Usage and temperature
- Memory: Usage
- Storage: Usage, swap usage, and external drive usage
- Networking: Wi-Fi signal strength
- Raspberry Pi: Power status, last boot, last message received timestamp, and number of upgrades pending
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
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.