home-assistant / intents

Intents to be used with Home Assistant
https://developers.home-assistant.io/docs/voice/overview/
Creative Commons Attribution 4.0 International
444 stars 503 forks source link

[RU]optimizations of the Cover classes #2241

Closed mitrokun closed 2 months ago

mitrokun commented 2 months ago

Transferring intents and tests to relevant files. Implementing a position setting feature. Enhancing responses for classes.

Summary by CodeRabbit

coderabbitai[bot] commented 2 months ago
Walkthrough ## Walkthrough This update enhances the Russian language support for home automation commands in `Home Assistant` by introducing new responses and intents, refining several existing intents for cover devices such as curtains and blinds, and adding comprehensive test cases. The modifications primarily involve dynamic responses based on device classes and context-specific commands for turning covers on or off and setting their positions. ## Changes | Files/Paths | Change Summaries | |------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | `responses/ru/HassSetPosition.yaml` | Added a Russian language response for the `HassSetPosition` intent with the default message "Положение задано". | | `responses/ru/HassTurnOff.yaml` | Modified `cover_device_class` response to dynamically select translations based on `device_class`. | | `sentences/ru/_common.yaml` | Enhanced regex patterns for identifying entities like lights, fans, covers, and windows, and defining associated categories. | | `sentences/ru/cover_HassSetPosition.yaml` | Added intents for setting cover positions, including variations for specifying cover types by name, device class, and area. | | `sentences/ru/cover_HassTurnOff.yaml`, `sentences/ru/cover_HassTurnOn.yaml` | Restructured intents to handle turning on/off cover devices, including context requirements for areas and device classes while refining response handling and slot usage. | | `sentences/ru/homeassistant_HassTurnOff.yaml` | Modified off intents by excluding specific domains like binary sensors, covers, scenes, scripts, and sensors. | | `tests/ru/cover_HassSetPosition.yaml` | Introduced test cases for setting cover positions in Russian, verifying intent recognition and response generation. | | `tests/ru/cover_HassTurnOff.yaml` | Updated test scenarios for turning off cover devices, adjusting intent names, slot definitions, and response messages. | | `tests/ru/cover_HassTurnOn.yaml` | Added new test scenarios for turning on cover devices, tailoring responses to different areas and device classes. | | `tests/ru/homeassistant_HassTurnOff.yaml`, `tests/ru/homeassistant_HassTurnOn.yaml` | Removed specific intent configurations and mappings related to turning on/off various cover devices in the test scenarios. |

Recent review details **Configuration used: CodeRabbit UI** **Review profile: ASSERTIVE**
Commits Files that changed from the base of the PR and between 8f0d47eb7635aa1b8fc3d9659bdc2ec71cf00da7 and 12283bcd51c04c1d087398bedb6bd8489ca506fc.
Files selected for processing (14) * responses/ru/HassSetPosition.yaml (1 hunks) * responses/ru/HassTurnOff.yaml (1 hunks) * responses/ru/HassTurnOn.yaml (1 hunks) * sentences/ru/_common.yaml (4 hunks) * sentences/ru/cover_HassSetPosition.yaml (1 hunks) * sentences/ru/cover_HassTurnOff.yaml (1 hunks) * sentences/ru/cover_HassTurnOn.yaml (1 hunks) * sentences/ru/homeassistant_HassTurnOff.yaml (1 hunks) * sentences/ru/homeassistant_HassTurnOn.yaml (1 hunks) * tests/ru/cover_HassSetPosition.yaml (1 hunks) * tests/ru/cover_HassTurnOff.yaml (1 hunks) * tests/ru/cover_HassTurnOn.yaml (1 hunks) * tests/ru/homeassistant_HassTurnOff.yaml (1 hunks) * tests/ru/homeassistant_HassTurnOn.yaml (1 hunks)
Additional comments not posted (29)
responses/ru/HassSetPosition.yaml (1)
`1-5`: **LGTM!** The response for the `HassSetPosition` intent is correctly localized and matches the intended functionality.
tests/ru/homeassistant_HassTurnOff.yaml (1)
Line range hint `1-7`: **LGTM!** The test cases for the `HassTurnOff` intent are correctly localized and effectively test the functionality.
sentences/ru/homeassistant_HassTurnOn.yaml (1)
Line range hint `1-6`: **LGTM!** The exclusions for the `HassTurnOn` intent are well-defined and help in refining the intent's scope.
tests/ru/homeassistant_HassTurnOn.yaml (1)
Line range hint `1-7`: **LGTM!** The test cases for the `HassTurnOn` intent are correctly localized and effectively test the functionality.
sentences/ru/homeassistant_HassTurnOff.yaml (1)
`7-13`: **Verify the exclusion of certain domains for HassTurnOff intent.** The exclusion of domains like `binary_sensor`, `cover`, `scene`, `script`, `sensor` from the HassTurnOff intent could have significant implications on the functionality. Ensure that this aligns with the intended use cases and does not inadvertently prevent necessary actions.
sentences/ru/cover_HassSetPosition.yaml (1)
`1-16`: **Review of new intent definitions for HassSetPosition.** The addition of sentences and context requirements for the cover domain in the HassSetPosition intent is a crucial update. Ensure that the sentences are correctly formatted and that the domain-specific slots are properly defined to capture the necessary details for position settings.
tests/ru/cover_HassSetPosition.yaml (1)
`1-23`: **Review of new test cases for HassSetPosition.** The new test cases for the HassSetPosition intent are well-defined, covering various scenarios including different areas and device classes. Ensure that these tests are executed to verify the intent recognition and response accuracy.
sentences/ru/cover_HassTurnOn.yaml (1)
`6-36`: **Review of new sentences and responses for HassTurnOn.** The addition of new sentences and the specification of required context and responses for the HassTurnOn intent are crucial for handling different scenarios within the cover domain. Ensure that these definitions are correctly aligned with the domain requirements and that the responses are appropriately set for the various contexts.
sentences/ru/cover_HassTurnOff.yaml (5)
`6-9`: **LGTM!** The intent structure for simple off commands is well-defined and correctly assigns the domain as 'cover'. --- `11-14`: **LGTM!** The extended intent structure to include area context is correctly implemented, enhancing the specificity of the command. --- `16-20`: **LGTM!** The intent for specific device classes such as garage doors is correctly structured with appropriate slots for 'device_class' and 'domain'. --- `22-26`: **LGTM!** The dynamic handling of device classes and areas through slots is well implemented, maintaining consistency with the domain. --- `29-36`: **LGTM!** Adding context requirements for areas in this intent block enhances clarity and specificity in commands.
tests/ru/cover_HassTurnOn.yaml (6)
`4-13`: **LGTM!** The test case for raising a left curtain is well-structured with appropriate intent, slots, and response settings. --- `15-26`: **LGTM!** The test case for opening a left curtain in the living room is correctly structured with a specific response to the area, enhancing the test's relevance. --- `28-35`: **LGTM!** The test case for opening garage gates is correctly structured with appropriate slots and a specific response. --- `37-46`: **LGTM!** The test case for raising blinds in the kitchen is well-structured with appropriate slots and a specific response. --- `49-58`: **LGTM!** The test case for opening blinds in the kitchen, using a different sentence structure, is consistent with the domain and device class specifications. --- `60-69`: **LGTM!** The test case for opening curtains in a hall is well-structured with appropriate context, slots, and a specific response.
tests/ru/cover_HassTurnOff.yaml (6)
`4-12`: **LGTM!** The test case for lowering a left curtain is well-structured with appropriate intent, slots, and response settings. --- `14-25`: **LGTM!** The test case for closing a left curtain in the living room is correctly structured with a specific response to the area, enhancing the test's relevance. --- `27-33`: **LGTM!** The test case for closing garage doors is correctly structured with appropriate slots and a specific response. --- `35-45`: **LGTM!** The test case for lowering blinds in the bedroom is well-structured with appropriate slots and a specific response. --- `47-56`: **LGTM!** The test case for closing blinds in the bedroom, using a different sentence structure, is consistent with the domain and device class specifications. --- `58-68`: **LGTM!** The test case for closing curtains in a hall is well-structured with appropriate context, slots, and a specific response.
responses/ru/HassTurnOff.yaml (1)
`55-71`: **Excellent localization improvement!** The dynamic response generation based on the device class using a dictionary for translations significantly enhances the localization and user experience.
responses/ru/HassTurnOn.yaml (1)
`55-72`: **Dynamic responses for different cover classes implemented effectively.** The implementation of dynamic responses based on `device_class` is a robust way to handle various types of covers. This approach enhances the flexibility of the system and ensures that responses are more contextually relevant. The use of a dictionary to map `device_class` to specific translations is a good practice, ensuring easy maintenance and updates in the future.
sentences/ru/_common.yaml (2)
Line range hint `220-256`: **Updated domain and class mappings for better context handling.** The updates to domain and class mappings, such as adding specific translations for different types of covers and other entities, improve the accuracy and context sensitivity of the system. This refinement allows for more precise interaction with the system, enhancing user experience by ensuring that commands and responses are more aligned with user expectations. --- `452-457`: **Addition of position range for percentage-based commands.** The introduction of a percentage range for the `position` slot is a significant improvement. This allows for more precise control over devices, such as adjusting the openness of a cover to a specific percentage, thereby providing users with finer control over their home automation systems.
--- 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?
Share - [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai) - [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai) - [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai) - [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code)
Tips ### Chat There are 3 ways to chat with [CodeRabbit](https://coderabbit.ai): - Review comments: Directly reply to a review comment made by CodeRabbit. Example: - `I pushed a fix in commit .` - `Generate unit testing code for this file.` - `Open a follow-up GitHub issue for this discussion.` - Files and specific lines of code (under the "Files changed" tab): Tag `@coderabbitai` in a new review comment at the desired location with your query. Examples: - `@coderabbitai generate unit testing code for this file.` - `@coderabbitai modularize this function.` - PR comments: Tag `@coderabbitai` in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples: - `@coderabbitai generate interesting stats about this repository and render them as a table.` - `@coderabbitai show all the console.log statements in this repository.` - `@coderabbitai read src/utils.ts and generate unit testing code.` - `@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.` - `@coderabbitai help me debug CodeRabbit configuration file.` 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 as PR comments) - `@coderabbitai pause` to pause the reviews on a PR. - `@coderabbitai resume` to resume the paused reviews. - `@coderabbitai review` to trigger an incremental review. This is useful when automatic reviews are disabled for the repository. - `@coderabbitai full review` to do a full review from scratch and review all the files again. - `@coderabbitai summary` to regenerate the summary of the PR. - `@coderabbitai resolve` resolve all the CodeRabbit review comments. - `@coderabbitai configuration` to show the current CodeRabbit configuration for the repository. - `@coderabbitai help` to get help. Additionally, you can add `@coderabbitai ignore` anywhere in the PR description to prevent this PR from being reviewed. ### CodeRabbit Configration File (`.coderabbit.yaml`) - You can programmatically configure CodeRabbit by adding a `.coderabbit.yaml` file to the root of your repository. - Please see the [configuration documentation](https://docs.coderabbit.ai/guides/configure-coderabbit) for more information. - If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: `# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json` ### Documentation and Community - Visit our [Documentation](https://coderabbit.ai/docs) for detailed information on how to use CodeRabbit. - Join our [Discord Community](https://discord.com/invite/GsXnASn26c) to get help, request features, and share feedback. - Follow us on [X/Twitter](https://twitter.com/coderabbitai) for updates and announcements.