diff --git a/packages/modules/devices/sma/sma_sunny_boy/inverter.py b/packages/modules/devices/sma/sma_sunny_boy/inverter.py index a724caa63d..5c3b206d0d 100644 --- a/packages/modules/devices/sma/sma_sunny_boy/inverter.py +++ b/packages/modules/devices/sma/sma_sunny_boy/inverter.py @@ -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 @@ -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( @@ -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 ) diff --git a/packages/modules/devices/sungrow/sungrow/bat.py b/packages/modules/devices/sungrow/sungrow/bat.py index af3d288db1..b2c11f69f1 100644 --- a/packages/modules/devices/sungrow/sungrow/bat.py +++ b/packages/modules/devices/sungrow/sungrow/bat.py @@ -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 @@ -66,6 +70,7 @@ def update(self) -> None: bat_state = BatState( power=bat_power, soc=soc, + currents=currents, imported=imported, exported=exported ) diff --git a/packages/modules/devices/sungrow/sungrow/inverter.py b/packages/modules/devices/sungrow/sungrow/inverter.py index fe30c6f798..84e9ac8329 100644 --- a/packages/modules/devices/sungrow/sungrow/inverter.py +++ b/packages/modules/devices/sungrow/sungrow/inverter.py @@ -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)