Conversation
Summary of ChangesHello @chipp, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request addresses an issue with room ID assignments by remapping existing room types and introducing new ones to ensure consistency and accommodate additional room definitions. It also includes a new utility script designed to retrieve and display room mappings from Roborock devices, which will be instrumental in validating and understanding the updated room ID scheme. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request updates the room ID mappings in the Rust code and adds a Python script, presumably used to discover the correct mappings. The core logic change to fix the room IDs is correct. I've added a couple of suggestions to improve code quality: one to enhance readability in the Rust mapping function by sorting the match arms, and another to remove some redundant code from the new Python script.
| 16 => Some(transport::Room::Bathroom), | ||
| 17 => Some(transport::Room::Bedroom), | ||
| 18 => Some(transport::Room::LivingRoom), | ||
| 19 => Some(transport::Room::Kitchen), | ||
| 20 => Some(transport::Room::Hallway), | ||
| 23 => Some(transport::Room::Corridor), | ||
| 24 => Some(transport::Room::Hallway), | ||
| 21 => Some(transport::Room::HomeOffice), | ||
| 19 => Some(transport::Room::Kitchen), | ||
| 18 => Some(transport::Room::LivingRoom), | ||
| 22 => Some(transport::Room::Toilet), |
There was a problem hiding this comment.
For better readability and maintainability, it's a good practice to sort the match arms by the integer value. This makes it easier to find a specific ID and to spot any missing or overlapping ranges.
| 16 => Some(transport::Room::Bathroom), | |
| 17 => Some(transport::Room::Bedroom), | |
| 18 => Some(transport::Room::LivingRoom), | |
| 19 => Some(transport::Room::Kitchen), | |
| 20 => Some(transport::Room::Hallway), | |
| 23 => Some(transport::Room::Corridor), | |
| 24 => Some(transport::Room::Hallway), | |
| 21 => Some(transport::Room::HomeOffice), | |
| 19 => Some(transport::Room::Kitchen), | |
| 18 => Some(transport::Room::LivingRoom), | |
| 22 => Some(transport::Room::Toilet), | |
| 16 => Some(transport::Room::Bathroom), | |
| 17 => Some(transport::Room::Bedroom), | |
| 18 => Some(transport::Room::LivingRoom), | |
| 19 => Some(transport::Room::Kitchen), | |
| 21 => Some(transport::Room::HomeOffice), | |
| 22 => Some(transport::Room::Toilet), | |
| 23 => Some(transport::Room::Corridor), | |
| 24 => Some(transport::Room::Hallway), |
| if not hasattr(enum, "StrEnum"): | ||
| class StrEnum(str, enum.Enum): | ||
| pass | ||
|
|
||
| enum.StrEnum = StrEnum # type: ignore[attr-defined] |

TL;DR
Added Bathroom and Toilet rooms to the room mapping and updated room IDs to match the vacuum's configuration.
What changed?
Bathroom(ID: 16) andToilet(ID: 22) to the room mapping functionsget_room_mapping_local.pyto help retrieve room mappings from the Roborock vacuumHow to test?
Why make this change?
The room IDs in the code were out of sync with the actual room configuration on the vacuum. This change ensures that the application correctly maps room IDs to their corresponding physical spaces, adding support for Bathroom and Toilet rooms that were previously missing. The new script provides a way to easily retrieve and verify room mappings directly from the vacuum for future updates.