From 2a1009111f846c29576d2e66f51330bda6fb73dc Mon Sep 17 00:00:00 2001 From: Erik Montnemery Date: Mon, 3 Aug 2026 13:08:32 +0200 Subject: [PATCH] Update integrations to call async_remove_device (part 2) (#177963) --- homeassistant/components/litterrobot/coordinator.py | 5 +---- homeassistant/components/music_assistant/__init__.py | 4 +--- homeassistant/components/ondilo_ico/coordinator.py | 5 +---- homeassistant/components/overkiz/coordinator.py | 6 +----- homeassistant/components/plugwise/coordinator.py | 4 +--- homeassistant/components/sensibo/coordinator.py | 5 +---- homeassistant/components/smartthings/__init__.py | 4 +--- homeassistant/components/solarlog/coordinator.py | 5 +---- homeassistant/components/tasmota/__init__.py | 4 +--- homeassistant/components/tedee/coordinator.py | 5 +---- homeassistant/components/tplink/coordinator.py | 5 +---- homeassistant/components/trmnl/coordinator.py | 5 +---- homeassistant/components/uptimerobot/coordinator.py | 5 +---- homeassistant/components/watts/coordinator.py | 5 +---- 14 files changed, 14 insertions(+), 53 deletions(-) diff --git a/homeassistant/components/litterrobot/coordinator.py b/homeassistant/components/litterrobot/coordinator.py index ad9b1e2ef610..8cbf0480116d 100644 --- a/homeassistant/components/litterrobot/coordinator.py +++ b/homeassistant/components/litterrobot/coordinator.py @@ -85,10 +85,7 @@ class LitterRobotDataUpdateCoordinator(DataUpdateCoordinator[None]): (DOMAIN, device_id), self.config_entry.entry_id ) if device: - device_registry.async_update_device( - device_id=device.id, - remove_config_entry_id=self.config_entry.entry_id, - ) + device_registry.async_remove_device(device.id) self.previous_members = current_members @override diff --git a/homeassistant/components/music_assistant/__init__.py b/homeassistant/components/music_assistant/__init__.py index d856e3cd7379..788d05f97454 100644 --- a/homeassistant/components/music_assistant/__init__.py +++ b/homeassistant/components/music_assistant/__init__.py @@ -183,9 +183,7 @@ async def async_setup_entry( # noqa: C901 if hass_device := dev_reg.async_get_device_by_identifier( (DOMAIN, player_id), entry.entry_id ): - dev_reg.async_update_device( - hass_device.id, remove_config_entry_id=entry.entry_id - ) + dev_reg.async_remove_device(hass_device.id) # register listener for new players def handle_player_added(event: MassEvent) -> None: diff --git a/homeassistant/components/ondilo_ico/coordinator.py b/homeassistant/components/ondilo_ico/coordinator.py index f29491ba8a55..c0fb60bb4386 100644 --- a/homeassistant/components/ondilo_ico/coordinator.py +++ b/homeassistant/components/ondilo_ico/coordinator.py @@ -98,10 +98,7 @@ class OndiloIcoPoolsCoordinator(DataUpdateCoordinator[dict[str, OndiloIcoPoolDat self.config_entry.entry_id, ) if device_entry: - self._device_registry.async_update_device( - device_id=device_entry.id, - remove_config_entry_id=self.config_entry.entry_id, - ) + self._device_registry.async_remove_device(device_entry.id) for pool_id in current_pools: pool_data = data[pool_id] diff --git a/homeassistant/components/overkiz/coordinator.py b/homeassistant/components/overkiz/coordinator.py index 4de532489577..7d259cb2ef37 100644 --- a/homeassistant/components/overkiz/coordinator.py +++ b/homeassistant/components/overkiz/coordinator.py @@ -216,11 +216,7 @@ async def on_device_removed( if registered_device := registry.async_get_device_by_identifier( (DOMAIN, base_device_url), coordinator.config_entry.entry_id ): - # Detach only this entry; the registry deletes the device once none remain. - registry.async_update_device( - registered_device.id, - remove_config_entry_id=coordinator.config_entry.entry_id, - ) + registry.async_remove_device(registered_device.id) if event.device_url in coordinator.devices: del coordinator.devices[event.device_url] diff --git a/homeassistant/components/plugwise/coordinator.py b/homeassistant/components/plugwise/coordinator.py index 2429529336f4..943b3222e221 100644 --- a/homeassistant/components/plugwise/coordinator.py +++ b/homeassistant/components/plugwise/coordinator.py @@ -165,9 +165,7 @@ class PlugwiseDataUpdateCoordinator(DataUpdateCoordinator[dict[str, GwEntityData (DOMAIN, device_id), self.config_entry.entry_id ) ) is not None: - device_reg.async_update_device( - device_entry.id, remove_config_entry_id=self.config_entry.entry_id - ) + device_reg.async_remove_device(device_entry.id) LOGGER.debug( "%s %s %s removed from device_registry", DOMAIN, diff --git a/homeassistant/components/sensibo/coordinator.py b/homeassistant/components/sensibo/coordinator.py index 8fdd867b577f..d34256f54941 100644 --- a/homeassistant/components/sensibo/coordinator.py +++ b/homeassistant/components/sensibo/coordinator.py @@ -114,10 +114,7 @@ class SensiboDataUpdateCoordinator(DataUpdateCoordinator[SensiboData]): (DOMAIN, _id), self.config_entry.entry_id ) if device: - device_registry.async_update_device( - device_id=device.id, - remove_config_entry_id=self.config_entry.entry_id, - ) + device_registry.async_remove_device(device.id) self.previous_devices = current_devices return data diff --git a/homeassistant/components/smartthings/__init__.py b/homeassistant/components/smartthings/__init__.py index 09cea70fa99f..14cb480a23d4 100644 --- a/homeassistant/components/smartthings/__init__.py +++ b/homeassistant/components/smartthings/__init__.py @@ -248,9 +248,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: SmartThingsConfigEntry) (DOMAIN, device_id), entry.entry_id ) if dev_entry is not None: - device_registry.async_update_device( - dev_entry.id, remove_config_entry_id=entry.entry_id - ) + device_registry.async_remove_device(dev_entry.id) entry.async_on_unload( client.add_device_lifecycle_event_listener( diff --git a/homeassistant/components/solarlog/coordinator.py b/homeassistant/components/solarlog/coordinator.py index e6aa88ad45cf..556e0108963e 100644 --- a/homeassistant/components/solarlog/coordinator.py +++ b/homeassistant/components/solarlog/coordinator.py @@ -201,10 +201,7 @@ class SolarLogDeviceDataCoordinator(DataUpdateCoordinator[dict[int, InverterData ), self.config_entry.entry_id, ): - device_registry.async_update_device( - device_id=device.id, - remove_config_entry_id=self.config_entry.entry_id, - ) + device_registry.async_remove_device(device.id) _LOGGER.info("Device removed from device registry: %s", device.id) # add new devices diff --git a/homeassistant/components/tasmota/__init__.py b/homeassistant/components/tasmota/__init__.py index 501b9844b003..9e6153c996f4 100644 --- a/homeassistant/components/tasmota/__init__.py +++ b/homeassistant/components/tasmota/__init__.py @@ -122,9 +122,7 @@ async def _remove_device( return _LOGGER.debug("Removing tasmota from device %s", mac) - device_registry.async_update_device( - device.id, remove_config_entry_id=config_entry.entry_id - ) + device_registry.async_remove_device(device.id) def _update_device( diff --git a/homeassistant/components/tedee/coordinator.py b/homeassistant/components/tedee/coordinator.py index ba194594ab8f..b360f7b53f53 100644 --- a/homeassistant/components/tedee/coordinator.py +++ b/homeassistant/components/tedee/coordinator.py @@ -151,10 +151,7 @@ class TedeeApiCoordinator(DataUpdateCoordinator[dict[int, TedeeLock]]): if device := device_registry.async_get_device_by_identifier( (DOMAIN, str(lock_id)), self.config_entry.entry_id ): - device_registry.async_update_device( - device_id=device.id, - remove_config_entry_id=self.config_entry.entry_id, - ) + device_registry.async_remove_device(device.id) # add new locks if new_locks := current_locks - self._locks_last_update: diff --git a/homeassistant/components/tplink/coordinator.py b/homeassistant/components/tplink/coordinator.py index 5b326c4287a2..899c49f5cbba 100644 --- a/homeassistant/components/tplink/coordinator.py +++ b/homeassistant/components/tplink/coordinator.py @@ -110,10 +110,7 @@ class TPLinkDataUpdateCoordinator(DataUpdateCoordinator[None]): (DOMAIN, device_id), self.config_entry.entry_id ) if device: - device_registry.async_update_device( - device_id=device.id, - remove_config_entry_id=self.config_entry.entry_id, - ) + device_registry.async_remove_device(device.id) child_coordinator = self._child_coordinators.pop(device_id, None) if child_coordinator: await child_coordinator.async_shutdown() diff --git a/homeassistant/components/trmnl/coordinator.py b/homeassistant/components/trmnl/coordinator.py index e4aa2b93520b..13c144c9a071 100644 --- a/homeassistant/components/trmnl/coordinator.py +++ b/homeassistant/components/trmnl/coordinator.py @@ -62,8 +62,5 @@ class TRMNLCoordinator(DataUpdateCoordinator[dict[int, Device]]): if entry := device_registry.async_get_device_by_identifier( (DOMAIN, str(device_id)), self.config_entry.entry_id ): - device_registry.async_update_device( - device_id=entry.id, - remove_config_entry_id=self.config_entry.entry_id, - ) + device_registry.async_remove_device(entry.id) return new_data diff --git a/homeassistant/components/uptimerobot/coordinator.py b/homeassistant/components/uptimerobot/coordinator.py index a85d23e1178f..da7543089a86 100644 --- a/homeassistant/components/uptimerobot/coordinator.py +++ b/homeassistant/components/uptimerobot/coordinator.py @@ -72,9 +72,6 @@ class UptimeRobotDataUpdateCoordinator( if device := device_registry.async_get_device_by_identifier( (DOMAIN, str(monitor_id)), self.config_entry.entry_id ): - device_registry.async_update_device( - device_id=device.id, - remove_config_entry_id=self.config_entry.entry_id, - ) + device_registry.async_remove_device(device.id) return new_monitors diff --git a/homeassistant/components/watts/coordinator.py b/homeassistant/components/watts/coordinator.py index 28982b63ec05..c6f8d272c41f 100644 --- a/homeassistant/components/watts/coordinator.py +++ b/homeassistant/components/watts/coordinator.py @@ -152,10 +152,7 @@ class WattsVisionHubCoordinator(DataUpdateCoordinator[dict[str, Device]]): (DOMAIN, device_id), self.config_entry.entry_id ) if device: - device_registry.async_update_device( - device_id=device.id, - remove_config_entry_id=self.config_entry.entry_id, - ) + device_registry.async_remove_device(device.id) @property def device_ids(self) -> list[str]: