kuchel77 / diskspace

Disk space for a path. For use with Home Assistant
Apache License 2.0
10 stars 2 forks source link
assistant disk hass home space

hacs_badge

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.

Notes

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.

Notification Template

- 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