From 488dfff633786f7931a6b266a2463fe4bc8a5eb6 Mon Sep 17 00:00:00 2001 From: Alone Date: Fri, 13 Dec 2024 11:52:53 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=98=BA=20fix=20for=20xiaomi.feeder.pi2001?= =?UTF-8?q?=20(#2036)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- custom_components/xiaomi_miot/core/device_customizes.py | 3 +++ custom_components/xiaomi_miot/core/utils.py | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/custom_components/xiaomi_miot/core/device_customizes.py b/custom_components/xiaomi_miot/core/device_customizes.py index e1a12f77a..73e2eeda2 100644 --- a/custom_components/xiaomi_miot/core/device_customizes.py +++ b/custom_components/xiaomi_miot/core/device_customizes.py @@ -1618,6 +1618,9 @@ 'sensor_properties': 'pet_food_left_level,fault,desiccant_left_level,desiccant_left_time', 'switch_properties': 'compensate_switch,prevent_accumulation', }, + 'xiaomi.feeder.pi2001:pet_food_out': { + 'action_params': 1, + }, 'xiaomi.health_pot.p1': { 'select_actions': 'start_cook', }, diff --git a/custom_components/xiaomi_miot/core/utils.py b/custom_components/xiaomi_miot/core/utils.py index 88ceedbc1..50ce8f836 100644 --- a/custom_components/xiaomi_miot/core/utils.py +++ b/custom_components/xiaomi_miot/core/utils.py @@ -95,7 +95,9 @@ def custom_config_list(self, key=None, default=None): lst = self.custom_config(key) if lst is None: return default - if not isinstance(lst, list): + if isinstance(lst, (int, float, bool)): + lst = [lst] + elif not isinstance(lst, list): lst = f'{lst}'.split(',') lst = list(map(lambda x: x.strip(), lst)) return lst