feat(airconditioner): stop a running auto clean, and read its progress

Three tokens describe the drying cycle these boards run after cooling, and the
switch only covered the first. AutocleanProgress_ is how far a running cycle
has got, and StopAutoClean_ is a channel for ending one early -- its presence
is what says the appliance accepts that at all, which is how the appliance's
own app gates its stop button. Both tokens are reported by the ARTIK051_KRAC_18K
that issue #136 was about, and by every KRAC fixture here.

The percentage scale is the app's own: it renders the token into a
`<progress max="100">` with a "{{value}}%" label beside it. An idle unit reports
1 rather than 0 -- the same floor the laundry firmware's progressPercentage sits
at when Ready -- so 0-vs-1 is not a reliable "is it running" test, and the
button is deliberately not gated on it.

The sensor shares AUTO_CLEAN's catalog entry the way auto_clean_legacy already
shares the switch's: same figure, different board generation, distinct key so
nothing collides if a board ever reported both.

Stacked on #289 (this branch is cut from it) -- rebase or merge that first.
This commit is contained in:
perseus177 committed 2026-08-05 00:45:20 +02:00
1 parent 0c2e219464
commit 290a348017
11 files changed
+86

No files matched your search

@@ -20,6 +20,7 @@ from dataclasses import replace
from ..capability import Capability
from ..entities import (
BinarySensorDesc,
ButtonDesc,
ClimateDesc,
NumberDesc,
SelectDesc,
@@ -623,6 +624,45 @@ CLIMATE = Capability(
icon="mdi:fan-auto",
entity_category="config",
),
# A drying cycle the unit runs after cooling, to keep the coil from going
# mouldy. Three tokens describe it and the switch above only covered the
# first: Autoclean_ is the setting, AutocleanProgress_ is how far a
# running cycle has got, and StopAutoClean_ is a channel for ending one
# early -- its presence is what says the appliance takes that at all
# (the app gates its own stop button on exactly that), and the value it
# reports while nothing is running is Idle.
#
# The percentage scale is the app's own: `<progress max="100">` with the
# token rendered as "{{value}}%" beside it. An idle unit here reports 1
# rather than 0, the same floor the laundry firmware's progressPercentage
# sits at when Ready, so 0-vs-1 is not a reliable "is it running" test --
# which is why the button below is not gated on it.
#
# The sensor shares AUTO_CLEAN's catalog entry, like auto_clean_legacy
# above: same figure, different board generation. Distinct key, so
# nothing collides if a board ever reported both.
SensorDesc(
key="auto_clean_progress_legacy",
translation_key="auto_clean_progress",
rep_fn=_option_token_num("AutocleanProgress"),
exists_fn=_has_option_token("AutocleanProgress"),
unit="%",
state_class="measurement",
icon="mdi:progress-check",
entity_category="diagnostic",
),
ButtonDesc(
key="auto_clean_stop",
field="",
payload="StopAutoClean_Set",
icon="mdi:fan-off",
entity_category="config",
exists_fn=_has_option_token("StopAutoClean"),
write_fn=lambda p, rep, href=None: (
["mode", "vs", "0"],
{"x.com.samsung.da.options": [p]},
),
),
SwitchDesc(
key="air_monitoring",
rep_fn=_option_token_on("AirMonitoring"),
@@ -117,6 +117,9 @@
"diagnosis_start": {
"name": "Spustit diagnostiku"
},
"auto_clean_stop": {
"name": "Zastavit samočištění"
},
"pause": {
"name": "Pozastavit"
},
@@ -117,6 +117,9 @@
"diagnosis_start": {
"name": "Start diagnosis"
},
"auto_clean_stop": {
"name": "Stop auto clean"
},
"pause": {
"name": "Pause"
},
@@ -239,6 +239,9 @@
"diagnosis_start": {
"name": "Iniciar diagnóstico"
},
"auto_clean_stop": {
"name": "Detener la autolimpieza"
},
"pause": {
"name": "Pausar"
},
@@ -117,6 +117,9 @@
"diagnosis_start": {
"name": "Avvia diagnosi"
},
"auto_clean_stop": {
"name": "Arresta autopulizia"
},
"pause": {
"name": "Pausa"
},
@@ -117,6 +117,9 @@
"diagnosis_start": {
"name": "Diagnose starten"
},
"auto_clean_stop": {
"name": "Zelfreiniging stoppen"
},
"pause": {
"name": "Pauzeren"
},