Add System Monitoring to Home Assistant

Smart Home
This entry is part 8 of 11 in the series Creating My Smart Home.

As my smart home continues to grow in complexity–and as my household becomes more used to its advantages–I’ll want to make sure I’m aware of any problems as soon as possible. One way to help with this is to monitor the performance of the Raspberry Pi itself. Home Assistant has several system-monitor components that can help with this.

I’m using the System Monitor and Fast.com components. I had to modify the existing sensor section of my configuration.yaml file to include multiple platforms. I added a dash and a space in front of the default platform: yr sensor and then added platforms for the systemmonitor sensor and fastdotcom sensor. So it went from this:

# Weather Prediction
sensor:
  platform: yr

to this (notice the dash before each platform):

sensor:
  - platform: yr

  - platform: systemmonitor
    resources:
      - type: disk_free
        arg: /
      - type: memory_free
      - type: processor_use
      - type: last_boot

  - platform: fastdotcom

The System Monitor documentation covers what it can do; here I’m monitoring total free disk space, free RAM, processor use in percent, and the last boot time. I’m using the Fast.com component’s default settings which measure download speed once an hour. After I saved the changes to the configuration.yaml file and restarted Home Assistant, I could see these new sensor entities in the web UI.

Note: I had to run a manual test for the Fast.com component before it displayed a value.

The System Monitor resources and Fast.com result are displayed in the web UI and are available as sensor entities in Home Assistant.

Now I could theoretically set up automations that flash the lights in the kitchen if the CPU use goes above 90%. I’ll more likely use iOS notifications, but more on that in a future post.