Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Errno 111] Connection refused #213

Open
philippegabert opened this issue Nov 24, 2023 · 8 comments
Open

[Errno 111] Connection refused #213

philippegabert opened this issue Nov 24, 2023 · 8 comments

Comments

@philippegabert
Copy link

philippegabert commented Nov 24, 2023

Hi,

I have been using the integration for quite some time and it works but I always have had some ERROR in the logs. My refresh rate is 1sec. I have the latest version installed (1.10.1).

2023-11-24 15:22:21.407 WARNING (MainThread) [custom_components.solaredge_modbus] not able to connect to 192.168.4.67:1502
2023-11-24 15:22:24.437 ERROR (MainThread) [pymodbus.logging] Connection to (192.168.4.67, 1502) failed: timed out
2023-11-24 15:22:24.437 WARNING (MainThread) [custom_components.solaredge_modbus] not able to connect to 192.168.4.67:1502
2023-11-24 15:22:26.297 ERROR (MainThread) [pymodbus.logging] Connection to (192.168.4.67, 1502) failed: [Errno 111] Connection refused
2023-11-24 15:22:26.298 WARNING (MainThread) [custom_components.solaredge_modbus] not able to connect to 192.168.4.67:1502
2023-11-24 15:22:26.334 ERROR (MainThread) [pymodbus.logging] Connection to (192.168.4.67, 1502) failed: [Errno 111] Connection refused

and also:

