OZW objects should be imported inside of the ZwavePlugin class to prevent ImportError on other Z-Wave plugins that don't depend on OZW

This commit is contained in:
Fabio Manganiello 2021-04-18 02:19:53 +02:00
parent 02a22d4a88
commit 68c44c0c3c

View file

@ -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)