From 0c8896e7281748d8c8d58422279a2469a4ca391d Mon Sep 17 00:00:00 2001 From: Chris Browet Date: Fri, 15 Apr 2022 13:10:37 +0200 Subject: [PATCH] Implement delete device --- custom_components/jellyfin/__init__.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/custom_components/jellyfin/__init__.py b/custom_components/jellyfin/__init__.py index 25f8715..4e297e8 100644 --- a/custom_components/jellyfin/__init__.py +++ b/custom_components/jellyfin/__init__.py @@ -30,6 +30,8 @@ from homeassistant.const import ( # pylint: disable=import-error EVENT_HOMEASSISTANT_STOP, ) import homeassistant.helpers.config_validation as cv # pylint: disable=import-error +from homeassistant.helpers.device_registry import DeviceEntry +from homeassistant.helpers import entity_registry from homeassistant.helpers.dispatcher import ( # pylint: disable=import-error async_dispatcher_send, @@ -228,6 +230,14 @@ async def _update_listener(hass: HomeAssistant, config_entry): _LOGGER.debug("reload triggered") await hass.config_entries.async_reload(config_entry.entry_id) +async def async_remove_config_entry_device( + hass: HomeAssistant, config_entry: ConfigEntry, device_entry: DeviceEntry +) -> bool: + """Remove a config entry from a device.""" + entreg = await entity_registry.async_get_registry(hass) + if entity_registry.async_entries_for_device(entreg, device_entry.id): + return False + return True class JellyfinDevice(object): """ Represents properties of an Jellyfin Device. """