From dfb842eae148165d7f3ce36dff5bcf5dc3ac5b4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Vel=C3=A1squez?= Date: Thu, 14 May 2026 04:05:55 -0300 Subject: [PATCH] fix(dashboard): relabel vacuum-extend diagnostics --- BACKLOG.md | 3 ++- src/xiao/dashboard/index.html | 12 ++++++------ tests/test_dashboard.py | 18 ++++++++++++++++++ 3 files changed, 26 insertions(+), 7 deletions(-) diff --git a/BACKLOG.md b/BACKLOG.md index 6cc8af6..5ead68f 100644 --- a/BACKLOG.md +++ b/BACKLOG.md @@ -84,8 +84,9 @@ Sources: Valetudo, python-miio, hass-xiaomi-miot, r/Xiaomi, r/homeassistant - OTA firmware management ## Completed +- ✅ Mission Control vacuum-extend diagnostics copy cleanup — the advanced diagnostics panel now relabels the known `siid 4` fields as `Cleaning Mode`, `Mop Mode`, `Waterbox Status`, `Task Status`, `Resume After Charge`, and `Carpet Boost` instead of showing generic `Unknown` placeholders, while still leaving the underlying raw values untouched for debugging. Added a TDD dashboard regression that failed on the old labels before updating the frontend copy. Research notes: the official `xiaomi.vacuum.c102gl` MIoT spec still exposes these `vacuum-extend` properties under `siid 4` (`mop-mode`, `waterbox-status`, `task-status`, `break-point-restart`, `carpet-press`); `openhab/openhab-addons` mirrors the same channel names for the X20+ model; and `hass-xiaomi-miot` issue `#2767` still shows room-cleaning behavior is the riskier area, which kept this run focused on a safe diagnostics UX win instead of hardware-dependent action changes. (2026-05-14) +- 🔜 Next planned item: Mission Control vacuum-extend value decoding — translate the known raw `siid 4` enum values in the advanced diagnostics panel (for example `mop-mode`, `waterbox-status`, `break-point-restart`, and `carpet-press`) into human-readable labels while preserving the raw values for debugging. (Planned 2026-05-14) - ✅ Waterbox attachment status surfaced across CLI + Mission Control — `status()` now reads the official X20+ `vacuum-extend` `waterbox-status` property (`siid 4 piid 6`) and exposes it as `attached`/`detached`, while the rich CLI formatters and Mission Control status tags now show whether the mop water box is present without forcing users into raw property dumps. Added TDD regression coverage for the cloud status decoder, full-status formatter, and dashboard HTML hook before implementation. Research notes: the local backlog/spec mapping already identified `siid 4 piid 6` as `waterbox-status`; the official `xiaomi.vacuum.c102gl` MIoT/OpenHAB database maps it as a read-only `0 = No`, `1 = Yes` enum; and that made this a safe, user-visible diagnostics improvement for mopping/setup issues without depending on on-device room-clean verification. (2026-05-12) -- 🔜 Next planned item: Mission Control vacuum-extend diagnostics copy cleanup — relabel the already-known `siid 4` raw fields (`mop-mode`, `waterbox-status`, `break-point-restart`, `carpet-press`) in the advanced diagnostics panel instead of leaving them as generic `Unknown` slots. (Planned 2026-05-12) - ✅ State 21 naming fix (`WashingMopPause`) — `status()`, `full_status()`, Mission Control API responses, and dashboard state maps now keep the official X20+ state-21 name instead of mislabeling it as `Water Tank Alert`, while still surfacing separate recovery guidance to check/refill the base tanks when that pause appears. Also updated the tank auto-reset heuristic to key off the real state-21 name so the existing estimate-reset behavior keeps working after the label correction. Added TDD regression coverage for the cloud status decoder, `full_status()` alert wiring, Mission Control `/api/status`, tank-update auto-reset logic, and the dashboard HTML state map before implementation. Research notes: the local X20+ MIoT mapping/tests already called state 21 `WashingMopPause`, and the adjacent `openhab/openhab-addons` MIIO binding docs list the same status enum label for `xiaomi.vacuum.c102gl`; that made this a safe terminology/UX fix while preserving the existing tank-service recovery advice. (2026-05-11) - ✅ Estimated cleaning energy from clean logs — `clean_history()` now derives a clearly labeled lifetime energy estimate from the X20+ clean-log totals, and Mission Control plus the rich CLI history surfaces now show that estimate as `kWh @ 75W` so users do not have to do the math manually. Added TDD regression coverage for the cloud-history payload, full-status formatter, report formatter, and dashboard history card before implementation. Research notes: Xiaomi's published `Xiaomi Robot Vacuum X20+` specs list `Rated Power 75W`, the official `xiaomi.vacuum.c102gl` clean-log fields still expose only aggregate cleaning time/count/area, and adjacent Home Assistant energy tooling (`Vortitron/energy-sensor-generator`) reinforced keeping the output explicitly in kWh while labeling it as an estimate rather than measured telemetry. (2026-05-08) - ✅ Room-clean accepted-vs-started diagnostics — `xiao clean`, Mission Control, and the MCP server no longer treat X20+ room-clean `code=0` responses as guaranteed movement. They now share a verification helper that polls follow-up status, warns when the robot still looks docked/charging, and emits CLI exit code `80` for the clearly unresponsive case. Added TDD regression coverage for the shared verification helper plus CLI, dashboard, dashboard API, and MCP surfaces before implementation. Research notes: the official `xiaomi.vacuum.c102gl` MIoT spec still points room cleaning at `siid 2 aiid 3` with room IDs passed as a string param; the `hass-xiaomi-miot` README continues to document a separate `vacuum-extend` `clean-extend-data` path (`siid 4 aiid 1` + `piid 10` JSON payload) for adjacent Dreame/Xiaomi models; and `hass-xiaomi-miot` issue `#2767` shows X20+ users still getting accepted room-clean calls with no actual movement, which confirmed that shipping an accepted-vs-started diagnostic was safer than pretending success. (2026-05-01) diff --git a/src/xiao/dashboard/index.html b/src/xiao/dashboard/index.html index a9cc8b5..ab9d202 100644 --- a/src/xiao/dashboard/index.html +++ b/src/xiao/dashboard/index.html @@ -2947,27 +2947,27 @@

