Fix switch light adding itself to devices (#68060)

This commit is contained in:
Paulus Schoutsen
2022-03-12 13:53:40 -08:00
committed by GitHub
parent ea6da674df
commit a902f0ee53

View File

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