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
|
@ -5,6 +5,7 @@ from typing import Any
|
|||
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.backports.functools import cached_property
|
||||
from homeassistant.components.binary_sensor import (
|
||||
DEVICE_CLASSES_SCHEMA,
|
||||
DOMAIN as BINARY_SENSOR_DOMAIN,
|
||||
|
@ -147,7 +148,7 @@ class BinarySensorGroup(GroupEntity, BinarySensorEntity):
|
|||
# Set as ON if any / all member is ON
|
||||
self._attr_is_on = self.mode(state == STATE_ON for state in states)
|
||||
|
||||
@property
|
||||
@cached_property
|
||||
def device_class(self) -> BinarySensorDeviceClass | None:
|
||||
"""Return the sensor class of the binary sensor."""
|
||||
return self._device_class
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue