mirror of
https://github.com/home-assistant/supervisor.git
synced 2025-08-05 15:27:41 +00:00
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%).
This commit is contained in:
parent
628a18c6b8
commit
f150d1b287
@ -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."""
|
||||
|
@ -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(
|
||||
|
Loading…
x
Reference in New Issue
Block a user