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

[en] Add stop, previous, clear playlist intents #2080

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

Conversation

OzGav
Copy link
Contributor

@OzGav OzGav commented Mar 13, 2024

These have been removed from here #2063 to make it more managable.

Summary by CodeRabbit

  • New Features

    • Introduced new intents for media player control: stop playback, clear playlist, and skip to the previous item.
    • Added English language response templates for the new intents: "Cleared" for clearing playlists, "Playing previous" for skipping to the previous item, and "Stopped" for stopping playback.
    • Defined English language phrases for the new intents, enhancing voice command recognition.
  • Tests

    • Added test cases for new media player intents to ensure functionality and reliability.

Copy link
Contributor

@tetele tetele left a comment

Choose a reason for hiding this comment

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

Thanks!

slot_combinations:
name_only:
- "name"
area_only:
Copy link
Contributor

Choose a reason for hiding this comment

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

Are you sure it's OK to "clear playlist in the living room"? Shouldn't this be name-only? You haven't even added sentences for any other scenario

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This will be my lack of understanding at the moment. I would think we do want the ability to in the future just be able to say "Clear the queue" and have the area of the satellite used to work out what player should be targeted. What should I do in this case?

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree about the area awareness, that most intents should act immediately on one/all of the targeted entities in the satellite's area.

However, this may be a bit more tricky, as clearing/deleting is a destructive action, with potentially frustrating implications. Imagine the scenario where you have 2 media_players and a voice satellite in the office area. You say clear the playlist but forget you have 2 players. The first media_player matches and gets its playlist cleared, but you actually wanted to perform the action on the second. That sounds annoying.

What I'd do is that for this intent (and any other destructive/irreversible ones) if that I'd only allow targeting by device name so as to prevent accidental triggerings. Maybe in the future we will have a short conversation for confirmation (Are you sure you want to clear the playlist on <media player name>? Yes Cleared).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK so to fix this can you confirm I should remove all reference to area in the clear playlist intent and then I need to add sentences which include in <area> against the other intents?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@tetele I see in the latest beta area support. Are there changes I should make to this PR now as a result of that?

Copy link
Contributor

Choose a reason for hiding this comment

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

Try to make sure you match the behavior there. Good or bad, at least it will be consistent.

Copy link
Contributor Author

@OzGav OzGav May 30, 2024

Choose a reason for hiding this comment

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

Thanks, looking at it now. Looking at Mike's recent PRs it seems I should remove slot combinations throughout intents.yaml and add similar sentence variations to what he has done for each of my commands.

responses/en/HassMediaPrevious.yaml Outdated Show resolved Hide resolved
sentences/en/media_player_HassMediaClearPlaylist.yaml Outdated Show resolved Hide resolved
sentences/en/media_player_HassMediaPrevious.yaml Outdated Show resolved Hide resolved
intents:
HassMediaPrevious:
data:
- sentences:
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe also use "play"/"replay" as verbs.

Copy link
Contributor

Choose a reason for hiding this comment

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

And I think just previous track on <name> should work, without the verb

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Have a look at what I have changed here and see if I have captured what you were thinking.

Copy link
Contributor Author

@OzGav OzGav Mar 13, 2024

Choose a reason for hiding this comment

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

Not sure about omitting the verb, that wouldn't be correct grammar and I thought that was desired....

Copy link
Contributor

Choose a reason for hiding this comment

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

@synesthesiam any thoughts on this?

sentences/en/media_player_HassMediaPrevious.yaml Outdated Show resolved Hide resolved
sentences/en/media_player_HassMediaPrevious.yaml Outdated Show resolved Hide resolved
@home-assistant home-assistant bot marked this pull request as draft March 13, 2024 13:58
@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.

@tetele
Copy link
Contributor

tetele commented Mar 14, 2024

@OzGav I think you forgot to push the fixes, I can't see anything new, so I can't review anything new :D

@OzGav
Copy link
Contributor Author

OzGav commented Mar 14, 2024

I am still a github noob and I was working on the wrong branch. Fixed now (I think!)

@tetele tetele marked this pull request as ready for review March 14, 2024 10:22
@home-assistant home-assistant bot requested a review from tetele March 14, 2024 10:22
Copy link
Contributor

@tetele tetele left a comment

Choose a reason for hiding this comment

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

Except for the comments that are still open, I'm good with this.

Being a set of new intents, we will wait for Mike's input.

@OzGav
Copy link
Contributor Author

OzGav commented Mar 26, 2024

Just gently checking in as to whether there is any news?

@tetele
Copy link
Contributor

tetele commented May 30, 2024

@synesthesiam in the context of 2024.6, will you consider this PR too?

@synesthesiam
Copy link
Contributor

I'm torn on this. Maybe @jlpouffier will have more thoughts?

First, I'm hesitant to have both "pause" and "stop" intents for media players since it's not always clear how these are different. Sometimes, you can resume from a stopped state; sometimes, you can't. It's confusing, and so I've avoided it by only including "pause" 🙈

