Skip to content

kuchel77/diskspace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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:

  • GB - Gigabytes
  • MB - Megabytes
  • TB - Terabyes
  • Anything else - Raw data which is given in bytes.

This uses 1000MB = 1GB

Name: Anything you like. The sensor will then be sensor.disk_space_name

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