mirror of
https://github.com/home-assistant/core
synced 2024-09-28 03:04:04 +02:00
Add ability to forget hive device when removing integration (#74144)
This commit is contained in:
parent
269fa14721
commit
4f842014ee
@ -7,7 +7,7 @@ import logging
|
|||||||
from typing import Any, TypeVar
|
from typing import Any, TypeVar
|
||||||
|
|
||||||
from aiohttp.web_exceptions import HTTPException
|
from aiohttp.web_exceptions import HTTPException
|
||||||
from apyhiveapi import Hive
|
from apyhiveapi import Auth, Hive
|
||||||
from apyhiveapi.helper.hive_exceptions import HiveReauthRequired
|
from apyhiveapi.helper.hive_exceptions import HiveReauthRequired
|
||||||
from typing_extensions import Concatenate, ParamSpec
|
from typing_extensions import Concatenate, ParamSpec
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
@ -112,6 +112,15 @@ async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
|||||||
return unload_ok
|
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(
|
def refresh_system(
|
||||||
func: Callable[Concatenate[_HiveEntityT, _P], Awaitable[Any]]
|
func: Callable[Concatenate[_HiveEntityT, _P], Awaitable[Any]]
|
||||||
) -> Callable[Concatenate[_HiveEntityT, _P], Coroutine[Any, Any, None]]:
|
) -> Callable[Concatenate[_HiveEntityT, _P], Coroutine[Any, Any, None]]:
|
||||||
|
Loading…
Reference in New Issue
Block a user