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()
This commit is contained in:
Franck Nijhof authored and Paulus Schoutsen committed 2019-09-24 14:21:00 -07:00
1 parent 6f9ccb5434
commit b52cfd3409
1 file changed
+5 -1
+5 -1
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