wlcrs / huawei_solar

Home Assistant integration for Huawei Solar inverters via Modbus
GNU Affero General Public License v3.0
560 stars 90 forks source link

[Bug]: Modbus client is not connected to the inverter #550

Closed oglok closed 11 months ago

oglok commented 12 months ago

Describe the issue

With latest Home Assistant version extension is not connecting to the inverter:

Home Assistant 2023.10.3 Frontend 20231005.0 - latest

Bescribe your Huawei Solar Setup

Inverter Type: Inverter Firmware version: SDongle present: no Power meter present: single phase

How do you connect to the inverter?

Via the SUN2000-<serial_no> WiFi

Upload your Diagnostics File

I cannot get the integration done from scratch. I don't have the integration configured to get logs from any device. However, my home assistant has the 192.168.200.100 address and the inverter .1 is reachable.

Upload your relevant debug logs

2023-12-01 18:32:40.249 ERROR (MainThread) [huawei_solar.huawei_solar] Aborting client creation due to error.
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/backoff/_async.py", line 151, in retry
    ret = await target(*args, **kwargs)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/backoff/_async.py", line 151, in retry
    ret = await target(*args, **kwargs)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/deps/lib/python3.11/site-packages/huawei_solar/huawei_solar.py", line 349, in _do_read
    raise ConnectionInterruptedException(message)
huawei_solar.exceptions.ConnectionInterruptedException: Modbus client is not connected to the inverter.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/config/deps/lib/python3.11/site-packages/huawei_solar/huawei_solar.py", line 178, in create
    await huawei_solar._initialize()
  File "/config/deps/lib/python3.11/site-packages/huawei_solar/huawei_solar.py", line 107, in _initialize
    self.time_zone = (await self.get(rn.TIME_ZONE)).value
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/deps/lib/python3.11/site-packages/huawei_solar/huawei_solar.py", line 241, in get
    return (await self.get_multiple([name], slave))[0]
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/deps/lib/python3.11/site-packages/huawei_solar/huawei_solar.py", line 276, in get_multiple
    response = await self._read_registers(registers[0].register, total_length, slave)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/deps/lib/python3.11/site-packages/huawei_solar/huawei_solar.py", line 398, in _read_registers
    return await _do_read()
           ^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/backoff/_async.py", line 159, in retry
    await _call_handlers(on_giveup, **details, exception=e)
  File "/usr/local/lib/python3.11/site-packages/backoff/_async.py", line 37, in _call_handlers
    await handler(details)
  File "/usr/local/lib/python3.11/site-packages/backoff/_async.py", line 16, in f
    return coro_or_func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/deps/lib/python3.11/site-packages/huawei_solar/huawei_solar.py", line 327, in backoff_giveup
    raise ReadException(f"Failed to read register {register} after {details['tries']} tries")
huawei_solar.exceptions.ReadException: Failed to read register 43006 after 6 tries

Please confirm the following:

artur90226 commented 11 months ago

Plus. Me too.

wlcrs commented 11 months ago

Please do not use the issue tracker for connectivity problems.

oglok commented 11 months ago

Sorry, but this issue is not a connectivity problem. There is ping between HA and the inverter.

usch72 commented 10 months ago

Hi I'm facing the same issue as you @oglok and it seems more complex than a connectivity issue IMHO. I tried all network/port combinations and had these connectivity issues: Failed to connect [Errno 111] Connect call failed ('192.168.200.1', 502) Failed to connect [Errno 111] Connect call failed ('192.168.2.115', 6607) Failed to connect [Errno 111] Connect call failed ('192.168.2.131', 6607) I posted my issue on https://community.home-assistant.io/t/integration-solar-inverter-huawei-2000l/132350/2805?u=usch72 and was finally able to complete the integration while I was trying to debug what could be causing the issue. I installed tcpdump as explained here. I started tcpdump inside the homeassistant docker listening on dst host 192.168.200.1 and with tcpdump running I was able to complete the integration with an installed PW dialogue coming up that wasn't shown in previous attempts. I have no clue which difference it makes to run tcpdump in the container during installation but hope this info is useful for you as well. Also FYI @wlcrs

