From 211aa11790018cdbe650aa0e379dc61cc6bc9dcb Mon Sep 17 00:00:00 2001
From: jkerdreux-imt <jerome.kerdreux@imt-atlantique.fr>
Date: Sun, 2 Feb 2025 23:39:20 +0100
Subject: [PATCH] Support value changes

---
 devices/protocols/ZwaveJS/xaal/zwavejs/gw.py | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/devices/protocols/ZwaveJS/xaal/zwavejs/gw.py b/devices/protocols/ZwaveJS/xaal/zwavejs/gw.py
index cef29476..8923fbec 100644
--- a/devices/protocols/ZwaveJS/xaal/zwavejs/gw.py
+++ b/devices/protocols/ZwaveJS/xaal/zwavejs/gw.py
@@ -51,12 +51,20 @@ class GW:
         for node in nodes.values():
             if node.ready:
                 logger.warning(f"{node.node_id} {node.device_config.manufacturer}/{node.device_config.label} ")
+                node.on("value updated", self.on_value_updated)
                 for k in node.values:
                     value = node.values.get(k)
                     if value:
                         print(f"{k} {value.property_name} => {value.value}")
             # pprint(node.data)
 
+    def on_value_updated(self, event):
+        cmd_class = event["args"]["commandClass"]
+        nodeId = event["nodeId"]
+        value = event["value"]
+        logger.warning(f"{nodeId}.{value.endpoint} {cmd_class}={value.property_key_name}=>{event["args"]["newValue"]}")
+        # print(event)
+
 
 def setup(eng):
     GW(eng)
-- 
GitLab