From f150d1b28776fb9095af48a0e2db25e7e370f2e9 Mon Sep 17 00:00:00 2001 From: Stefan Agner Date: Tue, 5 Aug 2025 10:43:57 +0200 Subject: [PATCH] Return optimistic life time estimate for eMMC storage (#6063) This avoids that we display a 10% life time use for a brand new eMMC storage. The values are estimates anyways, and there is a separate value which represents life time completely used (100%). --- supervisor/hardware/disk.py | 4 ++-- tests/hardware/test_disk.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/supervisor/hardware/disk.py b/supervisor/hardware/disk.py index 5a7125837..3b5158c7e 100644 --- a/supervisor/hardware/disk.py +++ b/supervisor/hardware/disk.py @@ -178,8 +178,8 @@ class HwDisk(CoreSysAttributes): ) return 100.0 - # Return the pessimistic estimate (0x02 -> 10%-20%, return 20%) - return life_time_value * 10.0 + # Return the optimistic estimate (0x02 -> 10%-20%, return 10%) + return (life_time_value - 1) * 10.0 async def get_disk_life_time(self, path: str | Path) -> float | None: """Return life time estimate of the underlying SSD drive.""" diff --git a/tests/hardware/test_disk.py b/tests/hardware/test_disk.py index 6aa84775c..32df09b5c 100644 --- a/tests/hardware/test_disk.py +++ b/tests/hardware/test_disk.py @@ -160,7 +160,7 @@ def test_try_get_emmc_life_time(coresys, tmp_path): str(tmp_path / "fake-{}-lifetime"), ): value = coresys.hardware.disk._try_get_emmc_life_time("mmcblk0") - assert value == 20.0 + assert value == 10.0 async def test_try_get_nvme_life_time(