-
Notifications
You must be signed in to change notification settings - Fork 748
Storage space usage API #6046
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Storage space usage API #6046
Conversation
mdegat01
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is really cool! As its still in draft I'll just add comments for some thoughts looking at it rather then approve or not. But I'd love to see this UI in Home Assistant!
|
On the labels I added:
I can probably take care of these if you want, we just have to finalize the API first. |
|
As we discussed, I updated the URL, tweaked the structure a bit and added "total_space" and "system". We can update the buckets more in the future but if the protocol is OK, I'll update the docs and lib. |
|
I run this on my production instance with a depth of 2, this is the json I got back: {
"result": "ok",
"data": {
"total_space": 984465879040,
"used_space": 213384400896,
"children": {
"addons_data": {
"used_space": 17918974193,
"children": {
"core_configurator": {
"used_space": 173
},
"77f1785d_chip_tool": {
"used_space": 2
},
"core_whisper": {
"used_space": 3892688550
},
"a0d7b954_vscode": {
"used_space": 176693578
},
"core_mosquitto": {
"used_space": 845657
},
"982ee2c4_volvo2mqtt": {
"used_space": 475
},
"core_ssh": {
"used_space": 38000998
},
"a0d7b954_influxdb": {
"used_space": 8218539131
},
"a0d7b954_grafana": {
"used_space": 1215195
},
"a0d7b954_uptime-kuma": {
"used_space": 671268550
},
"core_letsencrypt": {
"used_space": 445994
},
"core_piper": {
"used_space": 442690429
},
"a0d7b954_ssh": {
"used_space": 6290
},
"core_git_pull": {
"used_space": 2376
},
"a0d7b954_logviewer": {
"used_space": 76
},
"core_mariadb": {
"used_space": 4299634590
},
"core_silabs_flasher": {
"used_space": 109
},
"core_speech-to-phrase": {
"used_space": 132782908
},
"a0d7b954_spotify": {
"used_space": 158
},
"a0d7b954_phpmyadmin": {
"used_space": 70
},
"17fe96b6_puppet": {
"used_space": 207
},
"a0d7b954_glances": {
"used_space": 397
},
"core_matter_server": {
"used_space": 44157845
},
"core_vlc": {
"used_space": 67
},
"core_assist_microphone": {
"used_space": 368
}
}
},
"addons_config": {
"used_space": 20040109,
"children": {
"a0d7b954_emqx": {
"used_space": 3355776
},
"core_matter_server": {
"used_space": 16684333
}
}
},
"media": {
"used_space": 619970,
"children": {
"frigate": {
"used_space": 65536
}
}
},
"share": {
"used_space": 18309324,
"children": {
"mosquitto": {
"used_space": 116
},
"speech-to-phrase": {
"used_space": 18309208
}
}
},
"backup": {
"used_space": 174410946560
},
"ssl": {
"used_space": 3267
},
"homeassistant": {
"used_space": 134055761,
"children": {
"custom_components": {
"used_space": 122467
},
"glances": {
"used_space": 8981
},
"blueprints": {
"used_space": 53063
},
"python-matter-server": {
"used_space": 4351441
},
"ota": {
"used_space": 240760
},
"iotawatt_ha": {
"used_space": 75066
},
".storage": {
"used_space": 39609972
},
"custom_zha_quirks": {
"used_space": 10573
},
"esphome": {
"used_space": 2977631
},
".git": {
"used_space": 1527118
},
"automations": {
"used_space": 26032
},
"frigate-hass-integration": {
"used_space": 396310
},
"www": {
"used_space": 371349
},
"hass-weather-srgssr": {
"used_space": 521089
},
"tts": {
"used_space": 10866909
}
}
},
"system": {
"used_space": 20881451712
}
}
}
}This is from a rather simple installation on Home Assistant Green {
"result": "ok",
"data": {
"total_space": 30016831488,
"used_space": 5170909184,
"children": {
"addons_data": {
"used_space": 5073,
"children": {
"core_ssh": {
"used_space": 5073
}
}
},
"addons_config": {
"used_space": 11067,
"children": {
"core_zwave_js": {
"used_space": 11067
}
}
},
"media": {
"used_space": 0
},
"share": {
"used_space": 0
},
"backup": {
"used_space": 11151360
},
"ssl": {
"used_space": 0
},
"homeassistant": {
"used_space": 2355866,
"children": {
".storage": {
"used_space": 66945
},
"blueprints": {
"used_space": 5703
}
}
},
"system": {
"used_space": 5157385818
}
}
}
}What I generally notice is that quite some space is essentially unattributed and lands in system. I guess we could use the Docker API to get container image sizes. However, due to layer sharing using individual image sizes may add up to more space than actually occupied, which can lead to weird graphs in the end 🙈 |
|
When you look at the Home Assistant Green output, pretty much everything is accounted for System at this point. Docker has the I am fine starting with the current rather simple and straight forward approach. It will help to have a rough overview where space goes, especially if users have local backups/media or add-ons with big user data (e.g. InfluxDB). But I think it will raise questions pretty quickly, e.g. especially on a newly installed system with a couple of Add-ons installed: Users will wonder why "Add-on" is still small, or "System" occupying so much space... Since the frontend for this API will be part of Core, we need to consider how we can evolve the API if needed. |
|
|
@MindFreeze one of the use case is certainly that users can learn which add-on uses lots of space. What is the current plan for the add-on names? The code currently returns directory names, which matches add-on slugs. is the idea that the frontend translates those or is the intention to do this in the backend later on? |
|
Both are possible. With the current format, Supervisor can add the names as |
|
The first iteration will only display the top level info anyway. Deeper visualizations will be done later |
agners
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, very nice addition, looking forward for this to land 🤩



Proposed change
We need this for better space management. To show charts like this in the frontend

Reports only the main disk right now but eventually we'll need the same data for USB mounts and maybe some network mounts.
Type of change
Additional information
host.get_disk_usageto support the new API home-assistant-libs/python-supervisor-client#152Checklist
ruff format supervisor tests)If API endpoints or add-on configuration are added/changed: