From 33f6476295696bd23141ddc4ed33847b48be85c9 Mon Sep 17 00:00:00 2001 From: Matt Johnson Date: Sun, 11 May 2025 11:31:12 -0700 Subject: [PATCH] Fix issue #770: Add async_remove_config_entry_device to support deleting devices from UI --- custom_components/ble_monitor/__init__.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/custom_components/ble_monitor/__init__.py b/custom_components/ble_monitor/__init__.py index acae5a60..8e989b1d 100644 --- a/custom_components/ble_monitor/__init__.py +++ b/custom_components/ble_monitor/__init__.py @@ -15,6 +15,7 @@ from homeassistant.core import HomeAssistant from homeassistant.helpers import config_validation as cv from homeassistant.helpers import device_registry, entity_registry +from homeassistant.helpers.device_registry import DeviceEntry from homeassistant.util import dt from .ble_parser import BleParser @@ -425,6 +426,20 @@ async def async_parse_data_service(hass: HomeAssistant, service_data): ) +async def async_remove_config_entry_device( + hass: HomeAssistant, config_entry: ConfigEntry, device_entry: DeviceEntry +) -> bool: + """Remove a config entry from a device.""" + _LOGGER.debug( + "Removing BLE monitor device %s from device registry", + device_entry.id + ) + + # Return True to indicate that this integration is ready to have the device removed + # The device registry will take care of actual removal when appropriate + return True + + class BLEmonitor: """BLE scanner."""