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

Add new intents for cover, valve, vacuum, and media player #110757

Merged
merged 8 commits into from
Feb 20, 2024

Conversation

synesthesiam
Copy link
Contributor

@synesthesiam synesthesiam commented Feb 16, 2024

Breaking change

Proposed change

Adds several new intents and enhances some existing intents for different integrations:

  • HassTurnOn and HassTurnOff
    • Open/closes valves (like covers)
  • HassSetPosition (new)
    • Sets cover and valve positions to a number 0-100
  • HassSetVolume (new)
    • Sets media player volume to a number 0-1
  • HassMediaPause (new)
    • Pauses a media player
  • HassMediaUnpause (new)
    • Unpauses a media player (see discussion)
  • HassMediaNext (new)
    • Skips a media player to the next item
  • HassVacuumStart (new)
    • Starts a vacuum
  • HassVacuumReturnToBase (new)
    • Returns a vacuum to base

Points of Discussion

Intents are an abstraction above service calls that represent common ways of interacting with devices/entities, and therefore do not need to exactly match the underlying service call nomenclature. However, deviating too much may cause confusion, so there must be a reasonable balance.

Media Unpause

Why not HassMediaPlay instead of HassMediaUnpause? To make it very clear that the intent does not take a media URI to play. In this case, I have purposefully avoided the confusing service call nomenclature of media_player.media_play vs media_player.play_media.

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New integration (thank you!)
  • New feature (which adds functionality to an existing integration)
  • Deprecation (breaking change to happen in the future)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Additional information

  • This PR fixes or closes issue: fixes #
  • This PR is related to issue:
  • Link to documentation pull request:

Checklist

  • The code change is tested and works locally.
  • Local tests pass. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the development checklist
  • I have followed the perfect PR recommendations
  • The code has been formatted using Ruff (ruff format homeassistant tests)
  • Tests have been added to verify that the new code works.

If user exposed functionality or configuration variables are added/changed:

If the code communicates with devices, web services, or third-party tools:

  • The manifest file has all fields filled out correctly.
    Updated and included derived files by running: python3 -m script.hassfest.
  • New or updated dependencies have been added to requirements_all.txt.
    Updated by running python3 -m script.gen_requirements_all.
  • For the updated dependencies - a link to the changelog, or at minimum a diff between library versions is added to the PR description.
  • Untested files have been added to .coveragerc.

To help with the load of incoming pull requests:

@home-assistant
Copy link

Hey there @home-assistant/core, mind taking a look at this pull request as it has been labeled with an integration (cover) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of cover can trigger bot actions by commenting:

  • @home-assistant close Closes the pull request.
  • @home-assistant rename Awesome new title Renames the pull request.
  • @home-assistant reopen Reopen the pull request.
  • @home-assistant unassign cover Removes the current integration label and assignees on the pull request, add the integration domain after the command.
  • @home-assistant add-label needs-more-information Add a label (needs-more-information, problem in dependency, problem in custom component) to the pull request.
  • @home-assistant remove-label needs-more-information Remove a label (needs-more-information, problem in dependency, problem in custom component) on the pull request.

@home-assistant
Copy link

Hey there @home-assistant/core, mind taking a look at this pull request as it has been labeled with an integration (media_player) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of media_player can trigger bot actions by commenting:

  • @home-assistant close Closes the pull request.
  • @home-assistant rename Awesome new title Renames the pull request.
  • @home-assistant reopen Reopen the pull request.
  • @home-assistant unassign media_player Removes the current integration label and assignees on the pull request, add the integration domain after the command.
  • @home-assistant add-label needs-more-information Add a label (needs-more-information, problem in dependency, problem in custom component) to the pull request.
  • @home-assistant remove-label needs-more-information Remove a label (needs-more-information, problem in dependency, problem in custom component) on the pull request.

@home-assistant
Copy link

