Disk space sensor for Home Assistant.
Example configuration.yaml
sensor:
- platform: diskspace
name: Main Disk
path: "/"
unit_of_measure: "GB"
Unit of Measure:
This uses 1000MB = 1GB
Name: Anything you like. The sensor will then be sensor.diskspacename
Path: Where the mount path is. This can be found from the command line using the command mount for instance.
This is an example of what a sensor looks like.
Sensor | State | Attributes |
---|---|---|
sensor.disk_space_main_disk | 368 | total: 490 used: 97 free: 368 |
Notice that Total - Used doesn't equal Free. This is a limitation of the operating system and happens on both MacOS and Linux.
- id: "2121054773"
alias: Low Disk Space
description: "Notify me of low disk space"
trigger:
- platform: template
value_template: "{{ state_attr('sensor.disk_space_main_disk', 'percentage_free') < 10 }}"
action:
- data:
message: Main disk is almost full
service: notify.slack