From 3ba5b99dd0f8c6788fd044fc079a313c0d03bfd2 Mon Sep 17 00:00:00 2001 From: Alone Date: Sat, 12 Aug 2023 11:22:19 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A7=20fix=20for=20hass=20old=20version?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- custom_components/xiaomi_miot/core/const.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/custom_components/xiaomi_miot/core/const.py b/custom_components/xiaomi_miot/core/const.py index 195876cbe..91c06268a 100644 --- a/custom_components/xiaomi_miot/core/const.py +++ b/custom_components/xiaomi_miot/core/const.py @@ -4,7 +4,6 @@ from .device_customizes import DEVICE_CUSTOMIZES # noqa from .miot_local_devices import MIOT_LOCAL_MODELS # noqa from .translation_languages import TRANSLATION_LANGUAGES # noqa -from homeassistant.util.json import JsonObjectType DOMAIN = 'xiaomi_miot' DEFAULT_NAME = 'Xiaomi Miot' @@ -84,6 +83,12 @@ class EntityCategory(Enum): except (ModuleNotFoundError, ImportError): DOMAIN_TEXT = None +try: + # hass 2023.3 + from homeassistant.util.json import JsonObjectType +except (ModuleNotFoundError, ImportError): + JsonObjectType = dict + try: # hass 2023.7 from homeassistant.core import ServiceResponse, SupportsResponse