Skip to content

Commit

Permalink
Fix serial number retrieval and add power (#124)
Browse files Browse the repository at this point in the history
* 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 < >
  • Loading branch information
0x7878 authored Nov 20, 2023
1 parent 81ad41b commit 5e96038
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions dbus_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"]:
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 5e96038

Please sign in to comment.