From 5e96038d24a032d47ccc2ff3f987352367900ec1 Mon Sep 17 00:00:00 2001 From: Maurice Schmicking <17197791+0x7878@users.noreply.github.com> Date: Mon, 20 Nov 2023 09:59:01 +0100 Subject: [PATCH] Fix serial number retrieval and add power (#124) * Fix serial number retrieval and add power measurement for Ahoy variant Co-authored-by: c-graeser <> * Fix indent; remove comment Co-authored-by: c-graeser < > --- dbus_service.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/dbus_service.py b/dbus_service.py index 0536db2..0fa64f4 100644 --- a/dbus_service.py +++ b/dbus_service.py @@ -277,7 +277,7 @@ def _get_serial(self, pvinverternumber): if self.dtuvariant == constants.DTUVARIANT_AHOY: if not meter_data["inverter"][pvinverternumber]["name"]: raise ValueError("Response does not contain name") - serial = meter_data["inverter"][pvinverternumber]["name"] + serial = meter_data["inverter"][pvinverternumber]["serial"] elif self.dtuvariant == constants.DTUVARIANT_OPENDTU: if not meter_data["inverters"][pvinverternumber]["serial"]: @@ -650,7 +650,10 @@ def set_dbus_values(self): # the phase angles are 120 degrees apart # sqrt(3) = 1.73205080757 <-- So we do not need to include Math Library singlePhaseVoltage = voltage / 1.73205080757 - + if self.dtuvariant == constants.DTUVARIANT_AHOY: + singlePhaseVoltage = voltage + self._dbusservice["/Ac/Power"] = power + realCurrent = power / 3 / singlePhaseVoltage self._dbusservice["/Ac/L1/Voltage"] = singlePhaseVoltage