Skip to content
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

[SV] support for scenes and persons #2172

Open
wants to merge 71 commits into
base: main
Choose a base branch
from

Conversation

danielholm
Copy link

@danielholm danielholm commented May 14, 2024

Summary by CodeRabbit

  • New Features

    • Added functionality for activating scenes in a smart home environment using Swedish language commands.
    • Introduced a new intent HassTurnOn for scene activation, allowing users to specify scenes and areas for enhanced control.
  • Tests

    • Added test cases for the HassTurnOn intent in Swedish, ensuring accurate recognition and response for specific scenes, including "Festläge" and "Pluggtid."

Copy link
Contributor

@larsdunemark larsdunemark left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR. Added some inline comments.

sentences/sv/scene_HassTurnOn,yaml Outdated Show resolved Hide resolved
tests/sv/person_HassGetState.yaml Outdated Show resolved Hide resolved
@home-assistant home-assistant bot marked this pull request as draft May 14, 2024 21:39
@home-assistant
Copy link

Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍

Learn more about our pull request process.

@larsdunemark
Copy link
Contributor

There is also a filename problem, where , is used instead of . (dot) for the file extension.

@danielholm
Copy link
Author

I believe I have made the changes you asked for.

@danielholm danielholm marked this pull request as ready for review May 22, 2024 10:59
@danielholm danielholm changed the title Sv-scene [SV] support for scenes Jun 28, 2024
A few small changew
Copy link

coderabbitai bot commented Jun 28, 2024

📝 Walkthrough
📝 Walkthrough

Walkthrough

The changes introduce a new YAML configuration file for the Swedish language, specifically defining intents related to activating scenes in a home automation system. The primary intent, HassTurnOn, includes various sentence patterns for users to express commands to turn on scenes. Additionally, a testing configuration has been created to validate these intents with specific test cases for activating scenes, ensuring the system can recognize and respond appropriately to user commands.

Changes

File(s) Change Summary
sentences/sv/scene_HassTurnOn.yaml Introduced new intent HassTurnOn with sentence patterns for activating scenes, including slots for actions and scene names.
tests/sv/scene_HassTurnOn.yaml Added test cases for the HassTurnOn intent, covering scenarios for activating "Festläge" and "Pluggtid" scenes with expected responses.

Sequence Diagram(s)

Activating Scenes

sequenceDiagram
    participant User
    participant System
    participant SceneController

    User->>System: Activate scene Z
    System->>SceneController: Send activation command for scene Z
    SceneController-->>System: Acknowledge activation of scene Z
    System-->>User: Confirm scene Z activation
Loading

📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between a179e34 and fbdc97e.

📒 Files selected for processing (1)
  • tests/sv/scene_HassTurnOn.yaml (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • tests/sv/scene_HassTurnOn.yaml

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • 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 gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @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 using 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.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai or @coderabbitai title anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration 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 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 for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

tests/sv/scene_HassTurnOn.yaml Outdated Show resolved Hide resolved
tests/sv/person_HassGetState.yaml Outdated Show resolved Hide resolved
tests/sv/scene_HassTurnOn.yaml Outdated Show resolved Hide resolved
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Outside diff range and nitpick comments (2)
tests/sv/scene_HassTurnOn.yaml (1)

3-13: Consider enhancing the "Festläge" test case.

The test case for "Festläge" is well-structured, but consider the following improvements:

  1. Add more sentence variations to cover a wider range of user inputs.
  2. Ensure consistency in terminology (e.g., "scene" vs "scenen").
  3. Consider adding a test case with a misspelled "Festläge" to check error handling.

Here's an example of additional sentences you could add:

- "sätt på festläge"
- "aktivera festläge scenen"
- "starta festläge i huset"
sentences/sv/scene_HassTurnOn.yaml (1)

5-28: Refine sentence patterns for clarity and consistency.

The sentence patterns cover various ways to express turning on a scene, which is good for flexibility. However, there are a few points to consider:

  1. Some patterns might be redundant or could be combined for simplicity.
  2. There are extra spaces after <slå_på> in some patterns (lines 16, 19, 20).
  3. The pattern "[scene] <name> på" on line 7 might be ambiguous without the <slå_på> action.

Consider the following improvements:

  1. Combine similar patterns to reduce redundancy.
  2. Remove extra spaces after <slå_på> for consistency.
  3. Add the <slå_på> action to the pattern on line 7 for clarity.

Example of combining patterns and removing extra spaces:

- "<slå_på> (<area> <name>|<name> <i_på> <area>) [scene]"

This combines several patterns into one, making the file more maintainable.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 9fbf733 and a179e34.

📒 Files selected for processing (2)
  • sentences/sv/scene_HassTurnOn.yaml (1 hunks)
  • tests/sv/scene_HassTurnOn.yaml (1 hunks)
🧰 Additional context used
🔇 Additional comments (5)
tests/sv/scene_HassTurnOn.yaml (1)

1-2: LGTM: File header and language specification are correct.

The language is correctly specified as Swedish (sv), and the tests section is properly initiated.

sentences/sv/scene_HassTurnOn.yaml (4)

1-3: LGTM: The overall structure of the YAML file is correct.

The file follows the expected format for defining intents in YAML, with proper language specification and intent declaration.


10-13: LGTM: Context and slot definitions are correct and consistent.

The context and slot definitions for the "scene" domain are properly specified and consistent across both data blocks. This ensures correct categorization and processing of the intent.

Also applies to: 24-27


14-14: LGTM: Response type is correctly specified.

The response type is consistently set to "scene" for both data blocks, which aligns with the intent's purpose of turning on scenes. This ensures appropriate system responses for scene activation commands.

Also applies to: 28-28


1-28: Overall, the file is well-structured and fit for purpose, with minor improvements suggested.

The sentences/sv/scene_HassTurnOn.yaml file successfully defines intents for turning on scenes in Swedish. The file structure, context requirements, slot definitions, and response types are all correctly specified. The sentence patterns cover a wide range of user inputs, which is beneficial for flexibility.

However, there are opportunities to refine the sentence patterns for improved clarity, consistency, and maintainability. Consider implementing the suggested improvements to the patterns, as mentioned in the previous comment.

To ensure that this file is properly integrated into the system, please run the following verification script:

This script will help verify the file's location, validate its YAML syntax (if yamllint is available), and check for any references to this file in test configurations.

tests/sv/scene_HassTurnOn.yaml Outdated Show resolved Hide resolved
tests/sv/scene_HassTurnOn.yaml Outdated Show resolved Hide resolved
Copy link
Author

@danielholm danielholm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have ran the test I belive are required and made changes to comply.

@danielholm
Copy link
Author

By the last test run it seems that other parts of the responses are fixed in another PR

@danielholm
Copy link
Author

When I run new builds, I do get one test error still for scenes, but more than that the test errors are regarding other parts than scene. Should I try to correct them too? I cant seem to understand why not climate response has a value?

Copy link
Author

@danielholm danielholm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deleted files not related to scenes or persons.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants