Disk usage

Hi Guys,

I have hdd plug into my rp4 and I’d like to see the disk usage and how much free space I still have on it. I’m running HA in a docker. I’ve instaled Glances on Rasbian directly (not as an addon in HA) so I can see the external hdd (dev/sda1). I integrated Glances with Home Assistant but sensors show only disk where root folder is located (sd card). Platform “system monitor” didn’t work, as I assume because I’m running HA in container so home assistent doesn’t see folder /mnt/Dysk . Any ideas?

image

Use the system monitor, here’s my config for similar related things

  - platform: systemmonitor
    resources:
      - type: disk_use_percent
        arg: /
      - type: disk_use
        arg: /
      - type: disk_free
        arg: /
      - type: memory_use_percent
      - type: memory_use
      - type: memory_free
      - type: swap_use_percent
      - type: swap_use
      - type: swap_free
      - type: load_1m
      - type: load_5m
      - type: load_15m
      - type: processor_use
      - type: last_boot

You have to mount external directories to the HA docker container. In hassio i was only able to handle it that way:
https://community.home-assistant.io/t/solved-hassio-and-volume-mount-issues/141986/2

Maybe but I run with a pi 4 and a hard disk, it report 4.1gb used and 203.5gb unused
It’s good enough for me :rofl:

Hi Guys!

I was trying to bind the volume (mnt/Dysk) to container path /media using portainer, but no success :confused:
I have also tried to change existing path /share to /mnt/Dysk but didn’t work

I mean, the HA is running but I still don’t see sensors using systemmonitor

I was only trying to bind, not volume mapping - I don’t know how to add Volume in portainer that isn’t local :confused:

Use the glances API, you should see the drive there. http://Pi4-IPAddress:61208/api/3/fs, then use a rest sensor to grab the info in json format for the drive you want.

I am not really sure but /mnt/Dysk is bind to 2 different paths in container; make that one just to make sure…
My volume structure is almost the same. The screenshot you sent is under ‘homeassistant’ container, right?

This works for me:

  - platform: systemmonitor
    resources:
      - type: disk_use_percent
        arg: /
      - type: disk_use_percent
        arg: /server_hdd
      - type: disk_use_percent
        arg: /server_plex
      - type: memory_use_percent
      - type: processor_use

In your case:

  - platform: systemmonitor
    resources:
      - type: disk_use_percent
        arg: /
      - type: disk_use_percent
        arg: /media

This is what I use to get my drive info… (I said in my last post to use a rest sensor, that was a mistake. I use a command_line).

  - platform: command_line
    command: curl -X GET http://192.168.1.50:61208/api/3/fs
    name: Server SSD Percentage
    unit_of_measurement: '%'
    value_template: '{{ value_json[0].percent }}'
    scan_interval: 1800

If since you are after your ext drive, you would want to change the value_template to something else. Possible value_json[2].percent you can change percent to what ever value you want.

HI!

That’s it, it works! Thank you!

1 Like