Skip to content

Fix rotation conflicts between multiple Roborock devices#40

Open
TheHangMan97 wants to merge 11 commits into
Lash-L:mainfrom
TheHangMan97:main
Open

Fix rotation conflicts between multiple Roborock devices#40
TheHangMan97 wants to merge 11 commits into
Lash-L:mainfrom
TheHangMan97:main

Conversation

@TheHangMan97
Copy link
Copy Markdown
Contributor

Overview
This PR fixes a rotation state conflict when multiple Roborock devices are used with the integration.
Previously, rotation values were stored only by map_flag. Since multiple Roborock devices can share the same map_flag values, changing the rotation on one robot could unintentionally affect another robot. #39

Fix
Rotation state and dispatcher signals are now isolated per device and map by using a combined key:

f"{coordinator.duid_slug}_{map_flag}"

instead of only:
map_flag

Included changes

  • Fix rotation state collisions between multiple Roborock devices
  • Isolate dispatcher update signals per robot/map
  • Keep rotation persistence working correctly
  • Fix thread-safe state updates for rotation changes
  • Maintain compatibility with existing setups

Result
Rotation settings are now fully independent for each robot and map.

A user with multiple Roborock devices has successfully tested and confirmed the fix 😊

TheHangMan97 and others added 11 commits February 22, 2026 10:24
Introduce rotation configuration constants for map image handling.
Adds rotation options (0, 90, 180, 270) and dispatcher signal name.
Add SelectEntity to control map rotation per map_flag.
Rotation value is persisted via RestoreEntity and stored in hass.data.
Dispatcher signal notifies image entities when rotation changes.
Register SELECT platform and initialize rotation storage in hass.data.
Add proper unload cleanup and reload behavior.
Implement backend image rotation using Pillow.
Rotation is applied in async_add_executor_job to avoid blocking the event loop.
Includes defensive validation and fallback handling.
Add English and German translations for map rotation select entity.
Includes user-friendly labels for rotation options.
Add documentation for the per-map rotation select entity.

Explains:
- How to rotate maps (0/90/180/270)
- Where to find the rotation select entity
- That calibration points are rotated as well
- That no reload is required

Also clarifies usage with Xiaomi Vacuum Map Card.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This prevents multiple Roborock devices with identical map_flag values
from sharing rotation state and dispatcher signals.
I found and fixed a thread-safety issue in the rotation update signal.

The image entity now schedules the state update back onto the Home Assistant event loop before calling `async_write_ha_state()`, instead of calling it directly from the dispatcher callback.
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.

2 participants