Skip to content

Conversation

@ndrsnhs
Copy link
Contributor

@ndrsnhs ndrsnhs commented Jan 16, 2025

class SolaxBat(AbstractBat):
def __init__(self,
device_id: int,
device_config: Union[Dict, Solax],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
device_config: Union[Dict, Solax],
device_config: Solax,

Das Dictionary wird in der Subdata in eine Klasse konvertiert.

exported, imported = [value * 10 for value in self.__tcp_client.read_input_registers(
0x043D, [ModbusDataType.UINT_32] * 2, wordorder=Endian.Little, unit=unit)]

if SolaxVersion(self.device_config.configuration.version) == SolaxVersion.G3:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if SolaxVersion(self.device_config.configuration.version) == SolaxVersion.G3:
elif SolaxVersion(self.device_config.configuration.version) == SolaxVersion.G3:

Muss hier nicht ein elif hin? Sonst werden beim G2 die Werte im else-Zweig nochmal versucht auszulesen.

with self.__tcp_client:
power = self.__tcp_client.read_input_registers(22, ModbusDataType.INT_16, unit=self.__modbus_id)
soc = self.__tcp_client.read_input_registers(28, ModbusDataType.UINT_16, unit=self.__modbus_id)
# kein Speicher für Versionen G2 und G4
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

with self.__tcp_client: Im Device wird in der update-Funktion der Kontext-Handler gestartet. Ist er hier nochmal erforderlich?

power = self.__tcp_client.read_input_registers(0x0413, ModbusDataType.UINT_16, unit=unit) * -1
exported = self.__tcp_client.read_input_registers(
0x0423, ModbusDataType.UINT_32, wordorder=Endian.Little, unit=unit) * 100
if SolaxVersion(self.device_config.configuration.version) == SolaxVersion.G3:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if SolaxVersion(self.device_config.configuration.version) == SolaxVersion.G3:
elif SolaxVersion(self.device_config.configuration.version) == SolaxVersion.G3:

class SolaxInverter(AbstractInverter):
def __init__(self,
device_id: int,
device_config: Union[Dict, Solax],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
device_config: Union[Dict, Solax],
device_config: Solax,

class SolaxCounter(AbstractCounter):
def __init__(self,
device_id: int,
device_config: Union[Dict, Solax],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
device_config: Union[Dict, Solax],
device_config: Solax,

self.modbus_id = modbus_id
self.ip_address = ip_address
self.port = port
self.version = version
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Muss die neue Einstellung version nicht auch noch in update_config hinzugefügt werden?

@ndrsnhs ndrsnhs requested a review from LKuemmel January 16, 2025 11:08
@LKuemmel LKuemmel merged commit ae1dc55 into openWB:master Jan 30, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants