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

@ -552,7 +552,6 @@ class ProtectDeviceBinarySensor(ProtectDeviceEntity, BinarySensorEntity):
device: Camera | Light | Sensor
entity_description: ProtectBinaryEntityDescription
_device_class: BinarySensorDeviceClass | None
@callback
def _async_update_device_from_protect(self, device: ProtectModelWithId) -> None:
@ -562,17 +561,9 @@ class ProtectDeviceBinarySensor(ProtectDeviceEntity, BinarySensorEntity):
self._attr_is_on = entity_description.get_ufp_value(updated_device)
# UP Sense can be any of the 3 contact sensor device classes
if entity_description.key == _KEY_DOOR and isinstance(updated_device, Sensor):
self._device_class = MOUNT_DEVICE_CLASS_MAP.get(
self.device.mount_type, BinarySensorDeviceClass.DOOR
entity_description.device_class = MOUNT_DEVICE_CLASS_MAP.get(
updated_device.mount_type, BinarySensorDeviceClass.DOOR
)
else:
self._device_class = self.entity_description.device_class
@property # type: ignore[override]
# UFP smart sensors can change device class at runtime
def device_class(self) -> BinarySensorDeviceClass | None:
"""Return the class of this sensor."""
return self._device_class
class ProtectDiskBinarySensor(ProtectNVREntity, BinarySensorEntity):