Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions packages/modules/devices/sma/sma_sunny_boy/inverter.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ def read(self) -> InverterState:
# Leistung DC an Eingang 1 und 2
dc_power = (self.tcp_client.read_holding_registers(30773, ModbusDataType.INT_32, unit=unit) +
self.tcp_client.read_holding_registers(30961, ModbusDataType.INT_32, unit=unit))
current_L1 = self.tcp_client.read_holding_registers(30977, ModbusDataType.INT_32, unit=unit) * -1
current_L2 = self.tcp_client.read_holding_registers(30979, ModbusDataType.INT_32, unit=unit) * -1
current_L3 = self.tcp_client.read_holding_registers(30981, ModbusDataType.INT_32, unit=unit) * -1
currents = [current_L1 / 1000, current_L2 / 1000, current_L3 / 1000]
elif self.component_config.configuration.version == SmaInverterVersion.core2:
# AC Wirkleistung über alle Phasen (W) [Pac]
power_total = self.tcp_client.read_holding_registers(40084, ModbusDataType.INT_16, unit=unit) * 10
Expand All @@ -76,6 +80,8 @@ def read(self) -> InverterState:
raise ValueError("Unbekannte Version "+str(self.component_config.configuration.version))
if power_total == self.SMA_INT32_NAN or power_total == self.SMA_NAN:
power_total = 0
# Bei keiner AC Wirkleistung müssen auch die Ströme der Phasen 0 sein.
currents = [0, 0, 0]

if energy == self.SMA_UINT32_NAN:
raise ValueError(
Expand All @@ -89,6 +95,7 @@ def read(self) -> InverterState:
inverter_state = InverterState(
power=power_total * -1,
dc_power=dc_power * -1,
currents=currents,
exported=energy,
imported=imported
)
Expand Down
7 changes: 6 additions & 1 deletion packages/modules/devices/sungrow/sungrow/bat.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,11 @@ def initialize(self) -> None:

def update(self) -> None:
unit = self.device_config.configuration.modbus_id
soc = int(self.__tcp_client.read_input_registers(13022, ModbusDataType.UINT_16, unit=unit) / 10)
soc = int(
self.__tcp_client.read_input_registers(13022, ModbusDataType.UINT_16, unit=unit) / 10)
# Es gibt nur einen DC Strom der Batterie, daher Aufteilen auf 3 Phasenströme
bat_current = self.__tcp_client.read_input_registers(13020, ModbusDataType.INT_16, unit=unit) * -0.1
currents = [bat_current / 3] * 3

if (
Firmware(self.device_config.configuration.firmware) == Firmware.v2
Expand Down Expand Up @@ -66,6 +70,7 @@ def update(self) -> None:
bat_state = BatState(
power=bat_power,
soc=soc,
currents=currents,
imported=imported,
exported=exported
)
Expand Down
9 changes: 8 additions & 1 deletion packages/modules/devices/sungrow/sungrow/inverter.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,18 @@ def update(self) -> float:
dc_power = self.__tcp_client.read_input_registers(5016, ModbusDataType.UINT_32,
wordorder=Endian.Little, unit=unit) * -1

_, exported = self.sim_counter.sim_count(power)
current_L1 = self.__tcp_client.read_input_registers(13030, ModbusDataType.INT_16, unit=unit) * -0.1
current_L2 = self.__tcp_client.read_input_registers(13031, ModbusDataType.INT_16, unit=unit) * -0.1
current_L3 = self.__tcp_client.read_input_registers(13032, ModbusDataType.INT_16, unit=unit) * -0.1
currents = [current_L1, current_L2, current_L3]

imported, exported = self.sim_counter.sim_count(power)

inverter_state = InverterState(
power=power,
dc_power=dc_power,
currents=currents,
imported=imported,
exported=exported
)
self.store.set(inverter_state)
Expand Down