From a902f0ee53ce6bf8baf8c47974c8a5f6422b7acd Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Sat, 12 Mar 2022 13:53:40 -0800 Subject: [PATCH] Fix switch light adding itself to devices (#68060) --- homeassistant/components/switch_as_x/light.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/homeassistant/components/switch_as_x/light.py b/homeassistant/components/switch_as_x/light.py index e6fc334caef..53128487d5c 100644 --- a/homeassistant/components/switch_as_x/light.py +++ b/homeassistant/components/switch_as_x/light.py @@ -113,4 +113,5 @@ class LightSwitch(LightEntity): # Add this entity to the wrapped switch's device registry = er.async_get(self.hass) - registry.async_update_entity(self.entity_id, device_id=self._device_id) + if registry.async_get(self.entity_id) is not None: + registry.async_update_entity(self.entity_id, device_id=self._device_id)