Menu

Monitoring Host System with Home Assistant

Today I am going to be covering the system monitorsensor for Home Assistant, specifically how to use it to monitor the underlying host computer (or system). This component exposes CPU, disk, memory and network values to Home Assistant for monitoring and alerting. Let's get started:

Enabling monitoring

First we will need to enable the sensor in our config/sensor.yaml file. In order to monitor your network interface on a windows computer you will need to know the display name for your network adapter, you can get this value by running ipconfig in a command window, looking for the interface you want to monitor. The name of the interface will appear to the right of the Ethernet adapter (or wireless adapter) - in my case this is Ethernet.

As you can see from above, I am going to be monitoring a lot of resources, after restarting Home Assistant all my new resources appear at the top of the Home view.

Grouping entities

I much prefer the cards display (called groups) over the default icons as it allows me to control the grouping and ordering of these objects. In order to create a group we will need to know the entity_id's for the targeted objects, we can get these from the state viewhttps://:8123/dev-state my new objects are:

sensor.cpu_use

sensor.diskusec

sensor.diskusei

sensor.diskusem

sensor.diskusen

sensor.diskuseo

sensor.diskusep

sensor.last_boot

sensor.packetsreceivedethernet

sensor.packetssentethernet

sensor.ram_use

sensor.received_ethernet

sensor.sent_ethernet

sensor.ram_free

Let's start off by grouping all my hard drives together, to do this I will need to create a new group and add all the entities we want to include. In my config/groups.yaml file I added the following group:

Creating views

Lastly I would like to create a view (basically a tab on the top of the Home Assistant's UI) to display everything performance monitoring related. Views are a nice way to group together similar components and provide an uncluttered view into your home automation when compared to the default home view. View are basically groups with the view: yes attribute set, and are declared using the same syntax, i.e. we will need to know what we would like to display, in my case that was:

group.hostdrivesgroup

group.hostnetworkoverview

group.hostperformancegroup

You can use any material design icon to replace the default icons used by Home Assistant (provided you prefix them with mdi:), so for my view I am going to be using the desktop-classic icon:

Customizing icons

Just like with the views, any displayed entity on Home Assistants user interface can be customized, and have it's default icon replaced with a new one. Unlike views and groups though, you need to make these customizations under the homeassistant root configuration property using the customize: attribute. To keep things simple I prefer to break these customizations out into their own file (config/customize.yaml) and reference them in as shown below:

After restarting Home Assistant my changes were visible. Note you can customize a lot more than just the icon of an entity (full documentation here), and as a result can produce some pretty interesting ways of displaying your data.

That's all for now, hopefully you found this post interesting and I look forward to any comments / suggestions below.