From 40a66cc6bacd020234f9d8af5f06425836b1e1bb Mon Sep 17 00:00:00 2001 From: Alone Date: Fri, 14 May 2021 19:10:38 +0800 Subject: [PATCH] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20improve=20for=20climate=20?= =?UTF-8?q?(#75)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- custom_components/xiaomi_miot/__init__.py | 2 +- custom_components/xiaomi_miot/climate.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/custom_components/xiaomi_miot/__init__.py b/custom_components/xiaomi_miot/__init__.py index 9d48a7eb6..176a67d22 100644 --- a/custom_components/xiaomi_miot/__init__.py +++ b/custom_components/xiaomi_miot/__init__.py @@ -315,7 +315,7 @@ async def async_setup_xiaomi_cloud(hass: hass_core.HomeAssistant, config_entry: CONF_CONFIG_VERSION: entry.get(CONF_CONFIG_VERSION) or 0, } config['configs'].append(cfg) - _LOGGER.debug('Xiaomi cloud device: %s', {**cfg, CONF_TOKEN: ''}) + _LOGGER.debug('Xiaomi cloud device: %s', {**cfg, CONF_TOKEN: '****'}) hass.data[DOMAIN][entry_id] = config return True diff --git a/custom_components/xiaomi_miot/climate.py b/custom_components/xiaomi_miot/climate.py index 48db6fcca..31342a638 100644 --- a/custom_components/xiaomi_miot/climate.py +++ b/custom_components/xiaomi_miot/climate.py @@ -383,8 +383,8 @@ def preset_mode(self): return HVAC_MODE_OFF if self._preset_modes and self._prop_mode: acm = self._prop_mode.from_dict(self._state_attrs) - acm = -1 if acm is None else int(acm or 0) - return self._preset_modes.get(acm, HVAC_MODE_OFF) + acm = -1 if acm is None else acm + return self._preset_modes.get(acm) return None @property