-
-
Notifications
You must be signed in to change notification settings - Fork 28.5k
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 service to 17track to get packages #116067
Conversation
get_packages: | ||
fields: | ||
package_state: | ||
example: "In Transit,Delivered" |
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 make this a select selector since we already know all possible values
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.
Done
return_response=SupportsResponse.ONLY, | ||
) | ||
|
||
assert len(service_response["packages"]) == 2 |
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.
You can use snapshots here
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.
Cool. Never knew about snapshot
Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍 |
change to select selector add snapshot test
use strings for the selector
…u-17track-service
fix test
DOMAIN, | ||
SERVICE_GET_PACKAGES, | ||
get_packages, | ||
supports_response=SupportsResponse.ONLY, |
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'm missing a service validation schema.
"""Get packages from 17Track.""" | ||
config_entry_id = call.data[ATTR_CONFIG_ENTRY_ID] | ||
package_states = call.data.get(ATTR_PACKAGE_STATE, []) | ||
seventeen_coordinator: SeventeenTrackCoordinator = hass.data[DOMAIN][ |
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.
We need to handle a missing or not loaded config entry before accessing hass.data. Raise ServiceValidationError.
Proposed change
Add service to 17track
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
..coveragerc
.To help with the load of incoming pull requests: