From c1a4d7d1f1daf94f7d3eec70db60984bfe76a0f7 Mon Sep 17 00:00:00 2001 From: Alone Date: Sat, 16 Dec 2023 18:50:02 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=92=A6=20add=20`mode=5Fproperty`=20option?= =?UTF-8?q?=20for=20humidifier=20(#1421)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- custom_components/xiaomi_miot/humidifier.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/custom_components/xiaomi_miot/humidifier.py b/custom_components/xiaomi_miot/humidifier.py index e0173f8d4..14a82466c 100644 --- a/custom_components/xiaomi_miot/humidifier.py +++ b/custom_components/xiaomi_miot/humidifier.py @@ -68,13 +68,11 @@ def __init__(self, config: dict, miot_service: MiotService): self._prop_target_humi = self._environment.get_property('target_humidity') or self._prop_target_humi self._prop_humidity = self._environment.get_property('relative_humidity', 'humidity') or self._prop_humidity - self._prop_mode = None self._mode_props = list(filter(lambda x: x, [ miot_service.get_property('mode'), miot_service.get_property('fan_level'), ])) - if self._mode_props: - self._prop_mode = self._mode_props.pop(0) + self._prop_mode = self._mode_props[0] if self._mode_props else None if prop := self.custom_config('mode_property'): if prop := self._miot_service.spec.get_property(prop): self._prop_mode = prop