wlcrs / huawei_solar

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

[Bug]: Integration stopped working #476

Closed taert79 closed 1 year ago

taert79 commented 1 year ago

Describe the issue

My integration has stopped working as of last Saturday. Has been working perfectly before that for months. No changes to my setup besides the usual upgrades.

Bescribe your Huawei Solar Setup

Inverter Type: SUN2000-2KTL_L1 Inverter Firmware version: Unknown SDongle present: yes Power meter present: single phase Battery: None Battery Firmware version: N/A

How do you connect to the inverter?

Via the SDongle, wireless connection

Upload your Diagnostics File

Drag & Drop your Diagnostics File here.

Upload your relevant debug logs

Logger: huawei_solar.huawei_solar
Source: /usr/local/lib/python3.11/site-packages/huawei_solar/huawei_solar.py:184
First occurred: 12:05:35 (71 occurrences)
Last logged: 13:45:53

Aborting client creation due to error.
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/asyncio/tasks.py", line 490, in wait_for
    return fut.result()
           ^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/asyncio/locks.py", line 213, in wait
    await fut
asyncio.exceptions.CancelledError

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/huawei_solar/huawei_solar.py", line 178, in create
    await huawei_solar._initialize()
  File "/usr/local/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 "/usr/local/lib/python3.11/site-packages/huawei_solar/huawei_solar.py", line 241, in get
    return (await self.get_multiple([name], slave))[0]
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/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 "/usr/local/lib/python3.11/site-packages/huawei_solar/huawei_solar.py", line 396, in _read_registers
    async with self._communication_lock():
  File "/usr/local/lib/python3.11/contextlib.py", line 204, in __aenter__
    return await anext(self.gen)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/huawei_solar/huawei_solar.py", line 145, in _communication_lock
    raise err
  File "/usr/local/lib/python3.11/site-packages/huawei_solar/huawei_solar.py", line 141, in _communication_lock
    await asyncio.wait_for(self._client.connected_event.wait(), WAIT_FOR_CONNECTION_TIMEOUT)
  File "/usr/local/lib/python3.11/asyncio/tasks.py", line 492, in wait_for
    raise exceptions.TimeoutError() from exc
TimeoutError

Logger: huawei_solar.huawei_solar
Source: /usr/local/lib/python3.11/site-packages/huawei_solar/huawei_solar.py:143
First occurred: 12:05:35 (71 occurrences)
Last logged: 13:45:53

Timeout while waiting for connection. Reconnecting...
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/asyncio/tasks.py", line 490, in wait_for
    return fut.result()
           ^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/asyncio/locks.py", line 213, in wait
    await fut
asyncio.exceptions.CancelledError

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/huawei_solar/huawei_solar.py", line 141, in _communication_lock
    await asyncio.wait_for(self._client.connected_event.wait(), WAIT_FOR_CONNECTION_TIMEOUT)
  File "/usr/local/lib/python3.11/asyncio/tasks.py", line 492, in wait_for
    raise exceptions.TimeoutError() from exc
TimeoutError

Please confirm the following:

wlcrs commented 1 year ago

Please upload the diagnostics file and a debug log. Without it I cannot diagnose the issue.

What is the version of your inverter firmware? Did it maybe update itself in the last few days?

taert79 commented 1 year ago

Hi @wlcrs, FW version is v200r001c00spc117. If needed I can upgrade it to a higher revision. Log is attached. home-assistant_2023-09-18T13-57-00.589Z.log

wlcrs commented 1 year ago

The logs show that the connection to 192.168.0.114 fails:

2023-09-18 15:09:54.926 WARNING (MainThread) [pymodbus.logging] Failed to connect [Errno 113] Connect call failed ('192.168.0.114', 502)
2023-09-18 15:11:15.374 WARNING (MainThread) [pymodbus.logging] Failed to connect [Errno 113] Connect call failed ('192.168.0.114', 502)

As this is a connectivity problem and not a bug in the integration (which tries really hard to connect to that IP address!), there is nothing that I can do to help you. Check the IP of your inverter and make sure that it doesn't change in the future.