Open rafal98 opened 3 months ago
I think the issue is linked to a connect optimization that keep the last connection, but it can't work if you have several inverters
My change was to keep the last serial used. If it's the same, so ok use the current connection. Else it's probably necessary to close the current connection before opening a new one, not sure about that
def connect_to_server(self):
if self._modbus and self.last_serial == self._serial:
return self._modbus
log.info(f"Connecting to solarman data logger {self._host}:{self._port} (serial: {self._serial}, modbus: {self._mb_slaveid})")
self._modbus = PySolarmanV5(self._host, self._serial, port=self._port, mb_slave_id=self._mb_slaveid, logger=log, auto_reconnect=True, socket_timeout=15)
self.last_serial = self._serial
Now it works :-)
@rafal98 Does the change to connect_to_server
fix the issue of unknown values for the second inverter? Looking at the code it seems that each integration has their own Inverter
instance so I don't understand how the connections can get mixed up.
Hi @Elijen, it's perhaps a side effect, I don't know, but after my quick fix, it works like a charm: I have all entities with updated values
I have noticed my error message was different:
V5FrameError: V5 frame does not contain a valid Modbus RTU frame
After downgrading from 1.5.1
to version 1.4.3
I started getting a parsing error that I solved by changing validation rules in the inverter config file. For some reason slave inverter is reporting battery temperature as -100
and the integration was throwing all data away because of it.
I think the issue is linked to a connect optimization that keep the last connection, but it can't work if you have several inverters
My change was to keep the last serial used. If it's the same, so ok use the current connection. Else it's probably necessary to close the current connection before opening a new one, not sure about that
def connect_to_server(self): if self._modbus and self.last_serial == self._serial: return self._modbus log.info(f"Connecting to solarman data logger {self._host}:{self._port} (serial: {self._serial}, modbus: {self._mb_slaveid})") self._modbus = PySolarmanV5(self._host, self._serial, port=self._port, mb_slave_id=self._mb_slaveid, logger=log, auto_reconnect=True, socket_timeout=15) self.last_serial = self._serial
Now it works :-)
Hi @rafal98
I have the same problems as you with my second inverter Deye SUN-10K-SG04LP3-EU. My master inverter is showing the correct values but my second configured logger/inverter is showing all values as only unknown. Could you please elaborate a little further how you solved the proplem. I'm a complete newibe so have patience with my ignorance. I imagine I need to change something in some configfile but I don't realy know where an how.
Hi Ornulf,
I suggest you install the "Studio code server" add-on, and openit then browse folder "CONFIG/custom_components/solarman/" then open/edit "solarman.py" then replace the "connect_to_server" function by my modified version (on previous post). You will see that the difference is small (I only add self.last_serial variable)
Have fun !
Cheers. I will test that👍Skickat från min iPhone3 apr. 2024 kl. 21:58 skrev rafal98 @.***>: Hi Ornulf, I suggest you install the "Studio code server" add-on, and openit then browse folder "CONFIG/custom_components/solarman/" then open/edit "solarman.py" then replace the "connect_to_server" function by my modified version (on previous post). You will see that the difference is small (I only add self.last_serial variable) Have fun !
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you commented.Message ID: @.***>
Hi Stephan,
I add in ha my first inverter and it works well :-) Then a couple of days after I configure another inverter as a slave (with parallel option) and add it too to ha. Configuration seems ok in the plugin, but no info are reported on this second device.
So the log show some interesting errors. Most interesting log is " failed with exception [V5FrameError: V5 frame contains incorrect data logger serial number" But I'm sure that my logger SN (not inverter SN) is correct since with another tool I grab data ('192.168.2.142', 8899) => this is the IP of the second inverter 2907701578 is the correct SN of the second inverter.
Notes:
in this log, we can see the config of the 2nd device:
2024-03-19 16:42:53.205 DEBUG (MainThread) [custom_components.solarman.config_flow] config_flow.py:step_user_data_schema: {'name': 'deye2', 'inverter_host': '192.168.2.142', 'inverter_serial': 2907701578, 'inverter_port': 8899, 'inverter_mb_slaveid': 1, 'lookup_file': 'deye_hybrid.yaml'}
Regards,
Laurent