Move service registration to async_setup in waze#175261
Conversation
|
Hey there @eifinger, 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.
Pull request overview
This PR refactors the waze_travel_time integration to register its get_travel_times service in async_setup instead of async_setup_entry, as part of the epic to make services available for automation validation regardless of config-entry load state (home-assistant/epics#65). The service logic is extracted into a dedicated services.py module following the established Home Assistant pattern, and the home-assistant-service-registered-in-setup-entry pylint suppression is removed.
Changes:
- Added a new
services.pycontaining the service schema, handler (async_get_travel_times_service), and a@callback async_setup_servicesregistration helper. - Added
async_setupandCONFIG_SCHEMA = cv.config_entry_only_config_schema(DOMAIN)to__init__.py, invokingasync_setup_services, and removed the in-entry service registration plus now-unused imports.
I verified that the service handler is self-contained (it builds its own client from service.data, so it does not depend on a loaded config entry), all removed imports are no longer referenced in __init__.py, all services.py imports resolve to existing definitions, and the existing tests in test_init.py still exercise the service via config-entry setup which triggers async_setup.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
homeassistant/components/waze_travel_time/services.py |
New module holding the service schema, handler, and async_setup_services registration helper. |
homeassistant/components/waze_travel_time/__init__.py |
Adds async_setup/CONFIG_SCHEMA, delegates service registration to services.py, and removes the in-entry registration and unused imports. |
Proposed change
Move service registration to async_setup in waze.
Part of home-assistant/epics#65
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: