Cache entity properties that are never expected to change in the base class (#95315)
This commit is contained in:
parent
5f20725fd5
commit
042776ebb8
35 changed files with 146 additions and 48 deletions
|
@ -50,7 +50,9 @@ class AbodeBinarySensor(AbodeDevice, BinarySensorEntity):
|
|||
"""Return True if the binary sensor is on."""
|
||||
return cast(bool, self._device.is_on)
|
||||
|
||||
@property
|
||||
@property # type: ignore[override]
|
||||
# We don't know if the class may be set late here
|
||||
# so we need to override the property to disable the cache.
|
||||
def device_class(self) -> BinarySensorDeviceClass | None:
|
||||
"""Return the class of the binary sensor."""
|
||||
if self._device.get_value("is_window") == "1":
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue