-
-
Notifications
You must be signed in to change notification settings - Fork 34.5k
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
base: dev
Are you sure you want to change the base?
Added share service to Tessie #148575
Conversation
Hey there @Bre77, mind taking a look at this pull request as it has been labeled with an integration ( Code owner commandsCode owners of
|
There was a problem hiding this 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
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! |
154102d
to
682166c
Compare
The PR is now ready for a final review, thanks! |
wait_for_completion=wait_for_completion, | ||
) | ||
except ClientResponseError as e: | ||
raise HomeAssistantError from e |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See my comment above
else: | ||
raise HomeAssistantError( | ||
translation_domain=DOMAIN, | ||
translation_key="invalid_device", | ||
translation_placeholders={"device_id": device_id}, | ||
) |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See my comment above
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: |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.", |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍 |
Proposed change
This adds a new
share
service to send addresses or video URL to the vehicles:Type of change
Additional information
Checklist
ruff format homeassistant tests
)If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
Updated and included derived files by running:
python3 -m script.hassfest
.requirements_all.txt
.Updated by running
python3 -m script.gen_requirements_all
.To help with the load of incoming pull requests: