From 538c8160f36746c4efef836fec393aa4e74ce83e Mon Sep 17 00:00:00 2001 From: Marcel van der Veldt Date: Sat, 2 Apr 2022 09:44:05 +0200 Subject: [PATCH] Adjust check for orphaned Hue device entries for grouped lights (#69110) Co-authored-by: Paulus Schoutsen --- homeassistant/components/hue/v2/device.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/homeassistant/components/hue/v2/device.py b/homeassistant/components/hue/v2/device.py index 64bdcc7a4f2..c3deee40023 100644 --- a/homeassistant/components/hue/v2/device.py +++ b/homeassistant/components/hue/v2/device.py @@ -81,6 +81,10 @@ async def async_setup_devices(bridge: "HueBridge"): dev_reg, entry.entry_id ): if device not in known_devices: + # handle case where a virtual device was created for a Hue group + hue_dev_id = next(x[1] for x in device.identifiers if x[0] == DOMAIN) + if hue_dev_id in api.groups: + continue dev_reg.async_remove_device(device.id) # add listener for updates on Hue devices controller