2023-11-24 15:26:21.314 ERROR (MainThread) [custom_components.solaredge_modbus] Error reading modbus data
Traceback (most recent call last):
  File "/config/custom_components/solaredge_modbus/__init__.py", line 232, in async_refresh_modbus_data
    update_result = self.read_modbus_data()
                    ^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/solaredge_modbus/__init__.py", line 309, in read_modbus_data
    and self.read_modbus_data_meter1()
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/solaredge_modbus/__init__.py", line 319, in read_modbus_data_meter1
    return self.read_modbus_data_meter("m1_", 40190)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/solaredge_modbus/__init__.py", line 334, in read_modbus_data_meter
    meter_data = self.read_holding_registers(
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/solaredge_modbus/__init__.py", line 291, in read_holding_registers
    return self._client.read_holding_registers(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/pymodbus/client/mixin.py", line 102, in read_holding_registers
    return self.execute(
           ^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/pymodbus/client/base.py", line 179, in execute
    raise ConnectionException(f"Failed to connect[{self!s}]")
pymodbus.exceptions.ConnectionException: Modbus Error: [Connection] Failed to connect[ModbusTcpClient(192.168.4.67:1502)]
2023-11-24 15:26:21.357 ERROR (MainThread) [pymodbus.logging] Connection to (192.168.4.67, 1502) failed: [Errno 111] Connection refused

Is there anyway to get rid of those errors? As mentioned, the integration works and I do get the data... so I don't know why the integration keeps on throwing those errors.

Thanks

@ChristophCaina
Copy link
Contributor

Connection refused means, that the inverter actively rejected the connection request.
I don't beleive, that this is something that can be fixed within the integration - at least, as long as we don't know when exactly this happens...

Is the Inverter in Sleep Mode (Night mode) when it refuses the connection request?
According to the time from the logs, I don't beleive so...

Also, the Software Version of the Inverter could be relevant...
But these are not provided by the Modbus Integration (AFAIK)...

only with the Core-Integration (which connects to the web api) you will get the information as Attribute of the "inverters" sensor...

dsp1Version: 1.13.2016
dsp2Version: 2.19.1601
cpuVersion: 4.16.25

I would also get in contact with the SolarEdge support, to check, if this might be a firmware issue - or if this might already be fixed with a newer firmware that needs to be installed on the inverter.

@philippegabert
Copy link
Author

Thanks @ChristophCaina. Question though: It looks to me that it's normal that the inverter refuses the connection as you can only have active.
But... why does the integration tries to connect to the inverter? I assume (but may be wrong) that the "Connection refused" is for "new" connections to the inverter... In the case you have short update frequencies (1 second) and short timeout, the integration should be able to reuse existing connections and therefore not throw those kind of errors?

@legantois
Copy link

legantois commented Mar 17, 2024

#184

Still getting same issue regularly; there should be a way to handle this

2024-03-17 06:43:38.493 ERROR (SyncWorker_31) [custom_components.solaredge_modbus] Error reading modbus data
Traceback (most recent call last):
File "/config/custom_components/solaredge_modbus/init.py", line 247, in _refresh_modbus_data
update_result = self.read_modbus_data()
^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/solaredge_modbus/init.py", line 321, in read_modbus_data
self.read_modbus_data_inverter()
File "/config/custom_components/solaredge_modbus/init.py", line 608, in read_modbus_data_inverter
inverter_data = self.read_holding_registers(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/solaredge_modbus/init.py", line 305, in read_holding_registers
return self._client.read_holding_registers(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/pymodbus/client/mixin.py", line 102, in read_holding_registers
return self.execute(
^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/pymodbus/client/base.py", line 177, in execute
return self.transaction.execute(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/pymodbus/transaction.py", line 168, in execute
response, last_exception = self._transact(
^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/pymodbus/transaction.py", line 313, in _transact
result = self._recv(response_length, full)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/pymodbus/transaction.py", line 343, in _recv
read_min = self.client.framer.recvPacket(min_size)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/pymodbus/framer/base.py", line 77, in recvPacket
return self.client.recv(size)
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/pymodbus/client/tcp.py", line 210, in recv
return self._handle_abrupt_socket_close(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/pymodbus/client/tcp.py", line 257, in _handle_abrupt_socket_close
raise ConnectionException(msg)
pymodbus.exceptions.ConnectionException: Modbus Error: [Connection] ModbusTcpClient(192.168.178.61:1502): Connection unexpectedly closed 2.1696090698242188e-05 seconds into read of 8 bytes without response from slave before it closed connection
2024-03-17 06:44:10.546 ERROR (SyncWorker_51) [pymodbus.logging] Connection to (192.168.178.61, 1502) failed: [Errno 111] Connection refused
2024-03-17 06:44:10.547 WARNING (SyncWorker_51) [custom_components.solaredge_modbus] not able to connect to 192.168.178.61:1502

My config

  • name: Inverter 1
    manufacturer: SolarEdge
    model: SE5000H-RWS00BNO4
    communicationMethod: ETHERNET
    cpuVersion: 4.17.46
    connectedOptimizers: 17

@jwindley
Copy link

I have the same issue. Any update on this please?

@K-Raymer
Copy link

Also getting the same issue. 30 second pole int.

@willembargeman
Copy link

Experienced the same kind of issue. Noticed that HA was not able to reach the SolarEdge inverter. In the log files I see the following.

ERROR (MainThread) [pymodbus.client.tcp] Connection to (10.27.11.9, 1502) failed: timed out

Created packet capture on the network and noticed that the inverter was not responding to the TCP SYN request. After some additional testing I found a interesting behaviour.

The inverter was drop all incoming requests from the same subnet. In my example, the inverter and HA are both placed in the subnet 10.27.11.0/24. (so 10.27.11.0-10.27.11.255). Even ping traffic is dropped.

With my laptop I was able to ping the inverter and also got a SYN ACK when using NMAP on port 1502. My laptop was in a different segment (10.27.10.0/24).

Workaround is by placing HA and the inverter in a different subnet or by using NAT (which is more complex).

@Doc-Jump
Copy link

Doc-Jump commented Nov 9, 2024

Same here, Integration suddenly stopped working, aswell SolarEdge Modbus and also SolarEdge Modbus Multi integration.
Tried to disable and enable the TCP Modbus setting in the inverter's interface, doesn't help.
I also think it must have to do something with the converter instead of the integration as the inverter can be reached over network but refuses connection on the Modbus-Port. Did anyone contact SolarEdge's support?

@Doc-Jump
Copy link

Doc-Jump commented Nov 13, 2024

Dear all,

Had contact with Solaredge support.
They remotely installed a newer firmware on the inverter. Since then it has been running smoothly again. Simply report it there with the reference to error code 111 and that no data can be accessed via the Modbus.

In my opinion, this issue could be closed, as it seems to be a Software Problem on the inverter.

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

No branches or pull requests

7 participants