Skip to content

Added share service to Tessie #148575

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

Draft
wants to merge 4 commits into
base: dev
Choose a base branch
from

Conversation

robin-thoni
Copy link
Contributor

@robin-thoni robin-thoni commented Jul 10, 2025

Proposed change

This adds a new share service to send addresses or video URL to the vehicles:

image

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

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.

To help with the load of incoming pull requests:

@home-assistant
Copy link

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.

Copy link
Contributor

@Bre77 Bre77 left a comment

Choose a reason for hiding this comment

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

LGTM

However I think you will also need to add tests

@robin-thoni
Copy link
Contributor Author

LGTM

However I think you will also need to add tests

Thanks for the quick approval! Yes, as written in the description, I'll work on the tests on Sunday and/or Monday. That's why the PR is still a draft. I just wanted to have a review on the main part. Thanks!

@robin-thoni robin-thoni force-pushed the robin-thoni-tessie-share-service-1 branch from 154102d to 682166c Compare July 14, 2025 13:59
@robin-thoni robin-thoni marked this pull request as ready for review July 14, 2025 14:16
@robin-thoni
Copy link
Contributor Author

The PR is now ready for a final review, thanks!

wait_for_completion=wait_for_completion,
)
except ClientResponseError as e:
raise HomeAssistantError from e
Copy link
Member

Choose a reason for hiding this comment

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

can we add a little text to explain that we failed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I re-used the same error management logic from https://github.com/home-assistant/core/blob/dev/homeassistant/components/tessie/entity.py#L105. This can be enhanced in both location in a subsequent PR?

except ClientResponseError as e:
raise HomeAssistantError from e
if response["result"] is False:
name: str = getattr(device, "name", device.id)
Copy link
Member

Choose a reason for hiding this comment

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

why are we using getattr

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Comment on lines +79 to +84
else:
raise HomeAssistantError(
translation_domain=DOMAIN,
translation_key="invalid_device",
translation_placeholders={"device_id": device_id},
)
Copy link
Member

Choose a reason for hiding this comment

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

I think we can do this with a quick return, or to incorporate this into the function we use to fetch the rest

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Comment on lines +13 to +30
locale:
required: false
default: "en-US"
selector:
text:
retry_duration:
required: false
default: 40
selector:
number:
min: 0
max: 90
unit_of_measurement: seconds
wait_for_completion:
required: false
default: true
selector:
boolean:
Copy link
Member

Choose a reason for hiding this comment

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

why do we ask for locale, retry duration and completion? We should pick something that would work for everyone

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Those are inputs from the Tessie's web service. locale is the less important one here. But the two other will drastically change the way the web service will behave and have to be exposed to the user.

"services": {
"share": {
"name": "Share",
"description": "Shares an address, latitude/longitude or video URL to the vehicle.",
Copy link
Member

Choose a reason for hiding this comment

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

How should and address be formatted? Or lat/lon? I would argue that these are separate actions which require separate validation

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Tesla (not Tessie) filter and validate what they allow to be sent to the car server-side. It's a single web service. We can't/don't want to try to validate this on client-side.

@home-assistant home-assistant bot marked this pull request as draft July 25, 2025 19:03
@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.

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.

3 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy