-
-
Notifications
You must be signed in to change notification settings - Fork 30.7k
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
Replace more addon management with aiohasupervisor #126236
Conversation
Hey there @home-assistant/z-wave, mind taking a look at this pull request as it has been labeled with an integration ( Code owner commandsCode owners of
|
Hey there @home-assistant/supervisor, mind taking a look at this pull request as it has been labeled with an integration ( Code owner commandsCode owners of
|
Hey there @home-assistant/matter, mind taking a look at this pull request as it has been labeled with an integration ( Code owner commandsCode owners of
|
Hey there @home-assistant/core, mind taking a look at this pull request as it has been labeled with an integration ( Code owner commandsCode owners of
|
36dac9e
to
d26e5a9
Compare
17c47bf
to
1aeb2a9
Compare
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.
Okay for MQTT changes
Co-authored-by: epenet <[email protected]>
@bind_hass | ||
@api_data | ||
async def async_start_addon(hass: HomeAssistant, slug: str) -> dict: | ||
"""Start add-on. | ||
|
||
The caller of the function should handle HassioAPIError. | ||
""" | ||
hassio: HassIO = hass.data[DOMAIN] | ||
command = f"/addons/{slug}/start" | ||
return await hassio.send_command(command, timeout=60) | ||
|
||
|
||
@bind_hass | ||
@api_data | ||
async def async_restart_addon(hass: HomeAssistant, slug: str) -> dict: | ||
"""Restart add-on. | ||
|
||
The caller of the function should handle HassioAPIError. | ||
""" | ||
hassio: HassIO = hass.data[DOMAIN] | ||
command = f"/addons/{slug}/restart" | ||
return await hassio.send_command(command, timeout=None) | ||
|
||
|
||
@bind_hass | ||
@api_data | ||
async def async_stop_addon(hass: HomeAssistant, slug: str) -> dict: | ||
"""Stop add-on. | ||
|
||
The caller of the function should handle HassioAPIError. | ||
""" | ||
hassio: HassIO = hass.data[DOMAIN] | ||
command = f"/addons/{slug}/stop" | ||
return await hassio.send_command(command, timeout=60) | ||
|
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.
Sanity check, these variables weren't used throughout the code in other components?
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.
No, I checked. Although I can't guarantee they aren't used in custom components. I don't know how we feel about that.
All of them have had an alternative for a while though in addon_manager. And throughout core i found zero examples of people using these 3 outside the hassio component, all other integrations were going through addon manager.
Well outside of test cases anyway. People were mocking those 3 as if it were a client library in test but going through addon manager in the runtime code. That's why I've been cutting from handler as I replace with the real client library and leaving addon manager intact.
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.
It doesn't seem to be used
Proposed change
Continue refactoring API calls to supervisor for addon management out of
hassio/handler
and intoaiohasupervisor
. PR refactors the following to the library:start_addon
restart_addon
stop_addon
uninstall_addon
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: