From f6fbfc1f7fe7de2e636fad352527e810bda3b67c Mon Sep 17 00:00:00 2001 From: Marc Billow Date: Sat, 15 Aug 2026 02:07:30 +0000 Subject: [PATCH] Keep the drum-clean unit in code rather than the catalog Home Assistant resolves a catalog `unit_of_measurement` against the default language, not the user's (entity_platform re-fetches 'en' for exactly this key), because a unit is part of the state's identity -- the recorder writes it into statistics metadata and compares it across restarts. Localizing it would make switching Home Assistant's language look like a unit change and suppress the sensor's statistics. So the six non-English entries were never read, and the English one only restated what `unit="cycles"` already said. Same displayed unit either way; this drops seven catalog keys that looked translatable but weren't. --- custom_components/localthings/registry/capabilities/dryer.py | 1 + custom_components/localthings/registry/capabilities/washer.py | 1 + custom_components/localthings/translations/cs.json | 3 +-- custom_components/localthings/translations/de.json | 3 +-- custom_components/localthings/translations/en.json | 3 +-- custom_components/localthings/translations/es.json | 3 +-- custom_components/localthings/translations/it.json | 3 +-- custom_components/localthings/translations/ko.json | 3 +-- custom_components/localthings/translations/nl.json | 3 +-- 9 files changed, 9 insertions(+), 14 deletions(-) diff --git a/custom_components/localthings/registry/capabilities/dryer.py b/custom_components/localthings/registry/capabilities/dryer.py index 403395b..f4d7b51 100644 --- a/custom_components/localthings/registry/capabilities/dryer.py +++ b/custom_components/localthings/registry/capabilities/dryer.py @@ -70,6 +70,7 @@ DRYER_COURSE = Capability( ), SensorDesc( key="drum_clean_cycles_remaining", + unit="cycles", icon="mdi:tumble-dryer-alert", state_class="measurement", exists_fn=lambda rep, resources: drum_clean_cycles_remaining(rep) is not None, diff --git a/custom_components/localthings/registry/capabilities/washer.py b/custom_components/localthings/registry/capabilities/washer.py index 98a7cf5..af289b8 100644 --- a/custom_components/localthings/registry/capabilities/washer.py +++ b/custom_components/localthings/registry/capabilities/washer.py @@ -275,6 +275,7 @@ WASHER_COURSE = Capability( ), SensorDesc( key="drum_clean_cycles_remaining", + unit="cycles", icon="mdi:washing-machine-alert", state_class="measurement", exists_fn=lambda rep, resources: drum_clean_cycles_remaining(rep) is not None, diff --git a/custom_components/localthings/translations/cs.json b/custom_components/localthings/translations/cs.json index 82ba3e9..8af70be 100644 --- a/custom_components/localthings/translations/cs.json +++ b/custom_components/localthings/translations/cs.json @@ -946,8 +946,7 @@ } }, "drum_clean_cycles_remaining": { - "name": "Čištění bubnu za", - "unit_of_measurement": "cyklů" + "name": "Čištění bubnu za" }, "drum_clean_last_cleaned": { "name": "Poslední čištění bubnu" diff --git a/custom_components/localthings/translations/de.json b/custom_components/localthings/translations/de.json index caf28c3..9e54ce5 100644 --- a/custom_components/localthings/translations/de.json +++ b/custom_components/localthings/translations/de.json @@ -940,8 +940,7 @@ } }, "drum_clean_cycles_remaining": { - "name": "Trommelreinigung fällig in", - "unit_of_measurement": "Zyklen" + "name": "Trommelreinigung fällig in" }, "drum_clean_last_cleaned": { "name": "Trommel zuletzt gereinigt" diff --git a/custom_components/localthings/translations/en.json b/custom_components/localthings/translations/en.json index 6976e2e..98d21b1 100644 --- a/custom_components/localthings/translations/en.json +++ b/custom_components/localthings/translations/en.json @@ -946,8 +946,7 @@ } }, "drum_clean_cycles_remaining": { - "name": "Drum clean due in", - "unit_of_measurement": "cycles" + "name": "Drum clean due in" }, "drum_clean_last_cleaned": { "name": "Drum last cleaned" diff --git a/custom_components/localthings/translations/es.json b/custom_components/localthings/translations/es.json index a886cb7..399fbb2 100644 --- a/custom_components/localthings/translations/es.json +++ b/custom_components/localthings/translations/es.json @@ -1139,8 +1139,7 @@ } }, "drum_clean_cycles_remaining": { - "name": "Limpieza de tambor en", - "unit_of_measurement": "ciclos" + "name": "Limpieza de tambor en" }, "drum_clean_last_cleaned": { "name": "Última limpieza del tambor" diff --git a/custom_components/localthings/translations/it.json b/custom_components/localthings/translations/it.json index c98c4c1..8bcbd6b 100644 --- a/custom_components/localthings/translations/it.json +++ b/custom_components/localthings/translations/it.json @@ -946,8 +946,7 @@ } }, "drum_clean_cycles_remaining": { - "name": "Pulizia cestello fra", - "unit_of_measurement": "cicli" + "name": "Pulizia cestello fra" }, "drum_clean_last_cleaned": { "name": "Ultima pulizia cestello" diff --git a/custom_components/localthings/translations/ko.json b/custom_components/localthings/translations/ko.json index 4bb87dd..aab7879 100644 --- a/custom_components/localthings/translations/ko.json +++ b/custom_components/localthings/translations/ko.json @@ -946,8 +946,7 @@ } }, "drum_clean_cycles_remaining": { - "name": "통세척까지 남은 횟수", - "unit_of_measurement": "회" + "name": "통세척까지 남은 횟수" }, "drum_clean_last_cleaned": { "name": "마지막 통세척" diff --git a/custom_components/localthings/translations/nl.json b/custom_components/localthings/translations/nl.json index 4448e60..ec45195 100644 --- a/custom_components/localthings/translations/nl.json +++ b/custom_components/localthings/translations/nl.json @@ -946,8 +946,7 @@ } }, "drum_clean_cycles_remaining": { - "name": "Trommelreiniging over", - "unit_of_measurement": "cycli" + "name": "Trommelreiniging over" }, "drum_clean_last_cleaned": { "name": "Trommel laatst gereinigd"