From 3e1f5b334459cbe91e5ed64c7b7750708f9d890c Mon Sep 17 00:00:00 2001
From: jkerdreu <jkerdreu@b32b6428-25c9-4566-ad07-03861ab6144f>
Date: Tue, 18 Oct 2022 07:07:26 +0000
Subject: [PATCH] - Added a method to find unknow DPS on powerrelays,
 smart-plugs ..

git-svn-id: https://redmine.imt-atlantique.fr/svn/xaal/code/Python/branches/0.7@3025 b32b6428-25c9-4566-ad07-03861ab6144f
---
 devices/protocols/Tuya/xaal/tuya/devices.py | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/devices/protocols/Tuya/xaal/tuya/devices.py b/devices/protocols/Tuya/xaal/tuya/devices.py
index 9b4f3a12..b4b190c6 100644
--- a/devices/protocols/Tuya/xaal/tuya/devices.py
+++ b/devices/protocols/Tuya/xaal/tuya/devices.py
@@ -147,8 +147,20 @@ class SmartPlug(PowerRelay):
         PowerRelay.setup(self)
         # related power relays
         pmeter.attributes['devices'] = [k.address for k in self.devices[1:]]
-        
+
+    def debug_dps(self, dps):
+        k_dps = list(self.dps_to_dev.keys())
+        k_dps = k_dps + self.pmeter_dps
+        r = ''
+        for k,v in dps.items():
+            if k not in k_dps:
+                r = r + f"'{k}'->{v}    "
+        if len(r) > 0:
+            logger.info(f"{self.tuya_id} unknow DPS: {r}")
+
     def on_dps(self,dps):
+        if self.debug:
+            self.debug_dps(dps)
         PowerRelay.on_dps(self,dps)
         pmeter_attr = self.devices[0].attributes
         # current 
-- 
GitLab