intents icon indicating copy to clipboard operation
intents copied to clipboard

[en] Add stop, previous, clear playlist intents

Open OzGav opened this issue 11 months ago • 4 comments

These have been removed from here https://github.com/home-assistant/intents/pull/2063 to make it more managable.

OzGav avatar Mar 13 '24 12:03 OzGav

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

Learn more about our pull request process.

home-assistant[bot] avatar Mar 13 '24 13:03 home-assistant[bot]

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

tetele avatar Mar 14 '24 07:03 tetele

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

OzGav avatar Mar 14 '24 09:03 OzGav

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

OzGav avatar Mar 26 '24 02:03 OzGav

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

tetele avatar May 30 '24 09:05 tetele

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" :see_no_evil:

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 :slightly_frowning_face:

What do you think?

synesthesiam avatar May 30 '24 14:05 synesthesiam

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. edit: I also understand that MA will actually STOP the queue after 30 secs of PAUSE

OzGav avatar May 30 '24 14:05 OzGav

I agreed with @synesthesiam unfortunately.

Out of the 3 new intents proposed, I think only "Previous" makes sense to add to core for now. It's simple and when I think about it, since we have Next, why not have Previous? This won't add too much of a burden on our translators, and the area targeting logic is already in place for Next. We just need to copy it.

Stop colliding with pause too much - some languages already added sentences to "Stop the playback" for the "Pause" intent. I think for a voice-specific interface, the only thing that matters for the user is to stop the playback now (ie. Pause it). Anything more specific (Clearing the queue, etc. Needs to be done via a UI component for now)

jlpouffier avatar Jun 03 '24 09:06 jlpouffier

OK I will delete all but the PREVIOUS command.

OzGav avatar Jun 03 '24 09:06 OzGav

This discussion revives an older idea/question of mine: should (custom) integrations be allowed to define their own intents/sentences? So when loading the intent set for the default conversation agent, should we allow each integration to register its own set?

What do you think @synesthesiam @jlpouffier ?

tetele avatar Jun 03 '24 10:06 tetele

FYI there is a plan to move the MA Integration out of HACS and into core sometime this year... Not sure how/if that changes anything?

OzGav avatar Jun 03 '24 10:06 OzGav

Walkthrough

Walkthrough

The recent changes introduce a new intent, HassMediaPrevious, to the home automation system, enhancing media playback controls by allowing users to skip to the previous item. Several configurations and test cases were added to support this functionality.

Changes

File Path Change Summary
intents.yaml Added HassMediaPrevious intent with details such as description, domain, and slot configurations.
responses/en/HassMediaPrevious.yaml Introduced an English language response for the intent HassMediaPrevious with the message "Playing previous".
sentences/en/media_player_HassMediaPrevious.yaml Introduced various commands for navigating back to the previous track in a media player context.
tests/en/media_player_HassMediaPrevious.yaml Added test cases for the HassMediaPrevious intent related to media playback control.

Recent review details

Configuration used: CodeRabbit UI Review profile: ASSERTIVE

Commits

Files that changed from the base of the PR and between edef5df79159b0fe5003a5302e2d625387f74d04 and f9b50a26501527f5970c55ee03c96943836018db.

Files selected for processing (2)
  • intents.yaml (1 hunks)
  • sentences/en/media_player_HassMediaPrevious.yaml (1 hunks)
Additional comments not posted (1)
intents.yaml (1)

383-394: Consider enabling the supported attribute for the HassMediaPrevious intent.

The HassMediaPrevious intent is set with supported: false. Given that this intent is integrated and expected to function within the system, please review and update the supported flag to true if it is ready for use. This adjustment will align it with the active status of similar intents.

Verification successful

The HassMediaPrevious intent is well-defined across multiple files, including test cases, sentence structures, and response definitions. This indicates that the intent is integrated and likely functional within the system. Therefore, it makes sense to enable the supported attribute for this intent.

  • tests/en/media_player_HassMediaPrevious.yaml includes test cases for this intent.
  • sentences/en/media_player_HassMediaPrevious.yaml defines various sentence structures for invoking this intent.
  • responses/en/HassMediaPrevious.yaml provides a response for this intent.

Given this context, it is appropriate to update the supported flag to true.

  • intents.yaml
Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify the `supported` flag for the `HassMediaPrevious` intent.

# Test: Search for the intent usage. Expect: No active usage if `supported` is false.
rg --type yaml $'HassMediaPrevious'

Length of output: 420



Script:

#!/bin/bash
# Description: Check the contents of the files referencing `HassMediaPrevious`

# Display the relevant sections of the files for analysis
rg -A 10 -B 2 'HassMediaPrevious:' tests/en/media_player_HassMediaPrevious.yaml
rg -A 10 -B 2 'HassMediaPrevious:' sentences/en/media_player_HassMediaPrevious.yaml
rg -A 10 -B 2 'HassMediaPrevious:' responses/en/HassMediaPrevious.yaml

Length of output: 805


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.

coderabbitai[bot] avatar Jun 04 '24 11:06 coderabbitai[bot]

OK PR pared back to just the media_previous_track service call

Edit: I have also edited my attempt at a PR for core https://github.com/home-assistant/core/pull/113222

OzGav avatar Jun 04 '24 11:06 OzGav

Merge conflict resolved

OzGav avatar Jun 10 '24 09:06 OzGav

@OzGav please resolve the merge conflicts so we can finally merge this

tetele avatar Jun 17 '24 07:06 tetele

@tetele I don't see any merge conflicts. I do see a "Change Requested" but when I click on "See Review" it doesn't take me to anything that is unresolved? I am not sure what to do from here although I have moved it out of draft again.

OzGav avatar Jun 18 '24 02:06 OzGav

I've approved the PR, but i will ask @synesthesiam to take a final look before merging, as this is a new intent.

tetele avatar Jun 18 '24 07:06 tetele

Looks good, thanks!

synesthesiam avatar Jun 24 '24 14:06 synesthesiam