schenlap / venus_kostal_pico

plugin for victron venusos for kostal pico
GNU General Public License v3.0
9 stars 3 forks source link

When disconnected - power still calculated in venus os #1

Closed mmeintel closed 3 years ago

mmeintel commented 3 years ago

HI Schenlap,

I just used your python script to get the Piko connected to a CCGX. Thanks for that!

I found an issue that when the Piko is disconnected the load is still active and the device does not disappear from the Schematics Page in CCGX (2.60).

I am not allowed to create a PR, so I will just add the patch right here.

iff --git a/kostal.py b/kostal.py
index f19a267..bd7610e 100755
--- a/kostal.py
+++ b/kostal.py
@@ -330,6 +330,18 @@ def kostal_update_cyclic(run_event) :
                        Kostal.stats.last_connection_errors = 0
                        Kostal.stats.reconnect += 1
                        kostal.set('/Connected', 0)
+                       kostal.set('/Ac/L1/Current', None)
+                       kostal.set('/Ac/L2/Current', None)
+                       kostal.set('/Ac/L3/Current', None)
+                       kostal.set('/Ac/L1/Power', None)
+                       kostal.set('/Ac/L2/Power', None)
+                       kostal.set('/Ac/L3/Power', None)
+                       kostal.set('/Ac/L1/Voltage', None)
+                       kostal.set('/Ac/L2/Voltage', None)
+                       kostal.set('/Ac/L3/Voltage', None)
+                       kostal.set('/Ac/Power', None)
+                       kostal.set('/Ac/Current', None)
+                       kostal.set('/Ac/Voltage', None)

                if dev_state == DevState.WaitForDevice:
                        if kostal_read_status(init=1) == 0:

Best regards, Martin

mmeintel commented 3 years ago

Duplicate - received a 404...