diff --git a/homeassistant/components/hassio/__init__.py b/homeassistant/components/hassio/__init__.py index 69c53225d49..49ea884418f 100644 --- a/homeassistant/components/hassio/__init__.py +++ b/homeassistant/components/hassio/__init__.py @@ -127,20 +127,27 @@ MAP_SERVICE_API = { @bind_hass -async def async_get_addon_info(hass: HomeAssistantType, addon_id: str) -> dict: +async def async_get_addon_info(hass: HomeAssistantType, slug: str) -> dict: """Return add-on info. - The addon_id is a snakecased concatenation of the 'repository' value - found in the add-on info and the 'slug' value found in the add-on config.json. - In the add-on info the addon_id is called 'slug'. - The caller of the function should handle HassioAPIError. """ hassio = hass.data[DOMAIN] - result = await hassio.get_addon_info(addon_id) + result = await hassio.get_addon_info(slug) return result["data"] +@bind_hass +async def async_install_addon(hass: HomeAssistantType, slug: str) -> None: + """Install add-on. + + The caller of the function should handle HassioAPIError. + """ + hassio = hass.data[DOMAIN] + command = f"/addons/{slug}/install" + await hassio.send_command(command) + + @callback @bind_hass def get_info(hass):