From e04bb5932d4b19beeff1869fbecf1012c09d05ec Mon Sep 17 00:00:00 2001 From: Martin Hjelmare Date: Mon, 20 Jun 2022 15:36:11 +0200 Subject: [PATCH] Copy device identifer to string --- homeassistant/components/tradfri/__init__.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/homeassistant/components/tradfri/__init__.py b/homeassistant/components/tradfri/__init__.py index c911761e95f..c3bf6dc43fd 100644 --- a/homeassistant/components/tradfri/__init__.py +++ b/homeassistant/components/tradfri/__init__.py @@ -156,7 +156,7 @@ def remove_stale_devices( device_entries = dr.async_entries_for_config_entry( device_registry, config_entry.entry_id ) - all_device_ids = {device.id for device in devices} + all_device_ids = {str(device.id) for device in devices} for device_entry in device_entries: device_id: str | None = None @@ -166,7 +166,9 @@ def remove_stale_devices( if identifier[0] != DOMAIN: continue - _id = identifier[1] + # The device id in the identifier is not copied from integer to string + # when setting entity device info. Copy here to make sure it's a string. + _id = str(identifier[1]) # Identify gateway device. if _id == config_entry.data[CONF_GATEWAY_ID]: