diff --git a/homeassistant/components/unifi/hub/entity_loader.py b/homeassistant/components/unifi/hub/entity_loader.py index 14a1375a73b2..abc0ece041d8 100644 --- a/homeassistant/components/unifi/hub/entity_loader.py +++ b/homeassistant/components/unifi/hub/entity_loader.py @@ -168,12 +168,10 @@ class UnifiEntityLoader: ) -> None: """Remove a stale client's tracker entity and its device.""" entity_registry.async_remove(entity_id) - if device := device_registry.async_get_device( - connections={(dr.CONNECTION_NETWORK_MAC, mac)} + if device := device_registry.async_get_device_by_connection( + (dr.CONNECTION_NETWORK_MAC, mac), self.hub.config.entry.entry_id ): - device_registry.async_update_device( - device.id, remove_config_entry_id=self.hub.config.entry.entry_id - ) + device_registry.async_remove_device(device.id) @callback def register_platform(