Small optimization in entity registry enabled deConz method (#51250)

This commit is contained in:
Franck Nijhof 2021-05-30 06:12:19 +02:00 committed by GitHub
parent 32dc62a996
commit c317854e86
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -58,15 +58,12 @@ class DeconzDevice(DeconzBase, Entity):
self.gateway.entities[self.TYPE].add(self.unique_id)
@property
def entity_registry_enabled_default(self):
def entity_registry_enabled_default(self) -> bool:
"""Return if the entity should be enabled when first added to the entity registry.
Daylight is a virtual sensor from deCONZ that should never be enabled by default.
"""
if self._device.type == "Daylight":
return False
return True
return self._device.type != "Daylight"
async def async_added_to_hass(self):
"""Subscribe to device events."""