Start cleaning?

${cl.prop4 ?? '--'}
-
4.4 Unknown
+
4.4 Cleaning Mode
${cl.prop5 ?? '--'}
-
4.5 Unknown
+
4.5 Mop Mode
${cl.prop6 ?? '--'}
-
4.6 Unknown
+
4.6 Waterbox Status
${cl.prop7 ?? '--'}
-
4.7 Unknown
+
4.7 Task Status
${cl.prop11 ?? '--'}
-
4.11 Unknown
+
4.11 Resume After Charge
${cl.prop12 ?? '--'}
-
4.12 Unknown
+
4.12 Carpet Boost
diff --git a/tests/test_dashboard.py b/tests/test_dashboard.py index 28927af..470c427 100644 --- a/tests/test_dashboard.py +++ b/tests/test_dashboard.py @@ -109,3 +109,21 @@ def test_dashboard_history_exposes_estimated_cleaning_energy_tile(self): assert "d.estimated_cleaning_energy_display" in html assert "label: 'Est. Energy'" in html + + +class TestDashboardVacuumExtendDiagnosticsCopy: + def test_dashboard_relabels_known_vacuum_extend_fields_in_clean_log_panel(self): + html = _dashboard_html() + + assert "4.4 Cleaning Mode" in html + assert "4.5 Mop Mode" in html + assert "4.6 Waterbox Status" in html + assert "4.7 Task Status" in html + assert "4.11 Resume After Charge" in html + assert "4.12 Carpet Boost" in html + assert "4.4 Unknown" not in html + assert "4.5 Unknown" not in html + assert "4.6 Unknown" not in html + assert "4.7 Unknown" not in html + assert "4.11 Unknown" not in html + assert "4.12 Unknown" not in html