From 182976f5d3000e14a205f9fb0ec4d2d36cf498ac Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Thu, 14 Sep 2023 02:03:39 -0500 Subject: [PATCH] Use more shorthand attributes in threshold binary_sensor (#100343) --- .../components/threshold/binary_sensor.py | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/homeassistant/components/threshold/binary_sensor.py b/homeassistant/components/threshold/binary_sensor.py index 3e702f0ebdb..6382c79b9ce 100644 --- a/homeassistant/components/threshold/binary_sensor.py +++ b/homeassistant/components/threshold/binary_sensor.py @@ -183,14 +183,14 @@ class ThresholdSensor(BinarySensorEntity): self._attr_unique_id = unique_id self._attr_device_info = device_info self._entity_id = entity_id - self._name = name + self._attr_name = name if lower is not None: self._threshold_lower = lower if upper is not None: self._threshold_upper = upper self.threshold_type = _threshold_type(lower, upper) self._hysteresis: float = hysteresis - self._device_class = device_class + self._attr_device_class = device_class self._state_position = POSITION_UNKNOWN self._state: bool | None = None self.sensor_value: float | None = None @@ -227,21 +227,11 @@ class ThresholdSensor(BinarySensorEntity): ) _update_sensor_state() - @property - def name(self) -> str: - """Return the name of the sensor.""" - return self._name - @property def is_on(self) -> bool | None: """Return true if sensor is on.""" return self._state - @property - def device_class(self) -> BinarySensorDeviceClass | None: - """Return the sensor class of the sensor.""" - return self._device_class - @property def extra_state_attributes(self) -> dict[str, Any]: """Return the state attributes of the sensor."""