Thanks for the great work - Ulrich

lakatusch commented 9 months ago

hi there, got the same issue since yesterday 1pm. In the middle of the day the log shows :

024-02-19 13:37:33.064 ERROR (MainThread) [huawei_solar.huawei_solar] Modbus client is not connected to the inverter.
NoneType: None
2024-02-19 13:37:33.065 INFO (MainThread) [backoff] Backing off _do_read(...) for 1.0s (huawei_solar.exceptions.ConnectionInterruptedException: Modbus client is not connected to the inverter.)
2024-02-19 13:37:33.928 ERROR (MainThread) [tibber.home] Could not find consumption data.
2024-02-19 13:37:34.075 ERROR (MainThread) [huawei_solar.huawei_solar] Modbus client is not connected to the inverter.
NoneType: None
2024-02-19 13:37:34.076 INFO (MainThread) [backoff] Backing off _do_read(...) for 2.0s (huawei_solar.exceptions.ConnectionInterruptedException: Modbus client is not connected to the inverter.)
2024-02-19 13:37:36.077 ERROR (MainThread) [huawei_solar.huawei_solar] Modbus client is not connected to the inverter.
NoneType: None
2024-02-19 13:37:36.077 INFO (MainThread) [backoff] Backing off _do_read(...) for 4.0s (huawei_solar.exceptions.ConnectionInterruptedException: Modbus client is not connected to the inverter.)
2024-02-19 13:37:40.079 ERROR (MainThread) [huawei_solar.huawei_solar] Modbus client is not connected to the inverter.
NoneType: None
2024-02-19 13:37:40.079 INFO (MainThread) [backoff] Backing off _do_read(...) for 8.0s (huawei_solar.exceptions.ConnectionInterruptedException: Modbus client is not connected to the inverter.)
2024-02-19 13:37:48.081 ERROR (MainThread) [huawei_solar.huawei_solar] Modbus client is not connected to the inverter.
NoneType: None
2024-02-19 13:37:48.082 INFO (MainThread) [backoff] Backing off _do_read(...) for 16.0s (huawei_solar.exceptions.ConnectionInterruptedException: Modbus client is not connected to the inverter.)
2024-02-19 13:38:02.170 WARNING (MainThread) [homeassistant.components.device_tracker] Setup of device_tracker platform cupra_we_connect is taking over 10 seconds.
2024-02-19 13:38:04.085 ERROR (MainThread) [huawei_solar.huawei_solar] Modbus client is not connected to the inverter.
NoneType: None
2024-02-19 13:38:04.086 ERROR (MainThread) [backoff] Giving up _do_read(...) after 6 tries (huawei_solar.exceptions.ConnectionInterruptedException: Modbus client is not connected to the inverter.)
2024-02-19 13:38:04.086 ERROR (MainThread) [huawei_solar.huawei_solar] Aborting client creation due to error.
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/backoff/_async.py", line 151, in retry
    ret = await target(*args, **kwargs)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/backoff/_async.py", line 151, in retry
    ret = await target(*args, **kwargs)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/huawei_solar/huawei_solar.py", line 349, in _do_read
    raise ConnectionInterruptedException(message)
huawei_solar.exceptions.ConnectionInterruptedException: Modbus client is not connected to the inverter.

How does i fix this issue?

Thanks a lot

regards Daniel

josejn commented 8 months ago

Same problem here... Working like a charm for many weeks until today. Home Assistant says (huawei_solar.exceptions.ConnectionInterruptedException: Modbus client is not connected to the inverter.) But the ew11 is working perfectly and publishing data through the the mqtt queue.

Edit: Rebooting the ew11 module fixed the problem :/

lakatusch commented 8 months ago

wait an hour and than do a SYSTEM reboot of HA... this work for me...