From a59ef6cca94457287523931cebf2500eb358e5e9 Mon Sep 17 00:00:00 2001 From: Marc Billow Date: Sat, 15 Aug 2026 02:44:01 +0000 Subject: [PATCH] dryer: translate dryer_type, folding in #366's Dutch additions #366 added Dutch state translations for dryer_type ('Electricity') and progress, but predates #371's lowercase-key normalization: its progress states were already superseded (every one it added is already in nl.json's current 'state' table, lowercase), and its dryer_type addition used the pre-#371 capitalized key. dryer_type itself was never wired for translation at all -- no device_class, no options -- so nothing in any locale's dryer_type.state table was ever read. Give it device_class=enum, options=("electricity",) (the only value confirmed across shipped fixtures), and the same value_fn=lower() normalization #371 used elsewhere, then add the 'electricity' state across all seven locale catalogs, not just Dutch. --- .../localthings/registry/capabilities/dryer.py | 12 +++++++++++- custom_components/localthings/translations/cs.json | 5 ++++- custom_components/localthings/translations/de.json | 5 ++++- custom_components/localthings/translations/en.json | 5 ++++- custom_components/localthings/translations/es.json | 5 ++++- custom_components/localthings/translations/it.json | 5 ++++- custom_components/localthings/translations/ko.json | 5 ++++- custom_components/localthings/translations/nl.json | 5 ++++- 8 files changed, 39 insertions(+), 8 deletions(-) diff --git a/custom_components/localthings/registry/capabilities/dryer.py b/custom_components/localthings/registry/capabilities/dryer.py index f4d7b51..7f02b8d 100644 --- a/custom_components/localthings/registry/capabilities/dryer.py +++ b/custom_components/localthings/registry/capabilities/dryer.py @@ -27,7 +27,17 @@ DRYER_SETTINGS = Capability( entities=( SensorDesc(key="dry_level", field="x.com.samsung.da.dryLevel", icon="mdi:water-percent"), SensorDesc(key="dry_time", field="x.com.samsung.da.dryTime", icon="mdi:timer"), - SensorDesc(key="dryer_type", field="x.com.samsung.da.dryerType", icon="mdi:tumble-dryer"), + SensorDesc( + key="dryer_type", + field="x.com.samsung.da.dryerType", + icon="mdi:tumble-dryer", + device_class="enum", + # Only 'Electricity' confirmed across shipped fixtures (#366); an + # unrecognized value still passes through raw via sensor.py's + # options property rather than breaking the entity. + options=("electricity",), + value_fn=lambda v: v.lower() if isinstance(v, str) else v, + ), SwitchDesc( key="wrinkle_prevent", field="x.com.samsung.da.wrinklePrevent", diff --git a/custom_components/localthings/translations/cs.json b/custom_components/localthings/translations/cs.json index 8af70be..c929888 100644 --- a/custom_components/localthings/translations/cs.json +++ b/custom_components/localthings/translations/cs.json @@ -958,7 +958,10 @@ "name": "Doba sušení" }, "dryer_type": { - "name": "Typ sušičky" + "name": "Typ sušičky", + "state": { + "electricity": "Elektřina" + } }, "dust": { "name": "Prach" diff --git a/custom_components/localthings/translations/de.json b/custom_components/localthings/translations/de.json index 9e54ce5..8229aef 100644 --- a/custom_components/localthings/translations/de.json +++ b/custom_components/localthings/translations/de.json @@ -952,7 +952,10 @@ "name": "Trockenzeit" }, "dryer_type": { - "name": "Trocknertyp" + "name": "Trocknertyp", + "state": { + "electricity": "Strom" + } }, "dust": { "name": "Staub" diff --git a/custom_components/localthings/translations/en.json b/custom_components/localthings/translations/en.json index 98d21b1..fb2ec6b 100644 --- a/custom_components/localthings/translations/en.json +++ b/custom_components/localthings/translations/en.json @@ -958,7 +958,10 @@ "name": "Dry time" }, "dryer_type": { - "name": "Dryer type" + "name": "Dryer type", + "state": { + "electricity": "Electricity" + } }, "dust": { "name": "Dust" diff --git a/custom_components/localthings/translations/es.json b/custom_components/localthings/translations/es.json index 399fbb2..29a6338 100644 --- a/custom_components/localthings/translations/es.json +++ b/custom_components/localthings/translations/es.json @@ -1151,7 +1151,10 @@ "name": "Tiempo de secado" }, "dryer_type": { - "name": "Tipo de secadora" + "name": "Tipo de secadora", + "state": { + "electricity": "Electricidad" + } }, "dust": { "name": "Polvo" diff --git a/custom_components/localthings/translations/it.json b/custom_components/localthings/translations/it.json index 8bcbd6b..605fa0b 100644 --- a/custom_components/localthings/translations/it.json +++ b/custom_components/localthings/translations/it.json @@ -958,7 +958,10 @@ "name": "Tempo di asciugatura" }, "dryer_type": { - "name": "Tipo di asciugatrice" + "name": "Tipo di asciugatrice", + "state": { + "electricity": "Elettricità" + } }, "dust": { "name": "Polvere" diff --git a/custom_components/localthings/translations/ko.json b/custom_components/localthings/translations/ko.json index aab7879..fb4c452 100644 --- a/custom_components/localthings/translations/ko.json +++ b/custom_components/localthings/translations/ko.json @@ -958,7 +958,10 @@ "name": "건조 시간" }, "dryer_type": { - "name": "건조기 유형" + "name": "건조기 유형", + "state": { + "electricity": "전기" + } }, "dust": { "name": "미세먼지" diff --git a/custom_components/localthings/translations/nl.json b/custom_components/localthings/translations/nl.json index ec45195..5e64766 100644 --- a/custom_components/localthings/translations/nl.json +++ b/custom_components/localthings/translations/nl.json @@ -958,7 +958,10 @@ "name": "Droogtijd" }, "dryer_type": { - "name": "Type droger" + "name": "Type droger", + "state": { + "electricity": "Elektriciteit" + } }, "dust": { "name": "Stof"