core icon indicating copy to clipboard operation
core copied to clipboard

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

Open synesthesiam opened this issue 4 months ago • 8 comments

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!)
  • [x] 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

  • [x] The code change is tested and works locally.
  • [x] Local tests pass. Your PR cannot be merged unless tests pass
  • [x] There is no commented out code in this PR.
  • [x] I have followed the development checklist
  • [x] I have followed the perfect PR recommendations
  • [x] The code has been formatted using Ruff (ruff format homeassistant tests)
  • [x] 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:

synesthesiam avatar Feb 16 '24 20:02 synesthesiam

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[bot] avatar Feb 16 '24 20:02 home-assistant[bot]

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[bot] avatar Feb 16 '24 20:02 home-assistant[bot]

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[bot] avatar Feb 16 '24 20:02 home-assistant[bot]

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[bot] avatar Feb 16 '24 20:02 home-assistant[bot]

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.

home-assistant[bot] avatar Feb 16 '24 20:02 home-assistant[bot]

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 avatar Feb 16 '24 21:02 jlpouffier

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

jlpouffier avatar Feb 16 '24 21:02 jlpouffier

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

synesthesiam avatar Feb 16 '24 21:02 synesthesiam