Adjust check for orphaned Hue device entries for grouped lights (#69110)

Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
pull/69116/head
Marcel van der Veldt 2022-04-02 09:44:05 +02:00 committed by GitHub
parent 5f897874cb
commit 538c8160f3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 0 deletions

View File

@ -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