Add comment for clarity to helper.entity.enabled() (#26793)

* Fixes entity enabled expression

* Ensure True is returned when there is no registry_entity

* Add comment for clarity to helper.entity.enabled()
pull/26893/head
Franck Nijhof 2019-09-24 23:21:00 +02:00 committed by Paulus Schoutsen
parent 6f9ccb5434
commit b52cfd3409
1 changed files with 5 additions and 1 deletions

View File

@ -231,7 +231,11 @@ class Entity:
@property
def enabled(self) -> bool:
"""Return if the entity is enabled in the entity registry."""
"""Return if the entity is enabled in the entity registry.
If an entity is not part of the registry, it cannot be disabled
and will therefore always be enabled.
"""
return self.registry_entry is None or not self.registry_entry.disabled
@callback