Add Supervisor restart add-on helper (#51717)

pull/51723/head
Martin Hjelmare 2021-06-10 18:08:25 +02:00 committed by GitHub
parent d75c97cbf3
commit a7f05713a0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 12 additions and 0 deletions

View File

@ -222,6 +222,18 @@ async def async_start_addon(hass: HomeAssistant, slug: str) -> dict:
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 = 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: