From 3078956b306f4f6d2892741fa6d0ae71cbfa195d Mon Sep 17 00:00:00 2001 From: Simon Hu Date: Mon, 26 Aug 2024 10:17:02 +0800 Subject: [PATCH] =?UTF-8?q?=E7=94=A8=E5=86=85=E9=83=A8=E5=8F=98=E9=87=8F?= =?UTF-8?q?=E5=BD=A2=E5=BC=8F=E4=BD=9C=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- custom_components/airtub_udp/sensor.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/custom_components/airtub_udp/sensor.py b/custom_components/airtub_udp/sensor.py index 12271f1..821b718 100755 --- a/custom_components/airtub_udp/sensor.py +++ b/custom_components/airtub_udp/sensor.py @@ -122,12 +122,12 @@ def state(self, value): self._state = value # 仅在 device_class 为 gas 并且值为 0 时触发 last_reset - if self.device_class == SensorDeviceClass.GAS and self._state == 0: + if self._attr_device_class == SensorDeviceClass.GAS and self._state == 0: self._attr_last_reset = datetime.now() @property def last_reset(self): - if self.device_class == SensorDeviceClass.GAS: + if self._attr_device_class == SensorDeviceClass.GAS: return self._attr_last_reset return None