From d4b049d8b0b282af355ab95599c583df3470e91e Mon Sep 17 00:00:00 2001 From: Christoph Date: Thu, 1 Aug 2024 15:46:42 +0200 Subject: [PATCH 1/5] Update __init__.py --- custom_components/zha_toolkit/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/custom_components/zha_toolkit/__init__.py b/custom_components/zha_toolkit/__init__.py index 20502e9..d71be67 100644 --- a/custom_components/zha_toolkit/__init__.py +++ b/custom_components/zha_toolkit/__init__.py @@ -4,7 +4,7 @@ import homeassistant.helpers.config_validation as cv import voluptuous as vol -from homeassistant.components.zha.core.gateway import ZHAGateway +from homeassistant.components.zha import Gateway from homeassistant.util import dt as dt_util from zigpy import types as t from zigpy.exceptions import DeliveryError From ef0563c0acae8e5f370504ff4afb211d432edc31 Mon Sep 17 00:00:00 2001 From: Christoph Date: Thu, 1 Aug 2024 15:47:17 +0200 Subject: [PATCH 2/5] Update utils.py --- custom_components/zha_toolkit/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/custom_components/zha_toolkit/utils.py b/custom_components/zha_toolkit/utils.py index e3d0307..6a6b041 100644 --- a/custom_components/zha_toolkit/utils.py +++ b/custom_components/zha_toolkit/utils.py @@ -10,7 +10,7 @@ from enum import Enum import zigpy -from homeassistant.components.zha.core.gateway import ZHAGateway +from homeassistant.components.zha import Gateway from homeassistant.util import dt as dt_util from pkg_resources import get_distribution, parse_version from zigpy import types as t From 73834113bb549e862b50636749603f97e712a941 Mon Sep 17 00:00:00 2001 From: Christoph Date: Thu, 1 Aug 2024 17:27:40 +0200 Subject: [PATCH 3/5] Update __init__.py --- custom_components/zha_toolkit/__init__.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/custom_components/zha_toolkit/__init__.py b/custom_components/zha_toolkit/__init__.py index d71be67..9170042 100644 --- a/custom_components/zha_toolkit/__init__.py +++ b/custom_components/zha_toolkit/__init__.py @@ -4,7 +4,12 @@ import homeassistant.helpers.config_validation as cv import voluptuous as vol -from homeassistant.components.zha import Gateway + +try: + from homeassistant.components.zha import Gateway as ZHAGateway +except: + from homeassistant.components.zha.core.gateway import ZHAGateway + from homeassistant.util import dt as dt_util from zigpy import types as t from zigpy.exceptions import DeliveryError From f72a7fa1560df5fa3106051aeee1aefd1889d66c Mon Sep 17 00:00:00 2001 From: Christoph Date: Thu, 1 Aug 2024 17:27:58 +0200 Subject: [PATCH 4/5] Update utils.py --- custom_components/zha_toolkit/utils.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/custom_components/zha_toolkit/utils.py b/custom_components/zha_toolkit/utils.py index 6a6b041..48e6877 100644 --- a/custom_components/zha_toolkit/utils.py +++ b/custom_components/zha_toolkit/utils.py @@ -10,7 +10,12 @@ from enum import Enum import zigpy -from homeassistant.components.zha import Gateway + +try: + from homeassistant.components.zha import Gateway as ZHAGateway +except: + from homeassistant.components.zha.core.gateway import ZHAGateway + from homeassistant.util import dt as dt_util from pkg_resources import get_distribution, parse_version from zigpy import types as t From 2ba1ba9e7add25bdf6f77041a50f7b9f2932bce3 Mon Sep 17 00:00:00 2001 From: mdeweerd Date: Thu, 1 Aug 2024 18:01:00 +0200 Subject: [PATCH 5/5] Add more specific exception: ImportError --- custom_components/zha_toolkit/__init__.py | 4 ++-- custom_components/zha_toolkit/utils.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/custom_components/zha_toolkit/__init__.py b/custom_components/zha_toolkit/__init__.py index 9170042..96121bd 100644 --- a/custom_components/zha_toolkit/__init__.py +++ b/custom_components/zha_toolkit/__init__.py @@ -7,9 +7,9 @@ try: from homeassistant.components.zha import Gateway as ZHAGateway -except: +except ImportError: from homeassistant.components.zha.core.gateway import ZHAGateway - + from homeassistant.util import dt as dt_util from zigpy import types as t from zigpy.exceptions import DeliveryError diff --git a/custom_components/zha_toolkit/utils.py b/custom_components/zha_toolkit/utils.py index 48e6877..e897df6 100644 --- a/custom_components/zha_toolkit/utils.py +++ b/custom_components/zha_toolkit/utils.py @@ -13,7 +13,7 @@ try: from homeassistant.components.zha import Gateway as ZHAGateway -except: +except ImportError: from homeassistant.components.zha.core.gateway import ZHAGateway from homeassistant.util import dt as dt_util