Hey there @home-assistant/core, mind taking a look at this pull request as it has been labeled with an integration (valve) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of valve can trigger bot actions by commenting:

  • @home-assistant close Closes the pull request.
  • @home-assistant rename Awesome new title Renames the pull request.
  • @home-assistant reopen Reopen the pull request.
  • @home-assistant unassign valve Removes the current integration label and assignees on the pull request, add the integration domain after the command.
  • @home-assistant add-label needs-more-information Add a label (needs-more-information, problem in dependency, problem in custom component) to the pull request.
  • @home-assistant remove-label needs-more-information Remove a label (needs-more-information, problem in dependency, problem in custom component) on the pull request.

@home-assistant
Copy link

Hey there @home-assistant/core, mind taking a look at this pull request as it has been labeled with an integration (vacuum) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of vacuum can trigger bot actions by commenting:

  • @home-assistant close Closes the pull request.
  • @home-assistant rename Awesome new title Renames the pull request.
  • @home-assistant reopen Reopen the pull request.
  • @home-assistant unassign vacuum Removes the current integration label and assignees on the pull request, add the integration domain after the command.
  • @home-assistant add-label needs-more-information Add a label (needs-more-information, problem in dependency, problem in custom component) to the pull request.
  • @home-assistant remove-label needs-more-information Remove a label (needs-more-information, problem in dependency, problem in custom component) on the pull request.

@home-assistant
Copy link

Hey there @home-assistant/core, mind taking a look at this pull request as it has been labeled with an integration (intent) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of intent can trigger bot actions by commenting:

  • @home-assistant close Closes the pull request.
  • @home-assistant rename Awesome new title Renames the pull request.
  • @home-assistant reopen Reopen the pull request.
  • @home-assistant unassign intent Removes the current integration label and assignees on the pull request, add the integration domain after the command.
  • @home-assistant add-label needs-more-information Add a label (needs-more-information, problem in dependency, problem in custom component) to the pull request.
  • @home-assistant remove-label needs-more-information Remove a label (needs-more-information, problem in dependency, problem in custom component) on the pull request.

@jlpouffier
Copy link

jlpouffier commented Feb 16, 2024

In the future I may see a place for a VacuumPause too. Even if it is far less used than starting and returning them to base.

It's really low priority.

For example, my vacuum starts by cleaning right next to the entry door, making it inaccessible.
Sometimes I start the vacuum by voice too fast and in this particular case, I need to pause it before leaving. (And for now I open the dashboard)

I always found it weird that lights spans accros two "domains" (Hass and Light). So I would propose specific domain to be able to extend it later on
VacuumStart and VacuumReturnToBase.

I also think that, using the same reasoning about why you pick "Unpause" instead of "Play", calling it ReturnToBase is much clearer than TurnOff that could be confused with a Stop.

@jlpouffier
Copy link

You said that setting a media player volume is between 0 and 1. Can we make sure that at least by voice it's between 0 and 100?
Saying something like "set the volume to 0.25" is just weird

@synesthesiam
Copy link
Contributor Author

You said that setting a media player volume is between 0 and 1. Can we make sure that at least by voice it's between 0 and 100? Saying something like "set the volume to 0.25" is just weird

Yep, I just updated hassil specifically so we could so this 😄

@synesthesiam synesthesiam marked this pull request as ready for review February 16, 2024 22:56
@synesthesiam synesthesiam requested a review from a team as a code owner February 16, 2024 22:56
INTENT_MEDIA_PAUSE = "HassMediaPause"
INTENT_MEDIA_UNPAUSE = "HassMediaUnpause"
INTENT_MEDIA_NEXT = "HassMediaNext"
INTENT_SET_VOLUME = "HassSetVolume"
Copy link
Member

Choose a reason for hiding this comment

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

This service made me wonder … how will we respond if the specified entity does not support the set volume service?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmmm...we may want to consider an "unsupported feature" error message.

Copy link
Member

Choose a reason for hiding this comment

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

We already raise that error from service helper

Copy link
Member

Choose a reason for hiding this comment

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

Just would need to translate it for voice

@balloob balloob merged commit ec4bd9a into dev Feb 20, 2024
53 checks passed
@balloob balloob deleted the synesthesiam-20240214-new-intents branch February 20, 2024 03:28
@github-actions github-actions bot locked and limited conversation to collaborators Feb 21, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants