core icon indicating copy to clipboard operation
core copied to clipboard

feat: Tessie GPS navigation service

Open ffMathy opened this issue 6 months ago • 1 comments

Proposed change

It fixes this proposal: https://community.home-assistant.io/t/tessie-navigate-service/879754

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

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

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

To help with the load of incoming pull requests:

ffMathy avatar Jun 14 '25 19:06 ffMathy

Hey there @bre77, mind taking a look at this pull request as it has been labeled with an integration (tessie) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of tessie 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 tessie 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 Jun 14 '25 19:06 home-assistant[bot]

@Bre77 thank you for your comments. In an attempt at making this more Home Assistant standard, I have also extracted the service into two separate calls.

Be mindful though that Teslemetry defines Domain services, and I've opted for Entity-based services.

Comparison here: image

I personally believe (based on this) that Entity-based is better, and that Teslemetry actually should also opt for those kinds of services. Thoughts?

ffMathy avatar Jun 16 '25 05:06 ffMathy

Oh, and be mindful that I still need to extensively test these latest changes before we merge, but it should be reviewable now.

ffMathy avatar Jun 16 '25 05:06 ffMathy

I personally believe (based on this) that Entity-based is better, and that Teslemetry actually should also opt for those kinds of services. Thoughts?

There was some specific reason I was using domain automations, but it's been so long I can't remember and it's possible it only applied to the first few. I'll consider changing this up.

Bre77 avatar Jun 16 '25 08:06 Bre77

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 Jun 16 '25 12:06 home-assistant[bot]

Okay so the big benefit of normal services over entity services is that normal services are registered even when the entry was not able to set up, for example when Tessie is down or your system has no internet.

The reason why we want to register these in async_setup is to always set it up is that we want to be able to validate your automations. Because if you use a service that does not exist, your automation would error and we want you to know that upfront. By always setting up the services first, we are sure that we can validate correctly!

We should only do entity services when there's an architectural need for them

joostlek avatar Jul 24 '25 15:07 joostlek

There hasn't been any activity on this pull request recently. This pull request has been automatically marked as stale because of that and will be closed if no further activity occurs within 7 days. If you are the author of this PR, please leave a comment if you want to keep it open. Also, please rebase your PR onto the latest dev branch to ensure that it's up to date with the latest changes. Thank you for your contribution!

github-actions[bot] avatar Sep 23 '25 18:09 github-actions[bot]

@joostlek wrote:

Okay so the big benefit of normal services over entity services is that normal services are registered even when the entry was not able to set up, for example when Tessie is down or your system has no internet.

The reason why we want to register these in async_setup is to always set it up is that we want to be able to validate your automations. Because if you use a service that does not exist, your automation would error and we want you to know that upfront. By always setting up the services first, we are sure that we can validate correctly!

We should only do entity services when there's an architectural need for them

This is not correct, we should do entity services when targeting entities.

Moreover, there's now a new API for registering entity services which doesn't rely on the platform and can be called from async_setup: https://github.com/home-assistant/core/blob/dfbaf66021c59ae916f0e6a15b2b3d60a4559180/homeassistant/helpers/service.py#L1172

emontnemery avatar Sep 25 '25 06:09 emontnemery

@ffMathy what's this PR waiting for?

emontnemery avatar Sep 25 '25 06:09 emontnemery

@emontnemery what direction I should go for (entity or domain services) and time for me to QA it. Don't have a lot of time these days but will get it in a month or so.

ffMathy avatar Sep 25 '25 06:09 ffMathy

@ffMathy if it makes sense for the service to take entity ids as input (and not config entry id, device id or something else identifying the car), it should be an entity service.

If it should be an entity service you should however update the PR to register the entity service from the integration's async_setup as documented here https://developers.home-assistant.io/docs/dev_101_services?_highlight=async_register_platform_entity_service#entity-service-actions

emontnemery avatar Sep 25 '25 07:09 emontnemery

There hasn't been any activity on this pull request recently. This pull request has been automatically marked as stale because of that and will be closed if no further activity occurs within 7 days. If you are the author of this PR, please leave a comment if you want to keep it open. Also, please rebase your PR onto the latest dev branch to ensure that it's up to date with the latest changes. Thank you for your contribution!

github-actions[bot] avatar Nov 24 '25 08:11 github-actions[bot]