Second, we need to be careful about introducing too many intents since this puts a translation burden on language leaders, as well as a maintenance burden in HA. Our original goal was to cover the "most common" voice assistant use cases, but there's no formal definition of what this means.

However we define it, I think we have a problem right now with intents requiring code inside HA and the sentences not being sharable in a blueprint style. So we can't have a set of community-supported intents that could get promoted to "official" status given enough use 🙁

What do you think?

@OzGav
Copy link
Contributor Author

OzGav commented May 30, 2024

I wasn't across the desire to only have the "most common" intents so I approached this by creating intents for all the media player service calls. I help out with the Music Assistant project and we have shared custom sentences that cover all of these (including a form of area awareness). I then thought to bring these across to core and so here we are. If HA will remain only supporting this subset of calls that is OK we will just amend our docs to advise everyone of this fact and that they should use the supplied sentences or create their own.

As for pause and stop you are correct. In MA "stop" will stop playback and clear the queue whereas pause just stops playback

Copy link

coderabbitai bot commented May 30, 2024

Walkthrough

Walkthrough

The changes introduce new intents for controlling media players within a home automation system, specifically for stopping playback, clearing playlists, and skipping to the previous item. These updates encompass the addition of new intents, response templates, language definitions, and test cases to support these media control actions.

Changes

Files Change Summaries
intents.yaml Added new intents: HassMediaStop, HassMediaClearPlaylist, HassMediaPrevious with details for controlling media players.
responses/en/HassMediaClearPlaylist.yaml, responses/en/HassMediaPrevious.yaml, responses/en/HassMediaStop.yaml Added response templates for the new intents in English: "Cleared", "Playing previous", and "Stopped".
sentences/en/media_player_HassMediaClearPlaylist.yaml, sentences/en/media_player_HassMediaPrevious.yaml, sentences/en/media_player_HassMediaStop.yaml Introduced language definitions for the new intents, specifying phrases for clearing playlists, skipping to the previous item, and stopping playback.
tests/en/media_player_HassMediaClearPlaylist.yaml, tests/en/media_player_HassMediaPrevious.yaml, tests/en/media_player_HassMediaStop.yaml Added test cases for the new intents, mapping specific commands to expected responses.

Recent review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE

Commits

Files that changed from the base of the PR and between 2634185 and 0a0e65f.

Files selected for processing (10)
  • intents.yaml (1 hunks)
  • responses/en/HassMediaClearPlaylist.yaml (1 hunks)
  • responses/en/HassMediaPrevious.yaml (1 hunks)
  • responses/en/HassMediaStop.yaml (1 hunks)
  • sentences/en/media_player_HassMediaClearPlaylist.yaml (1 hunks)
  • sentences/en/media_player_HassMediaPrevious.yaml (1 hunks)
  • sentences/en/media_player_HassMediaStop.yaml (1 hunks)
  • tests/en/media_player_HassMediaClearPlaylist.yaml (1 hunks)
  • tests/en/media_player_HassMediaPrevious.yaml (1 hunks)
  • tests/en/media_player_HassMediaStop.yaml (1 hunks)
Additional comments not posted (10)
responses/en/HassMediaStop.yaml (1)

1-5: The response template for HassMediaStop is correctly defined and aligns with the intent's purpose.

responses/en/HassMediaClearPlaylist.yaml (1)

1-5: The response template for HassMediaClearPlaylist is correctly defined and aligns with the intent's purpose.

responses/en/HassMediaPrevious.yaml (1)

1-5: The response template for HassMediaPrevious is correctly defined and aligns with the intent's purpose.

sentences/en/media_player_HassMediaStop.yaml (1)

1-8: The language configuration for HassMediaStop is correctly defined, ensuring the intent can be triggered with appropriate phrases and context.

tests/en/media_player_HassMediaStop.yaml (1)

1-10: The test cases for HassMediaStop are well-defined, covering typical phrases and ensuring the correct response is triggered.

tests/en/media_player_HassMediaClearPlaylist.yaml (1)

1-10: The test cases for HassMediaClearPlaylist are well-defined, covering typical phrases and ensuring the correct response is triggered.

sentences/en/media_player_HassMediaClearPlaylist.yaml (1)

1-9: The language definitions for HassMediaClearPlaylist are comprehensive and correctly implement the discussed changes.

sentences/en/media_player_HassMediaPrevious.yaml (1)

1-19: The language definitions for HassMediaPrevious are well-formulated, covering a wide range of user expressions for navigating to previous media items.

tests/en/media_player_HassMediaPrevious.yaml (1)

1-44: The test cases for HassMediaPrevious are comprehensive and effectively validate the functionality across various scenarios.

intents.yaml (1)

384-434: Please clarify why the new intents (HassMediaStop, HassMediaClearPlaylist, HassMediaPrevious) are marked as not supported. Is this intended for a phased rollout or an oversight?


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>.
    • 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 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.

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.

None yet

3 participants