From 390a4867853d0a735e73545833d995dc317138d6 Mon Sep 17 00:00:00 2001 From: whc2001 Date: Sun, 14 Jul 2024 01:38:06 -0400 Subject: [PATCH] =?UTF-8?q?=F0=9F=92=A6=20improve=20for=20humidifier=20(#1?= =?UTF-8?q?761)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 🔧 fix humidifier mode setting when power is off * 🔧 allow mode sanity check before turning on --- custom_components/xiaomi_miot/humidifier.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/custom_components/xiaomi_miot/humidifier.py b/custom_components/xiaomi_miot/humidifier.py index ebd112edf..d09b1456c 100644 --- a/custom_components/xiaomi_miot/humidifier.py +++ b/custom_components/xiaomi_miot/humidifier.py @@ -195,4 +195,7 @@ def set_mode(self, mode: str): val = self._prop_mode.list_value(mode) if val is None: return False + if mode != MODE_OFF and not self.is_on: + if not self.turn_on(): + return False return self.set_property(self._prop_mode, val)