From 68c6641cbc029d9ee656200314db6c0c81a7dc03 Mon Sep 17 00:00:00 2001 From: Mike Degatano Date: Wed, 6 Aug 2025 19:41:55 +0000 Subject: [PATCH 1/2] Make disk_lifetime issue into a repair --- homeassistant/components/hassio/issues.py | 1 + homeassistant/components/hassio/strings.json | 4 ++ tests/components/hassio/test_issues.py | 47 ++++++++++++++++++++ 3 files changed, 52 insertions(+) diff --git a/homeassistant/components/hassio/issues.py b/homeassistant/components/hassio/issues.py index 35f7f48481e2c..68d01e93bebfa 100644 --- a/homeassistant/components/hassio/issues.py +++ b/homeassistant/components/hassio/issues.py @@ -103,6 +103,7 @@ ISSUE_KEY_SYSTEM_DOCKER_CONFIG, ISSUE_KEY_ADDON_DETACHED_ADDON_MISSING, ISSUE_KEY_ADDON_DETACHED_ADDON_REMOVED, + "issue_system_disk_lifetime", } _LOGGER = logging.getLogger(__name__) diff --git a/homeassistant/components/hassio/strings.json b/homeassistant/components/hassio/strings.json index 5df197bddcb21..e18ac79362e6c 100644 --- a/homeassistant/components/hassio/strings.json +++ b/homeassistant/components/hassio/strings.json @@ -115,6 +115,10 @@ } } }, + "issue_system_disk_lifetime": { + "title": "Disk lifetime exceeding 90%", + "description": "The disk reports it has exceeded 90% of its manufacturer expected lifetime. This means that the disk is nearing the end of its useful life and may begin to cause issues with the system. You should consider replacing it soon and then migrating to the new data disk." + }, "unhealthy": { "title": "Unhealthy system - {reason}", "description": "System is currently unhealthy due to {reason}. For troubleshooting information, select Learn more." diff --git a/tests/components/hassio/test_issues.py b/tests/components/hassio/test_issues.py index b0d3920be0940..a4ad0a4a004b7 100644 --- a/tests/components/hassio/test_issues.py +++ b/tests/components/hassio/test_issues.py @@ -850,3 +850,50 @@ async def test_supervisor_issues_detached_addon_missing( "addon_url": "/hassio/addon/test", }, ) + + +@pytest.mark.usefixtures("all_setup_requests") +async def test_supervisor_issues_disk_lifetime( + hass: HomeAssistant, + supervisor_client: AsyncMock, + hass_ws_client: WebSocketGenerator, +) -> None: + """Test supervisor issue for disk lifetime nearly exceeded.""" + mock_resolution_info(supervisor_client) + + result = await async_setup_component(hass, "hassio", {}) + assert result + + client = await hass_ws_client(hass) + + await client.send_json( + { + "id": 1, + "type": "supervisor/event", + "data": { + "event": "issue_changed", + "data": { + "uuid": (issue_uuid := uuid4().hex), + "type": "disk_lifetime", + "context": "system", + "reference": None, + }, + }, + } + ) + msg = await client.receive_json() + assert msg["success"] + await hass.async_block_till_done() + + await client.send_json({"id": 2, "type": "repairs/list_issues"}) + msg = await client.receive_json() + assert msg["success"] + assert len(msg["result"]["issues"]) == 1 + assert_issue_repair_in_list( + msg["result"]["issues"], + uuid=issue_uuid, + context="system", + type_="disk_lifetime", + fixable=False, + placeholders=None, + ) From 5d67fb5d30dfb31083e8339ab685f30d8644d668 Mon Sep 17 00:00:00 2001 From: Mike Degatano Date: Mon, 11 Aug 2025 17:48:23 +0000 Subject: [PATCH 2/2] Adjust text of repair --- homeassistant/components/hassio/strings.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/homeassistant/components/hassio/strings.json b/homeassistant/components/hassio/strings.json index e18ac79362e6c..393fe48005738 100644 --- a/homeassistant/components/hassio/strings.json +++ b/homeassistant/components/hassio/strings.json @@ -117,7 +117,7 @@ }, "issue_system_disk_lifetime": { "title": "Disk lifetime exceeding 90%", - "description": "The disk reports it has exceeded 90% of its manufacturer expected lifetime. This means that the disk is nearing the end of its useful life and may begin to cause issues with the system. You should consider replacing it soon and then migrating to the new data disk." + "description": "The data disk has exceeded 90% of its expected lifespan. The disk may soon malfunction which can lead to data loss. You should replace it soon and migrate your data." }, "unhealthy": { "title": "Unhealthy system - {reason}",