From 68c44c0c3c4f9e80f2b4299c21905e9258b31f44 Mon Sep 17 00:00:00 2001 From: Fabio Manganiello Date: Sun, 18 Apr 2021 02:19:53 +0200 Subject: [PATCH] OZW objects should be imported inside of the `ZwavePlugin` class to prevent `ImportError` on other Z-Wave plugins that don't depend on OZW --- platypush/plugins/zwave/__init__.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/platypush/plugins/zwave/__init__.py b/platypush/plugins/zwave/__init__.py index 774d616cb..dac30f561 100644 --- a/platypush/plugins/zwave/__init__.py +++ b/platypush/plugins/zwave/__init__.py @@ -1,10 +1,5 @@ from typing import Any, Dict, Optional, List, Union -from openzwave.group import ZWaveGroup -from openzwave.node import ZWaveNode -from openzwave.scene import ZWaveScene -from openzwave.value import ZWaveValue - from platypush.backend.zwave import ZwaveBackend from platypush.context import get_backend from platypush.plugins import action @@ -24,6 +19,11 @@ class ZwavePlugin(ZwaveBasePlugin, SwitchPlugin): """ + from openzwave.group import ZWaveGroup + from openzwave.node import ZWaveNode + from openzwave.scene import ZWaveScene + from openzwave.value import ZWaveValue + @staticmethod def _get_backend() -> ZwaveBackend: backend = get_backend('zwave') @@ -507,6 +507,7 @@ class ZwavePlugin(ZwaveBasePlugin, SwitchPlugin): :param node_id: Select value by [node_id/node_name, value_label] :param node_name: Select value by [node_id/node_name, value_label] """ + from openzwave.node import ZWaveNode value = self._get_value(value_id=value_id, id_on_network=id_on_network, node_id=node_id, node_name=node_name, value_label=value_label) new_val = value.check_data(data)