-
-
Notifications
You must be signed in to change notification settings - Fork 28.8k
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
Move System Bridge services to dedicated file #114903
Conversation
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 you please rebase and fix the merge conflicts?
After that, I can start reviewing your PR
Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍 |
e5b32ba
to
f2100a8
Compare
Rebased |
f2100a8
to
d630920
Compare
supports_response=SupportsResponse.ONLY, | ||
) | ||
if not hass.services.has_service(DOMAIN, SERVICE_OPEN_URL): | ||
async_setup_services(hass) |
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 should register service in async_setup
and not in the async_setup_entry
if not hass.data[DOMAIN] or hass.data[DOMAIN] == {}: | ||
async_unload_services(hass) |
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.
if not hass.data[DOMAIN] or hass.data[DOMAIN] == {}: | |
async_unload_services(hass) |
We should not remove services with the last config entry
@callback | ||
def async_unload_services(hass: HomeAssistant) -> None: | ||
"""Unload System Bridge services.""" | ||
hass.services.async_remove(DOMAIN, SERVICE_OPEN_PATH) |
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.
@callback | |
def async_unload_services(hass: HomeAssistant) -> None: | |
"""Unload System Bridge services.""" | |
hass.services.async_remove(DOMAIN, SERVICE_OPEN_PATH) |
May return to this in future |
Proposed change
The init file was getting crowded so this moves setup and unload of services into a dedicated file. No other changes made
(Tests to be added after #114896)
Type of change
Additional information
Checklist
ruff format homeassistant tests
)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: