From 5ffececae544ae841d594861d7b5e8e338d1203c Mon Sep 17 00:00:00 2001 From: Bryan Van Deusen Date: Sun, 1 Nov 2026 15:03:13 -0500 Subject: [PATCH] feat(homeassistant): the page shows the device's storage and how full it is (#6753) Co-Authored-By: Claude Opus 5.5 --- .../homeassistant/templates/homeassistant/index.html | 3 ++- tests/integration/test_homeassistant.py | 12 ++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/plugins/homeassistant/templates/homeassistant/index.html b/plugins/homeassistant/templates/homeassistant/index.html index 962ec67..6c3e4db 100644 --- a/plugins/homeassistant/templates/homeassistant/index.html +++ b/plugins/homeassistant/templates/homeassistant/index.html @@ -37,7 +37,8 @@
{{ stat_tile("System problems", problems|length if health.repairs_read else "—", state="degraded" if problems else none) }} - {{ stat_tile("Disk free", (health.disk_free_gb ~ " GB") if health.disk_free_gb is not none and health.disk_free_gb is defined else "—") }} + {{ stat_tile("Storage", (health.disk_total_gb ~ " GB") if health.disk_total_gb else "—", + hint=("%.0f%% full"|format(100 - health.disk_free_pct)) if health.disk_free_pct is number else none) }} {{ stat_tile("Updates waiting", installable|length if connection.last_ok_at else "—") }} {{ stat_tile("Last good backup", (backup_at|ago) if backup_at else "—", state="degraded" if backup_tone == 'warn' else none) }} {{ stat_tile("Next backup", (backup_next|ago) if backup_next else "—") }} diff --git a/tests/integration/test_homeassistant.py b/tests/integration/test_homeassistant.py index 5d7eb23..9731c1e 100644 --- a/tests/integration/test_homeassistant.py +++ b/tests/integration/test_homeassistant.py @@ -533,6 +533,18 @@ def test_a_poll_keeps_the_system_problems_and_records_them(app): assert metrics["problems_open"] == 2.0 and metrics["disk_free_pct"] == 50.0 and metrics["update_failed"] == 0.0 +def test_the_page_shows_the_devices_storage_and_how_full_it_is(app): + async def go(): + await _clean(app, health={"repairs_read": True, "problems": [], "disk_free_gb": 99.8, + "disk_total_gb": 116.5, "disk_free_pct": 85.7}) + web, _ = await _admin_client(app) + return await (await web.get("/plugins/homeassistant/")).get_data(as_text=True) + + page = asyncio.run(go()) + assert "116.5 GB" in page and "14% full" in page + assert "Disk free" not in page + + def test_a_report_it_couldnt_read_leaves_the_last_one_and_home_assistant_still_answers(app): sched = _ha("scheduler") ha = FakeHomeAssistant()