Skip to content

Instantly share code, notes, and snippets.

@standaniels
Created June 24, 2021 09:39
Show Gist options
  • Save standaniels/f4f33c83939ad1f5357cb4a472b47653 to your computer and use it in GitHub Desktop.
Save standaniels/f4f33c83939ad1f5357cb4a472b47653 to your computer and use it in GitHub Desktop.
Add disk usage sensor to Home Assistant
- platform: command_line
name: Disk Usage
command: >-
df -h / | sed 1d | awk '{ print "\{\"size\": \"" $2 "\", \"used\": \"" $3 "\", \"used\%\": " $5+0 "\}" }'
unit_of_measurement: "%"
json_attributes:
- "size"
- "used"
- "used%"
value_template: "{{ state_attr('sensor.disk_usage', 'used%') }}"
scan_interval: 300
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment