diff --git a/devices/protocols/ZwaveJS/xaal/zwavejs/gw.py b/devices/protocols/ZwaveJS/xaal/zwavejs/gw.py index 82fb319cd91d857952b050b2efb3f8bb4ae4af44..c913426fb901a9160b5f776f4f25e65c35b022ac 100644 --- a/devices/protocols/ZwaveJS/xaal/zwavejs/gw.py +++ b/devices/protocols/ZwaveJS/xaal/zwavejs/gw.py @@ -3,15 +3,22 @@ import asyncio import pdb import logging +from pprint import pprint + + from zwave_js_server.client import Client as ZwaveClient from aiohttp.client import ClientSession -from xaal.lib import AsyncEngine, Device +from xaal.lib import AsyncEngine from xaal.schemas import devices PACKAGE_NAME = 'xaal.zwavejs' + logger = logging.getLogger(__name__) +# Disable zwave-js-server logs +logging.getLogger("zwave_js_server").setLevel(logging.WARNING) + URL = "ws://10.77.3.143:3000" @@ -37,11 +44,17 @@ class GW: async def run(self): await self.ready.wait() + assert self.client.driver # logger.warning(self.client.controller.nodes) logger.warning("ZwaveJS ready") nodes = self.client.driver.controller.nodes - for node in nodes: - logger.warning(node) + for node in nodes.values(): + if node.ready: + logger.warning(f"{node.node_id} {node.device_config.manufacturer}/{node.device_config.label} ") + for k in node.values: + value = node.values.get(k) + print(f"{k} {value.property_name} => {value.value}") + # pprint(node.data) def setup(eng):