Revert "Cache entity properties that are never expected to change in the base class" (#100422)

Revert "Cache entity properties that are never expected to change in the base class (#95315)"

This reverts commit 042776ebb8.
This commit is contained in:
Erik Montnemery 2023-09-15 11:25:24 +02:00 committed by GitHub
parent 7723a9b36b
commit d1afcd773f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
35 changed files with 48 additions and 146 deletions

View file

@ -360,10 +360,7 @@ class SensorGroup(GroupEntity, SensorEntity):
"""Return the state attributes of the sensor."""
return {ATTR_ENTITY_ID: self._entity_ids, **self._extra_state_attribute}
@property # type: ignore[override]
# Because the device class is calculated, there is no guarantee that the
# sensors will be available when the entity is created so we do not want to
# cache the value.
@property
def device_class(self) -> SensorDeviceClass | None:
"""Return device class."""
if self._attr_device_class is not None: