From 93e3f25d692ecc92f82d340b728b6bfd2fe6d048 Mon Sep 17 00:00:00 2001 From: jkerdreux-imt <jerome.kerdreux@imt-atlantique.fr> Date: Fri, 31 Jan 2025 13:32:40 +0100 Subject: [PATCH] We can now dumps the devices values ;) --- devices/protocols/ZwaveJS/xaal/zwavejs/gw.py | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/devices/protocols/ZwaveJS/xaal/zwavejs/gw.py b/devices/protocols/ZwaveJS/xaal/zwavejs/gw.py index 82fb319c..c913426f 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): -- GitLab