diff --git a/homeassistant/components/hive/__init__.py b/homeassistant/components/hive/__init__.py index 52cf7f719e6..3693f0183ce 100644 --- a/homeassistant/components/hive/__init__.py +++ b/homeassistant/components/hive/__init__.py @@ -7,7 +7,7 @@ import logging from typing import Any, TypeVar from aiohttp.web_exceptions import HTTPException -from apyhiveapi import Hive +from apyhiveapi import Auth, Hive from apyhiveapi.helper.hive_exceptions import HiveReauthRequired from typing_extensions import Concatenate, ParamSpec import voluptuous as vol @@ -112,6 +112,15 @@ async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: return unload_ok +async def async_remove_entry(hass: HomeAssistant, entry: ConfigEntry) -> None: + """Remove a config entry.""" + hive = Auth(entry.data["username"], entry.data["password"]) + await hive.forget_device( + entry.data["tokens"]["AuthenticationResult"]["AccessToken"], + entry.data["device_data"][1], + ) + + def refresh_system( func: Callable[Concatenate[_HiveEntityT, _P], Awaitable[Any]] ) -> Callable[Concatenate[_HiveEntityT, _P], Coroutine[Any, Any, None]]: