Skip to content

feat(sensor): add "last clean result" sensor#53

Draft
jgus wants to merge 2 commits into
sjmotew:masterfrom
jgus:feat/last-clean-result
Draft

feat(sensor): add "last clean result" sensor#53
jgus wants to merge 2 commits into
sjmotew:masterfrom
jgus:feat/last-clean-result

Conversation

@jgus

@jgus jgus commented Jun 15, 2026

Copy link
Copy Markdown

⚠️ Stacked on #52. Until #52 merges, this PR's diff includes its commits;
opened as a draft and will be marked ready (diff narrowing to just this feature)
once #52 lands in master.

Summary

Surfaces base_status field 15 (terminateReason) as an enum sensor that
explains why the last task ended — Completed, Ended (low battery), Stopped by
user, etc. — mapping the decoded TaskResult values to readable states.

Depends on #52

Builds on the corrected update_from_base_status from #52. Review/merge that
first; this branch is based on it (will rebase onto master once it lands).

How it was derived

TaskResult values from the app's decoded enum; live-confirmed f15=1 → NORMAL_END.

Testing

tests/test_models.py updated; suite green.

Relates to

jgus and others added 2 commits June 15, 2026 12:29
…gnostics

Decoded the full RobotBaseStatus proto and corrected mislabeled fields
parsed into state: battery_health→curingAgentConsumptionPercent (f38),
session_id→bindedUuid (f13), timestamp→stationBagHealthResetTime (f36),
upgrade status (read f2, not f4=stage), download state (read f3, not
f1=type); BaseStatusField/UpgradeStatusField enums corrected to match.

Added diagnostics from fields the robot already broadcasts:
  - sensors: dust bag health (f35), detergent remaining (f41)
  - binary_sensors (problem, field-gated): error/fault (f1, exposing
    code/level/detail + a best-effort help-center link), clean-water and
    sewage tanks, dust box, dust bag, station dust bag

Binary sensors are now description-driven; ha_stubs gains the
BinarySensorEntityDescription stub for the new tests.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Surface base_status field 15 (terminateReason) as an enum sensor mapping
the decoded TaskResult values to readable outcomes (Completed, Ended (low
battery), Stopped by user, …) — i.e. why the last task ended. Live-
confirmed: f15=1 → NORMAL_END.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant