Add per-map rotation support with select entity and calibrated overlays#37
Add per-map rotation support with select entity and calibrated overlays#37Lash-L merged 7 commits intoLash-L:mainfrom
Conversation
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.
|
Sorry for the delay! I will give this a try and review (hopefully) tomorrow |
|
Sorry.... Tomorrow != One month later. Looking at this right now. code looks fine from what i can see, i'll see if copilot finds anything. Testing out on my instance now. |
There was a problem hiding this comment.
Pull request overview
This PR adds per-map rotation support to the Roborock Custom Map integration by introducing a per-map Select entity that controls image rotation and applies the same rotation to calibration points so map overlays/interactions remain aligned.
Changes:
- Add a Select entity per map to choose rotation (0/90/180/270) and persist it across restarts.
- Rotate map PNG bytes in an executor thread and rotate calibration “map” points accordingly.
- Add English/German translations and document usage in the README.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| custom_components/roborock_custom_map/translations/en.json | Adds Select entity name/state translations for rotation. |
| custom_components/roborock_custom_map/translations/de.json | Adds German translations for the rotation Select entity. |
| custom_components/roborock_custom_map/select.py | Introduces per-map rotation Select entity with restore support and dispatcher signaling. |
| custom_components/roborock_custom_map/image.py | Applies rotation to served PNG bytes and rotates calibration points to match. |
| custom_components/roborock_custom_map/const.py | Adds constants for rotation options and dispatcher signal name. |
| custom_components/roborock_custom_map/init.py | Registers SELECT platform and stores per-entry rotation state in hass.data. |
| README.md | Documents new map rotation feature and how to use it. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|
Thankss @TheHangMan97! So sorry for the delay, but this is very much appreciated! |
Overview
This PR adds per-map rotation support to the Roborock Custom Map integration.
Instead of handling rotation in the frontend, this implementation introduces a
dedicated Select entity per map that allows users to rotate the map image
directly within Home Assistant.
What’s new
Why this approach
Frontend-only rotation (CSS/card-mod) rotates only the rendered pixels and
does not adjust calibration or interaction coordinates.
This implementation rotates:
so overlays and interactions (rooms, zones, taps) stay aligned.
Technical details
hass.datapermap_flagRestoreEntityfor persistenceasync_add_executor_jobBackwards compatibility
Tested with