From cddc1e9d72c7c1932a79bcba637a64fefcdd0dbe Mon Sep 17 00:00:00 2001 From: Jeena Date: Tue, 5 May 2026 07:02:31 +0000 Subject: [PATCH] Allow per-device removal from the integration HA blocks "Delete device" (and the equivalent config/device_registry/remove_config_entry WS call) unless an integration implements async_remove_config_entry_device. Add the hook returning True so users can prune devices that are gone from their Samsung Find account without editing the registry by hand. A returning device with the same dvceID will be recreated on the next coordinator setup. Co-Authored-By: Claude Opus 4.7 (1M context) --- custom_components/smartthings_find/__init__.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/custom_components/smartthings_find/__init__.py b/custom_components/smartthings_find/__init__.py index 059d1b3..ba2728c 100644 --- a/custom_components/smartthings_find/__init__.py +++ b/custom_components/smartthings_find/__init__.py @@ -90,6 +90,18 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: ) return True +async def async_remove_config_entry_device( + hass: HomeAssistant, entry: ConfigEntry, device +) -> bool: + """Allow the user to remove a device from this config entry. + + Returning True unconditionally lets HA delete the device + its entities + from the registry. If the same dvceID later reappears in Samsung's + response, the next setup will recreate fresh entries for it. + """ + return True + + async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: """Unload a config entry.""" unload_success = await hass.config_entries.async_unload_platforms(entry, PLATFORMS)