-
-
Notifications
You must be signed in to change notification settings - Fork 963
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
Add new vacuum state property and enum #2360
base: master
Are you sure you want to change the base?
Conversation
📝 WalkthroughWalkthroughThe documentation for vacuum state management has been revised to indicate the deprecation of the Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant MyVacuumCleaner
participant VacuumEntity
participant VacuumEntityState
User->>MyVacuumCleaner: Request vacuum state
MyVacuumCleaner->>VacuumEntity: Get vacuum_state
VacuumEntity->>VacuumEntityState: Return current state
VacuumEntityState-->>MyVacuumCleaner: Return state value
MyVacuumCleaner-->>User: Provide vacuum state
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
CodeRabbit Configuration File (
|
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
🧹 Outside diff range and nitpick comments (4)
blog/2024-10-13-new-vacuum-state-property.md (2)
9-13
: Minor grammatical correction needed.Add a comma after "enum" on line 10 for better readability. Consider rewording the second sentence for clarity:
-As of Home Assistant Core 2024.11, the constants used to return state in `StateVacuumEntity` are deprecated and replaced by the `VacuumEntityState` enum. +As of Home Assistant Core 2024.11, the constants used to return state in `StateVacuumEntity` are deprecated and replaced by the `VacuumEntityState` enum. -Also with this change, integrations should set the `vacuum_state` property instead of directly setting the `state` property. +With this change, integrations should now set the `vacuum_state` property instead of directly setting the `state` property.The deprecation notice is clear and helpful for integration authors.
🧰 Tools
🪛 LanguageTool
[uncategorized] ~10-~10: Possible missing comma found.
Context: ...laced by theVacuumEntityState
enum. Also with this change, integrations should s...(AI_HYDRA_LEO_MISSING_COMMA)
15-31
: Code example is clear and accurate.The example effectively demonstrates the new usage of
VacuumEntityState
enum and the implementation of thevacuum_state
property. To enhance clarity for readers, consider adding a brief note about theStateVacuumEntity
class:+# StateVacuumEntity is a base class for vacuum entities that use predefined states class MyVacuumCleaner(StateVacuumEntity): """My vacuum cleaner."""
This addition would provide context for readers who might be unfamiliar with the class hierarchy.
docs/core/entity/vacuum.md (2)
25-25
: Enhance the description of thevacuum_state
property.The introduction of the
vacuum_state
property aligns with the PR objectives. However, the description could be more informative.Consider expanding the description to provide more context:
-| vacuum_state | VacuumEntityState | **Required** | Return one of the states listed in the states section. +| vacuum_state | VacuumEntityState | **Required** | Return the current state of the vacuum. This property replaces the deprecated `state` property and uses the `VacuumEntityState` enum for more structured state representation.
29-38
: Add deprecation notice and migration guidance for state constants.The updated States section correctly reflects the new
VacuumEntityState
enum. However, it's important to provide information about the deprecation of the old constants and guidance for migration.Consider adding the following information before the table:
:::warning Deprecation Notice The old state constants (e.g., `STATE_CLEANING`, `STATE_DOCKED`) are deprecated and will be removed in Home Assistant Core 2024.11. Please update your custom components to use the new `VacuumEntityState` enum values. ::: Example of migrating from old constants to the new enum: ```python from homeassistant.components.vacuum import ( StateVacuumEntity, VacuumEntityState ) class MyVacuum(StateVacuumEntity): @property def vacuum_state(self) -> VacuumEntityState: if self._is_cleaning: return VacuumEntityState.CLEANING elif self._is_docked: return VacuumEntityState.DOCKED # ... other states ...</blockquote></details> </blockquote></details> <details> <summary>📜 Review details</summary> **Configuration used: CodeRabbit UI** **Review profile: CHILL** <details> <summary>📥 Commits</summary> Files that changed from the base of the PR and between 570a91bcd2430ec2064bd47b931085c66cf5c31b and 98a51652ce85058b041daeb846f57e7700f85dd7. </details> <details> <summary>📒 Files selected for processing (2)</summary> * blog/2024-10-13-new-vacuum-state-property.md (1 hunks) * docs/core/entity/vacuum.md (1 hunks) </details> <details> <summary>🧰 Additional context used</summary> <details> <summary>📓 Path-based instructions (1)</summary><blockquote> <details> <summary>blog/2024-10-13-new-vacuum-state-property.md (6)</summary> Pattern `*/**(html|markdown|md)`: - For instructional content in documentation, use a direct and authoritative tone. Avoid expressions of politeness such as 'may' or 'please', and ensure the goal of the instruction is fronted. - Apply the Microsoft Style Guide to ensure documentation maintains clarity and conciseness. - In step-by-step instructions, front the location phrase in the instructional sentence. - In step-by-step instructions, front the 'goal' in the instructional sentence. - In step-by-step instructions, if in doubt what to front, front the 'goal' before the location phrase in the instructional sentence. - do not hyphenate terms like 'top-right' or 'bottom-left' with 'corner' --- Pattern `*/**(html|markdown|md)`: - Use bold to mark UI strings. - If "" are used to mark UI strings, replace them by bold. --- Pattern `*/**(html|markdown|md)`: - Be brief in your replies and don't add fluff like "thank you for..." and "Please let me know if" --- Pattern `*/**(html|markdown|md)`: - Use sentence-style capitalization also in headings. --- Pattern `*/**(html|markdown|md)`: do not comment on HTML used for icons --- Pattern `*/**(html|markdown|md)`: Avoid flagging inline HTML for embedding videos in future reviews for this repository. </details> </blockquote></details> <details> <summary>🪛 LanguageTool</summary><blockquote> <details> <summary>blog/2024-10-13-new-vacuum-state-property.md</summary><blockquote> [uncategorized] ~10-~10: Possible missing comma found. Context: ...laced by the `VacuumEntityState` enum. Also with this change, integrations should s... (AI_HYDRA_LEO_MISSING_COMMA) </blockquote></details> </blockquote></details> </details> <details> <summary>🔇 Additional comments (5)</summary><blockquote> <details> <summary>blog/2024-10-13-new-vacuum-state-property.md (3)</summary><blockquote> `1-7`: **Front matter looks good.** The metadata is well-structured and provides comprehensive author information. --- `33-33`: **Documentation link is correct and helpful.** The link to additional vacuum documentation is properly formatted and provides a valuable resource for readers seeking more detailed information. --- `1-33`: **Overall, excellent blog post on vacuum state property changes.** The blog post effectively communicates the important changes to vacuum state management in Home Assistant Core 2024.11. It provides clear information about deprecation, introduces the new `VacuumEntityState` enum, and demonstrates its usage with a helpful code example. The content is well-structured and informative, making it valuable for integration authors and users alike. The minor suggestions provided in the previous comments will further enhance the clarity and readability of this already strong documentation. <details> <summary>🧰 Tools</summary> <details> <summary>🪛 LanguageTool</summary><blockquote> [uncategorized] ~10-~10: Possible missing comma found. Context: ...laced by the `VacuumEntityState` enum. Also with this change, integrations should s... (AI_HYDRA_LEO_MISSING_COMMA) </blockquote></details> </details> </blockquote></details> <details> <summary>docs/core/entity/vacuum.md (2)</summary><blockquote> Line range hint `1-95`: **Summary of changes and next steps** The documentation for the Vacuum entity has been updated to reflect the new `vacuum_state` property and the `VacuumEntityState` enum. These changes align with the PR objectives and enhance the state representation for vacuum entities. Next steps: 1. Implement the suggested improvements to the property description and state section. 2. Add the deprecation notice and migration guidance for the old state constants. 3. Review the unchanged sections (Supported features and Methods) to ensure consistency with the new state representation. 4. Run the provided verification script to check for potential inconsistencies in the core code. Once these steps are completed, the documentation will provide a comprehensive and up-to-date guide for implementing and using the Vacuum entity in Home Assistant. --- Line range hint `40-95`: **Review unchanged sections for potential updates.** While the Supported features and Methods sections remain unchanged, it might be beneficial to review them for consistency with the new state representation. Please verify if any updates are needed in these sections, particularly: 1. In the Supported features section, check if the `VacuumEntityFeature.STATE` flag is still relevant or if it needs to be updated. 2. In the Methods section, confirm if any new methods need to be added or if existing methods need to be updated to work with the new `vacuum_state` property. To assist with this verification, you can run the following script: </blockquote></details> </blockquote></details> </details> <!-- This is an auto-generated comment by CodeRabbit for review status -->
Proposed change
Add new state property for
vacuum
.Also new enum for return values
Core PR: home-assistant/core#126353
Type of change
Additional information
Summary by CodeRabbit
New Features
vacuum_state
property for improved vacuum state management.Documentation
state
property and provided migration guidance.