-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue with Rooms Colours and AutoCrop trim data #325
Conversation
WalkthroughThis pull request updates version numbers across the component and introduces a new asynchronous migration function for configuration entries, transitioning from version 3.1 to 3.2. Logging styles have been standardized, and the Changes
Sequence Diagram(s)sequenceDiagram
participant HA as Home Assistant
participant Migrate as async_migrate_entry
participant CE as Config Entry
participant Log as Logger
HA ->> Migrate: Initiate migration for config entry
Migrate ->> Log: Log migration start
Migrate ->> Migrate: Check for existing options
alt Options found
Migrate ->> CE: Update entry with new data and options
Migrate ->> Log: Log successful migration
else No options found
Migrate ->> Log: Log error: migration failed
end
sequenceDiagram
participant Service as vacuum_clean_zone
participant Validator as Validation Logic
participant Log as Logger
Service ->> Validator: Validate service parameters
alt Validation passes
Service ->> Service: Proceed with cleaning zone
else Validation fails
Service ->> Log: Log warning about validation error
Service ->> Service: Continue execution without raising exception
end
Possibly related PRs
📜 Recent review detailsConfiguration used: .coderabbit.yaml 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (2)
custom_components/mqtt_vacuum_camera/utils/vacuum/mqtt_vacuum_services.py (1)
146-152
: Consider keeping validation errors for critical issues.While switching to warning logs makes the code more forgiving, consider keeping ServiceValidationError for critical validation failures that could lead to incorrect behavior.
- _LOGGER.warning("Validation Error: %s", got_error) + if got_error in ["missing_zone_or_zone_ids", "zone_list_length"]: + raise ServiceValidationError( + translation_domain=DOMAIN, + translation_key=got_error, + ) + else: + _LOGGER.warning("Validation Error: %s", got_error)custom_components/mqtt_vacuum_camera/utils/files_operations.py (1)
265-266
: Consider using async method for room data retrieval 🤔The synchronous
get_rooms()
call might block the event loop. Consider using an async method to maintain consistency with Home Assistant's async patterns.- rooms = RoomStore(vacuum_id) - room_data = rooms.get_rooms() + rooms = RoomStore(vacuum_id) + room_data = await rooms.async_get_rooms()
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (8)
custom_components/mqtt_vacuum_camera/__init__.py
(5 hunks)custom_components/mqtt_vacuum_camera/camera.py
(2 hunks)custom_components/mqtt_vacuum_camera/config_flow.py
(3 hunks)custom_components/mqtt_vacuum_camera/const.py
(3 hunks)custom_components/mqtt_vacuum_camera/manifest.json
(1 hunks)custom_components/mqtt_vacuum_camera/utils/MQTT/connector.py
(3 hunks)custom_components/mqtt_vacuum_camera/utils/files_operations.py
(3 hunks)custom_components/mqtt_vacuum_camera/utils/vacuum/mqtt_vacuum_services.py
(2 hunks)
🧰 Additional context used
📓 Learnings (3)
custom_components/mqtt_vacuum_camera/__init__.py (1)
Learnt from: sca075
PR: sca075/mqtt_vacuum_camera#251
File: custom_components/mqtt_vacuum_camera/camera.py:239-245
Timestamp: 2024-11-12T05:06:42.185Z
Learning: Ensure to verify the presence of decorators before suggesting their removal in code reviews.
custom_components/mqtt_vacuum_camera/manifest.json (2)
Learnt from: sca075
PR: sca075/mqtt_vacuum_camera#310
File: custom_components/mqtt_vacuum_camera/manifest.json:10-13
Timestamp: 2025-01-30T23:41:28.893Z
Learning: For packages that are ultimately controlled by Home Assistant's dependency management (like Pillow), it's acceptable to set a future upper version bound to reduce maintenance overhead, as HA will ensure compatibility.
Learnt from: sca075
PR: sca075/mqtt_vacuum_camera#256
File: custom_components/mqtt_vacuum_camera/manifest.json:11-11
Timestamp: 2024-11-12T05:06:42.185Z
Learning: In this project, the `CHANGELOG.md` file is not considered necessary.
custom_components/mqtt_vacuum_camera/config_flow.py (2)
Learnt from: sca075
PR: sca075/mqtt_vacuum_camera#196
File: custom_components/mqtt_vacuum_camera/config_flow.py:352-355
Timestamp: 2024-11-12T05:06:42.185Z
Learning: Changes in `config_flow.py` now include handling for `floor_only` and `alpha_floor` steps based on the number of rooms, ensuring proper configuration and error handling for unexpected values of `number_of_rooms`.
Learnt from: sca075
PR: sca075/mqtt_vacuum_camera#196
File: custom_components/mqtt_vacuum_camera/translations/en.json:132-140
Timestamp: 2024-11-12T05:06:42.185Z
Learning: Changes in `config_flow.py` related to adding steps for `floor_only` and `alpha_floor` configurations resolve the issue with the `floor_only` section in the translation files.
🔇 Additional comments (15)
custom_components/mqtt_vacuum_camera/__init__.py (3)
2-2
: Version bump looks good!Version updated to 2025.2.1 to reflect the new changes.
123-123
: Nice logging format update!Switched to % style formatting for logs, which is more efficient and consistent with Python logging best practices.
Also applies to: 148-148, 154-154
171-203
: 🏁 Script executed:#!/bin/bash # Check for any existing config entries that might need migration rg -A 5 "version.*3\.1" .storage/Length of output: 85
custom_components/mqtt_vacuum_camera/const.py (2)
2-2
: Good addition of trims_data configuration!The new trims_data structure is well-defined with default values for all trim directions.
Also applies to: 99-99
161-161
: Nice integration of trims_data in update keys!Added trims_data to KEYS_TO_UPDATE to ensure it's properly handled during configuration updates.
custom_components/mqtt_vacuum_camera/utils/MQTT/connector.py (2)
60-60
: LGTM! Clean refactor of RoomStore instantiation.The file_name parameter is now passed during RoomStore instantiation instead of per method call, which is a cleaner approach.
254-256
: LGTM! Consistent refactoring of set_rooms calls.The set_rooms method calls have been updated to match the refactored RoomStore interface, removing redundant file_name parameters.
Also applies to: 308-308
custom_components/mqtt_vacuum_camera/camera.py (1)
282-282
: LGTM! More flexible type annotation.Changed return type from
Image.Image
toImage
to be more flexible and less restrictive.custom_components/mqtt_vacuum_camera/config_flow.py (2)
355-357
: LGTM! Consistent RoomStore usage.The RoomStore instantiation and method calls have been updated to match the refactored interface, maintaining consistency across the codebase.
108-108
: Version bump to 3.2.Make sure there's a migration path for users upgrading from version 3.1.
Run this script to check for migration code:
✅ Verification successful
🏁 Script executed:
#!/bin/bash # Description: Check for migration code from version 3.1 to 3.2 # Search for migration code rg -A 5 "async_migrate_entry|async def migrate|VERSION = 3.1"Length of output: 625
Migration code for version bump to 3.2 is in place.
The migration function in init.py correctly checks for version 3.1 and processes an entry upgrade to version 3.2, ensuring a proper migration path for users upgrading from version 3.1.
custom_components/mqtt_vacuum_camera/manifest.json (2)
14-14
: LGTM! Version bump to 2025.2.1.The version follows the year.month.patch format and is consistent across all files.
13-13
: Verify compatibility with valetudo_map_parser 0.1.9.b34.Check the changelog for any breaking changes in the new version.
✅ Verification successful
🌐 Web query:
What are the changes in valetudo_map_parser version 0.1.9.b34?
💡 Result:
The provided search results do not contain specific information about changes in `valetudo_map_parser` version **0.1.9.b34**. While several sources mention Valetudo-related tools and integrations (e.g., Node-RED nodes for map conversion[3][5], development instructions[4], and capabilities documentation[7][8]), none explicitly address this particular version of `valetudo_map_parser`. For details on **version 0.1.9.b34**, you would need to consult: - The GitHub repository for `sca075/Python-package-valetudo-map-parser`[6], which likely contains commit history or release notes for this package. - Official Valetudo documentation or community forums for updates to map-parsing utilities. If this version was released after January 2025 (the latest commit date in result [6]), it may not be reflected in the current search results provided here[1-9]. Citations: - 1: https://github.com/Hypfer/Valetudo/releases - 2: https://newreleases.io/project/github/Hypfer/Valetudo/release/2021.02.0 - 3: https://flows.nodered.org/node/node-red-contrib-valetudo - 4: https://valetudo.cloud/pages/development/building-and-modifying-valetudo.html - 5: https://truecharts.org/charts/stable/valetudo-mapper/ - 6: https://github.com/sca075/Python-package-valetudo-map-parser - 7: https://valetudo.cloud/pages/usage/capabilities-overview.html - 8: https://valetudo.cloud/pages/general/supported-robots.html - 9: https://community.home-assistant.io/t/valetudo-map-card-installation-instructions/247329?page=2
Update on valetudo_map_parser 0.1.9.b34 Compatibility
Based on the web search, there isn't any explicit documentation showing breaking changes or incompatibilities with version 0.1.9.b34. While detailed release notes weren't found in the available search results, it’s a good idea to verify the upstream GitHub repository (sca075/Python-package-valetudo-map-parser) for any commit-level details or notes that might impact compatibility.
- The dependency update on line 13 appears in line with the overall update (as the version in the manifest follows the year.month.patch scheme).
- No explicit breaking changes have been identified from the available sources.
- I recommend a quick manual check of the official release notes on the GitHub repo for peace of mind.
Everything seems cool so far!
custom_components/mqtt_vacuum_camera/utils/files_operations.py (3)
7-7
: Version number looks good! 🚀The version has been updated to
2025.02.1
, which aligns with the current date.
289-312
: Sweet improvements to room handling! 🎯Nice enhancements:
- Preserved original room order
- Added fallback for missing room names
- Cleaned up unused entries for better data hygiene
284-343
: Error handling is on point! 💪Great improvements to error handling and user feedback:
- More informative warning messages for missing translations
- Better language fallback mechanism
…075/refactoring_camera updated manifest with the correct version of map_parser
Issue with Rooms Colours and AutoCrop trim data solved in the libray valetudo_map_parser. Still need to complete the reset and save trims phase.
Summary by CodeRabbit
New Features
• Improved migration process for a smoother configuration upgrade.
• Enhanced camera integration with additional attributes for clearer device status and functionality.
Bug Fixes / Enhancements
• Refined error handling in service operations to reduce disruptions.
• Streamlined room management and renaming for improved setup experience.
Chores
• Updated version numbers, dependencies, and configuration defaults for overall stability.
• Added new configuration key for improved settings management.
• Adjusted logging for better clarity during operations.