zivillian / enverproxy

forked from https://gitlab.eitelwein.net/MEitelwein/Enverbridge-Proxy
8 stars 5 forks source link

Support for EVT800 #9

Open stsch99 opened 2 months ago

stsch99 commented 2 months ago

The Envertech EVT800 has a other cmd id in the data.hex string. I had to add the 680056681004.

--- a/enverproxy.py
+++ b/enverproxy.py
@@ -253,7 +253,7 @@ class TheServer:
                 self.__log.logMsg('Reply sent to: ' + str(self.s), 3)
                 data = json.dumps({"ip":self.s.getpeername()[0], "last_seen":datetime.utcnow().isoformat()})
                 self.mqtt.publish('enverbridge/bridge', data)
-            elif data[:6].hex() == '6803d6681004':
+            elif data[:6].hex() in ['6803d6681004', '680056681004']:
                 # payload from converter
                 self.process_data(data)
             else:

Additionally the extract function breaks because of an empty string. To fix this my solution is to calculate wr_index_max out of the lenth:

--- a/enverproxy.py
+++ b/enverproxy.py
@@ -211,7 +211,7 @@ class TheServer:
         datainhex = data.hex()
         wr = []
         wr_index = 0
-        wr_index_max = 20
+        wr_index_max = ((len(datainhex)-40)//64)
         self.__log.logMsg("Processing Data", 5)
         while True:
             if len(datainhex) > (40+64+64*wr_index):

This setting works fine for me with docker and the Envertech EVT800 with wifi. I have set the Network Parameters setting to TCP-Client and have set the Server Address to the docker host.

josefpavlik commented 1 month ago

I confirm that the patch works well with EVT800. Thank you stsch99