Skip to content

Add custom Roborock component with MQTT reconnect fix (python-roborock 4.18.1) - #1

Merged
ncecowboy merged 3 commits into
mainfrom
copilot/fix-mqtt-timeout-issues
Mar 9, 2026
Merged

Add custom Roborock component with MQTT reconnect fix (python-roborock 4.18.1)#1
ncecowboy merged 3 commits into
mainfrom
copilot/fix-mqtt-timeout-issues

Conversation

Copilot AI commented Mar 9, 2026

Copy link
Copy Markdown
  • Understand the MQTT timeout issue (Roborock re-auth loop: RoborockException: parameter error - response code: 1002 on Core 2026.3.0 (Python 3.14) home-assistant/core#164865): MQTT reconnects too eagerly when there are no active subscribers, leading to rate limiting and forced reauth
  • Identify the fix: python-roborock==4.18.1 includes the fix (PR #779: "don't reconnect on no active subscribers")
  • Copy HA core Roborock integration files into custom_components/roborock/
  • Update manifest.json to use python-roborock==4.18.1 (with the MQTT fix) and add version field for HACS
  • Add hacs.json for HACS compatibility
  • Update README with problem description, fix details, and installation instructions
  • Fix diagnostics.py docstring: "Airzone" → "Roborock"
  • Fix coordinator.py: remove duplicate dust_collection_mode entry in trait refresh list
  • Fix coordinator.py: typo "currenltly" → "currently"
  • Fix services.yaml: change x/y selector from text to number (with min/max/step/mode)
  • Fix quality_scale.yaml: typo "homoe assistant" → "Home Assistant"
  • Fix strings.json: grammar "You have not valid" → "You do not have a valid"
Original prompt

I'd like to work on a fix for the Home Assistant Core Integration, Roborock, to fix the MQTT timeout problems listed in issue home-assistant/core#164865. We'll need to copy the original integration into this repository, then work on fixing the MQTT issue.


🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

…oborock==4.18.1)

Co-authored-by: ncecowboy <25276164+ncecowboy@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix MQTT timeout problems in Roborock integration Add custom Roborock component with MQTT reconnect fix (python-roborock 4.18.1) Mar 9, 2026
@ncecowboy
ncecowboy marked this pull request as ready for review March 9, 2026 17:29
Copilot AI review requested due to automatic review settings March 9, 2026 17:29

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds a custom (HACS-installable) copy of Home Assistant’s Roborock integration, primarily to pick up python-roborock==4.18.1 which includes an MQTT reconnect/backoff fix to prevent re-auth/rate-limit loops when there are no active MQTT subscribers.

Changes:

  • Added a full custom_components/roborock integration copy (config flow, coordinators, entities, services, translations).
  • Bumped dependency pin to python-roborock==4.18.1 and added a component version for HACS.
  • Added HACS metadata (hacs.json) and updated README.md with problem/fix/install documentation.

Reviewed changes

Copilot reviewed 25 out of 25 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
hacs.json Adds HACS repository metadata for the custom integration.
README.md Documents the MQTT reconnect problem, the upstream fix, and installation steps.
custom_components/roborock/init.py Sets up the integration, device manager, runtime coordinators, and platform forwarding.
custom_components/roborock/binary_sensor.py Adds Roborock binary sensor entities and descriptions.
custom_components/roborock/button.py Adds Roborock button entities (consumables, routines, A01 devices).
custom_components/roborock/config_flow.py Implements config/reauth flows and options flow.
custom_components/roborock/const.py Defines integration constants, platforms, and polling intervals.
custom_components/roborock/coordinator.py Adds update coordinators for multiple device families and trait refresh logic.
custom_components/roborock/diagnostics.py Adds config entry diagnostics with redaction.
custom_components/roborock/entity.py Adds common entity base classes and coordinated entity helpers.
custom_components/roborock/icons.json Provides icon translations for entities and services.
custom_components/roborock/image.py Adds map image entities backed by coordinator/home traits.
custom_components/roborock/manifest.json Declares integration metadata and pins python-roborock==4.18.1.
custom_components/roborock/models.py Defines integration data models (device info/state/map info).
custom_components/roborock/number.py Adds numeric configuration entities (e.g., volume).
custom_components/roborock/quality_scale.yaml Declares integration quality scale checklist/status.
custom_components/roborock/roborock_storage.py Adds cache/map storage via HA Store and cleanup for legacy map storage.
custom_components/roborock/select.py Adds select entities for multiple device types (V1/B01/A01) and map selection.
custom_components/roborock/sensor.py Adds sensor entities for multiple device families and diagnostics.
custom_components/roborock/services.py Registers entity services (maps, goto position, current position).
custom_components/roborock/services.yaml Declares service UI metadata for the integration’s services.
custom_components/roborock/strings.json Adds translations for config flow, entities, services, and exceptions.
custom_components/roborock/switch.py Adds switch entities for V1 and A01 devices.
custom_components/roborock/time.py Adds time entities (DND/off-peak timers).
custom_components/roborock/vacuum.py Adds vacuum entities and vacuum-specific services (segments, maps, goto position).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@@ -0,0 +1,46 @@
"""Support for the Airzone diagnostics."""

Copilot AI Mar 9, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The docstring references “Airzone” instead of Roborock, which is misleading for diagnostics/debugging. Please update it to reflect the Roborock integration.

Copilot uses AI. Check for mistakes.
Comment on lines +214 to +223
self.properties_api.clean_summary,
self.properties_api.dnd,
self.properties_api.dust_collection_mode,
self.properties_api.wash_towel_mode,
self.properties_api.smart_wash_params,
self.properties_api.sound_volume,
self.properties_api.child_lock,
self.properties_api.dust_collection_mode,
self.properties_api.flow_led_status,
self.properties_api.valley_electricity_timer,

Copilot AI Mar 9, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dust_collection_mode appears twice in the trait refresh list, which causes redundant refresh calls and extra load. Remove the duplicate entry so each trait is refreshed only once per update cycle.

Copilot uses AI. Check for mistakes.
Comment on lines +464 to +465
# This currenltly only supports the WetDryVac protocols
self.request_protocols: list[RoborockDyadDataProtocol] = [

Copilot AI Mar 9, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo in comment (“currenltly”). Please correct to “currently” to keep comments professional and searchable.

Copilot uses AI. Check for mistakes.
Comment on lines +11 to +23
fields:
x:
example: 27500
required: true
selector:
text:
type: number
y:
example: 32000
required: true
selector:
text:
type: number

Copilot AI Mar 9, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The service YAML declares x/y with a text selector even though the service schema coerces them to int. This mismatch can lead to a confusing UI and invalid input handling. Use a number selector (optionally with min/max/step) to reflect the expected integer coordinates.

Copilot uses AI. Check for mistakes.
Comment on lines +55 to +58
comment: |
The docs describe controlling the vacuum, though does not describe more
interesting potential integrations with the homoe assistant ecosystem.
dynamic-devices: todo

Copilot AI Mar 9, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo in comment (“homoe assistant”). Please correct to “Home Assistant” to avoid spelling mistakes in repository docs/metadata.

Copilot uses AI. Check for mistakes.
Comment on lines +633 to +635
"no_user_agreement": {
"message": "You have not valid user agreement. Open your Roborock app and accept the agreement."
},

Copilot AI Mar 9, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The no_user_agreement exception message is grammatically incorrect (“You have not valid…”), which will be shown to users. Please update it to a correct phrasing (e.g., “You do not have a valid user agreement …”).

Copilot uses AI. Check for mistakes.
@ncecowboy

Copy link
Copy Markdown
Owner

@copilot apply changes based on the comments in this thread

…er selector, grammar fix

Co-authored-by: ncecowboy <25276164+ncecowboy@users.noreply.github.com>

Copilot AI commented Mar 9, 2026

Copy link
Copy Markdown
Author

@copilot apply changes based on the comments in this thread

Applied all 6 review comments in commit fc04648:

  • diagnostics.py: Fixed docstring "Airzone""Roborock"
  • coordinator.py: Removed duplicate dust_collection_mode entry from trait refresh list
  • coordinator.py: Fixed typo "currenltly""currently"
  • services.yaml: Changed x/y selectors from text to number (with min: 0, max: 65000, step: 1, mode: box)
  • quality_scale.yaml: Fixed typo "homoe assistant""Home Assistant"
  • strings.json: Fixed grammar "You have not valid user agreement""You do not have a valid user agreement"

@ncecowboy
ncecowboy merged commit 842faf1 into main Mar 9, 2026
@ncecowboy
ncecowboy deleted the copilot/fix-mqtt-timeout-issues branch March 9, 2026 17:57
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.

3 participants