binsentsu / home-assistant-solaredge-modbus

Home assistant Component for reading data locally from Solaredge inverter through modbus TCP
280 stars 70 forks source link

Error in connection: connection unexpectedly closed - any tips appreciated! #140

Open AdriaanKodde opened 1 year ago

AdriaanKodde commented 1 year ago

Dear all,

I have been trying to get solarEdge Modbus integration to work but failed thus far.

Any hits/tips on what the issue might be? Any tips are highly appreciated! Adriaan

What do I have I have a SE2200E inverter purchased in 2016. First I was unsure if this model supported modbus over TCP. Therefore I reached out SolarEdge helpdesk who comfirmed that it was supported. They upgraded the firmware and enabled modbus over TCP (remotely) to port 502. This is now also shown on the inverter display that modbus of TCP is active with the IP address and port displayed.

It is a single phase inverter without any other features, so I selected only meter 1 in the config menu. Installation proceeded without warnings.

The section in the core.config_entries file is identical to the post in the discussion session with source defined as "user" and unique_ID as the ip address.

What do I see

The entities show up as "unknown" with no data being logged.

the log file reads an "connection unexpectedly closed" (see full extract of log file below)

=========start extract of log file ============ 2023-02-11 11:40:01.412 ERROR (MainThread) [custom_components.solaredge_modbus] Error reading modbus data Traceback (most recent call last): File "/config/custom_components/solaredge_modbus/init.py", line 209, in async_refresh_modbus_data update_result = self.read_modbus_data() File "/config/custom_components/solaredge_modbus/init.py", line 262, in read_modbus_data self.read_modbus_data_inverter() File "/config/custom_components/solaredge_modbus/init.py", line 547, in read_modbus_data_inverter inverter_data = self.read_holding_registers( File "/config/custom_components/solaredge_modbus/init.py", line 246, in read_holding_registers return self._client.read_holding_registers( File "/usr/local/lib/python3.10/site-packages/pymodbus/client/mixin.py", line 104, in read_holding_registers return self.execute( File "/usr/local/lib/python3.10/site-packages/pymodbus/client/base.py", line 195, in execute return self.transaction.execute(request) File "/usr/local/lib/python3.10/site-packages/pymodbus/transaction.py", line 168, in execute response, last_exception = self._transact( File "/usr/local/lib/python3.10/site-packages/pymodbus/transaction.py", line 323, in _transact result = self._recv(response_length, full) File "/usr/local/lib/python3.10/site-packages/pymodbus/transaction.py", line 362, in _recv read_min = self.client.framer.recvPacket(min_size) File "/usr/local/lib/python3.10/site-packages/pymodbus/framer/init.py", line 53, in recvPacket return self.client.recv(size) # pylint: disable=no-member File "/usr/local/lib/python3.10/site-packages/pymodbus/client/tcp.py", line 297, in recv return self._handle_abrupt_socket_close( File "/usr/local/lib/python3.10/site-packages/pymodbus/client/tcp.py", line 347, in _handle_abrupt_socket_close raise ConnectionException(msg) pymodbus.exceptions.ConnectionException: Modbus Error: [Connection] ModbusTcpClient(192.168.XXX.XXX:502): Connection unexpectedly closed 3.0040740966796875e-05 seconds into read of 8 bytes without response from unit before it closed connection =========end extract of log file ============

AdriaanKodde commented 1 year ago

Dear all, as an update to my request below. I installed the solaredge modbus multi device package. That works fine. So that is my resolution of this issue.

MSiegrist commented 1 year ago

The same error started appearing for me. This error still persist in this integration. @AdriaanKodde could you please re-open this issue?

AdriaanKodde commented 1 year ago

On request of @MSiegrist