From 94465281f46886d5ba052e14af5a7c18ef939e34 Mon Sep 17 00:00:00 2001 From: Alone Date: Thu, 20 Feb 2025 14:42:27 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=9B=A0=20improve=20for=20`extend=5Fmiot?= =?UTF-8?q?=5Fspecs`=20(#2372)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- custom_components/xiaomi_miot/__init__.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/custom_components/xiaomi_miot/__init__.py b/custom_components/xiaomi_miot/__init__.py index a30f6ef2b..e0ee9d8e3 100644 --- a/custom_components/xiaomi_miot/__init__.py +++ b/custom_components/xiaomi_miot/__init__.py @@ -197,7 +197,11 @@ async def async_setup(hass, hass_config: dict): def extend_miot_specs(): with open(os.path.dirname(__file__) + '/core/miot_specs_extend.json') as file: - models = json.load(file) or {} + try: + models = json.load(file) or {} + except ValueError as exc: + models = {} + _LOGGER.exception('Error parsing miot_specs_extend.json: %s', exc) for m, specs in models.items(): DEVICE_CUSTOMIZES.setdefault(m, {}) DEVICE_CUSTOMIZES[m]['extend_miot_specs'] = specs