huawei_solar: [Bug]: Unable to connect via serial on 1.2.0b5 1.1.6 is working

Describe the issue

Upgrading to 1.2.0b5 cause connectivity issues over serial. Tried to complete remove and reinstall the integration, but then I’m unble to setup because huawei_solar.exceptions.ReadException: Failed to read register 43006 after 6 tries

added diagnostics file from 1.1.6

Bescribe your Huawei Solar Setup

Inverter Type: SUN2000-4.6KTL-L1 Inverter Firmware version: V200R001C00SPC125 SDongle present: no Power meter present: single phase Battery: LUNA2000 10kWh Battery Firmware version: V100R002C00SPC116

How do you connect to the inverter?

Over serial, with a serial-to-USB stick

Upload your Diagnostics File

{ “home_assistant”: { “installation_type”: “Home Assistant OS”, “version”: “2022.12.8”, “dev”: false, “hassio”: true, “virtualenv”: false, “python_version”: “3.10.7”, “docker”: true, “arch”: “aarch64”, “timezone”: “Europe/Brussels”, “os_name”: “Linux”, “os_version”: “5.15.80”, “supervisor”: “2022.12.1”, “host_os”: “Home Assistant OS 9.4”, “docker_version”: “20.10.19”, “chassis”: “embedded”, “run_as_root”: true }, “custom_components”: { “eufy_security”: { “version”: “2.10.0”, “requirements”: [ “websocket-client==1.1.0” ] }, “solcast_solar”: { “version”: “3.0.30”, “requirements”: [ “aiohttp>=3.6.2”, “datetime>=4.3”, “isodate>=0.6.0” ] }, “smartthinq_sensors”: { “version”: “0.27.1”, “requirements”: [ “pycountry>=20.7.3”, “xmltodict>=0.12.0”, “cchardet>=2.1.7” ] }, “huawei_solar”: { “version”: “1.1.6”, “requirements”: [ “huawei-solar==2.1.6” ] }, “nordpool”: { “version”: “0.0.9”, “requirements”: [ “nordpool>=0.2” ] }, “entsoe”: { “version”: “0.0.1”, “requirements”: [ “entsoe-py==0.5.8” ] }, “hacs”: { “version”: “1.29.0”, “requirements”: [ “aiogithubapi>=22.10.1” ] }, “skodaconnect”: { “version”: “v1.1.4”, “requirements”: [ “skodaconnect>=1.2.5”, “homeassistant>=2022.12.0” ] }, “webrtc”: { “version”: “v2.3.1”, “requirements”: [] }, “afvalbeheer”: { “version”: “5.0.10”, “requirements”: [ “rsa”, “pycryptodome” ] } }, “integration_manifest”: { “domain”: “huawei_solar”, “name”: “Huawei Solar”, “config_flow”: true, “documentation”: “https://www.home-assistant.io/integrations/huawei_solar”, “issue_tracker”: “https://github.com/wlcrs/huawei_solar/issues”, “requirements”: [ “huawei-solar==2.1.6” ], “codeowners”: [ “@wlcrs” ], “iot_class”: “local_polling”, “version”: “1.1.6”, “loggers”: [ “huawei_solar”, “pymodbus” ], “is_built_in”: false }, “data”: { “config_entry_data”: { “host”: null, “port”: “/dev/serial/by-id/usb-1a86_USB2.0-Ser_-if00-port0”, “slave_ids”: [ 1 ], “enable_parameter_configuration”: true, “username”: null, “password”: null }, “slave_0”: { “model_name”: “SUN2000-4.6KTL-L1”, “pv_string_count”: 2, “has_optimizers”: 0, “battery_1_type”: 2, “battery_2_type”: 0, “power_meter_type”: 0 }, “slave_0_data”: { “input_power”: [ 490, “W” ], “line_voltage_A_B”: [ 239.9, “V” ], “line_voltage_B_C”: [ 0.0, “V” ], “line_voltage_C_A”: [ 0.0, “V” ], “phase_A_voltage”: [ 241.1, “V” ], “phase_B_voltage”: [ 0.2, “V” ], “phase_C_voltage”: [ 0.0, “V” ], “phase_A_current”: [ 1.873, “A” ], “phase_B_current”: [ 0.0, “A” ], “phase_C_current”: [ 0.0, “A” ], “day_active_power_peak”: [ 5000, “W” ], “active_power”: [ 444, “W” ], “reactive_power”: [ -1, “VA” ], “power_factor”: [ 1.0, null ], “grid_frequency”: [ 49.98, “Hz” ], “efficiency”: [ 100.0, “%” ], “internal_temperature”: [ 34.2, “\u00b0C” ], “insulation_resistance”: [ 30.0, “MOhm” ], “device_status”: [ “On-grid”, null ], “fault_code”: [ 0, null ], “startup_time”: [ “2023-01-03T09:01:08+00:00”, null ], “shutdown_time”: [ null, null ], “accumulated_yield_energy”: [ 12169.44, “kWh” ], “daily_yield_energy”: [ 9.18, “kWh” ], “state_1”: [ [ “Grid-Connected”, “Grid-Connected normally” ], null ], “state_2”: [ [ “Unlocked”, “PV connected”, “DSP data collection” ], null ], “state_3”: [ [ “On-grid”, “Off-grid switch disabled” ], null ], “alarm_1”: [ [], null ], “alarm_2”: [ [], null ], “alarm_3”: [ [], null ], “pv_01_voltage”: [ 317.2, “V” ], “pv_01_current”: [ 0.81, “A” ], “pv_02_voltage”: [ 317.3, “V” ], “pv_02_current”: [ 0.81, “A” ], “grid_A_voltage”: [ 239.6, “V” ], “grid_B_voltage”: [ null, “V” ], “grid_C_voltage”: [ null, “V” ], “active_grid_A_current”: [ 1.31, “I” ], “active_grid_B_current”: [ null, “I” ], “active_grid_C_current”: [ null, “I” ], “power_meter_active_power”: [ 4, “W” ], “power_meter_reactive_power”: [ 315, “Var” ], “active_grid_power_factor”: [ 0.03, null ], “active_grid_frequency”: [ 49.97, “Hz” ], “grid_exported_energy”: [ 3707.79, “kWh” ], “grid_accumulated_energy”: [ 6288.2, “kWh” ], “grid_accumulated_reactive_power”: [ 58.52, “kVarh” ], “meter_type”: [ 0, null ], “active_grid_A_B_voltage”: [ null, “V” ], “active_grid_B_C_voltage”: [ null, “V” ], “active_grid_C_A_voltage”: [ null, “V” ], “active_grid_A_power”: [ null, “W” ], “active_grid_B_power”: [ null, “W” ], “active_grid_C_power”: [ null, “W” ], “storage_state_of_capacity”: [ 30.0, “%” ], “storage_running_status”: [ 2, null ], “storage_bus_voltage”: [ 439.2, “V” ], “storage_bus_current”: [ 0.0, “A” ], “storage_charge_discharge_power”: [ 46, “W” ], “storage_total_charge”: [ 3501.0, “kWh” ], “storage_total_discharge”: [ 3423.02, “kWh” ], “storage_current_day_charge_capacity”: [ 0.43, “kWh” ], “storage_current_day_discharge_capacity”: [ 7.58, “kWh” ] } } }

Upload your relevant debug logs

2023-01-03 17:20:10.469 WARNING (Recorder) [homeassistant.components.sensor.recorder] The unit of sensor.load_1m (None) can not be converted to the unit of previously compiled statistics ( ). Generation of long term statistics will be suppressed unless the unit changes back to   or a compatible unit. Go to https://my.home-assistant.io/redirect/developer_statistics to fix this
2023-01-03 17:20:10.473 INFO (Recorder) [homeassistant.components.sensor.recorder] Detected new cycle for sensor.energy_consumption_tarif_1_cost, last_reset set to 2023-01-03T16:16:04.453614+00:00 (old last_reset 2023-01-03T16:13:54.830668+00:00)
2023-01-03 17:20:10.474 INFO (Recorder) [homeassistant.components.sensor.recorder] Detected new cycle for sensor.energy_consumption_tarif_2_cost, last_reset set to 2023-01-03T16:16:04.454166+00:00 (old last_reset 2023-01-03T16:13:54.832073+00:00)
2023-01-03 17:20:10.474 INFO (Recorder) [homeassistant.components.sensor.recorder] Detected new cycle for sensor.energy_production_tarif_1_compensation, last_reset set to 2023-01-03T16:16:04.454431+00:00 (old last_reset 2023-01-03T16:13:54.833265+00:00)
2023-01-03 17:20:10.474 INFO (Recorder) [homeassistant.components.sensor.recorder] Detected new cycle for sensor.energy_production_tarif_2_compensation, last_reset set to 2023-01-03T16:16:04.454676+00:00 (old last_reset 2023-01-03T16:13:54.835335+00:00)
2023-01-03 17:20:10.474 INFO (Recorder) [homeassistant.components.sensor.recorder] Detected new cycle for sensor.gas_consumption_cost, last_reset set to 2023-01-03T16:16:04.454919+00:00 (old last_reset 2023-01-03T16:13:54.836662+00:00)
2023-01-03 17:20:24.466 DEBUG (MainThread) [pymodbus.client.serial] Starting serial connection
2023-01-03 17:20:24.468 DEBUG (MainThread) [pymodbus.client.base] Client connected to modbus server
2023-01-03 17:20:24.468 INFO (MainThread) [pymodbus.client.serial] Serial connected.
2023-01-03 17:20:24.468 INFO (MainThread) [pymodbus.client.serial] Connected to /dev/serial/by-id/usb-1a86_USB2.0-Ser_-if00-port0
2023-01-03 17:20:24.469 DEBUG (MainThread) [huawei_solar.huawei_solar] Reading register 43006
2023-01-03 17:20:24.469 DEBUG (MainThread) [pymodbus.client.base] send: 0x1 0x3 0xa7 0xfe 0x0 0x1 0xc6 0x8e
2023-01-03 17:20:24.469 DEBUG (MainThread) [pymodbus.transaction] Adding transaction 1
2023-01-03 17:20:27.470 INFO (MainThread) [backoff] Backing off _do_read(...) for 1.0s (asyncio.exceptions.TimeoutError)
2023-01-03 17:20:27.471 DEBUG (MainThread) [huawei_solar.huawei_solar] Backing off reading for 1.0 seconds after 1 tries
2023-01-03 17:20:28.472 DEBUG (MainThread) [pymodbus.client.base] send: 0x1 0x3 0xa7 0xfe 0x0 0x1 0xc6 0x8e
2023-01-03 17:20:28.473 DEBUG (MainThread) [pymodbus.transaction] Adding transaction 1
2023-01-03 17:20:31.475 INFO (MainThread) [backoff] Backing off _do_read(...) for 2.0s (asyncio.exceptions.TimeoutError)
2023-01-03 17:20:31.475 DEBUG (MainThread) [huawei_solar.huawei_solar] Backing off reading for 2.0 seconds after 2 tries
2023-01-03 17:20:33.475 DEBUG (MainThread) [pymodbus.client.base] send: 0x1 0x3 0xa7 0xfe 0x0 0x1 0xc6 0x8e
2023-01-03 17:20:33.476 DEBUG (MainThread) [pymodbus.transaction] Adding transaction 1
2023-01-03 17:20:36.478 INFO (MainThread) [backoff] Backing off _do_read(...) for 4.0s (asyncio.exceptions.TimeoutError)
2023-01-03 17:20:36.478 DEBUG (MainThread) [huawei_solar.huawei_solar] Backing off reading for 4.0 seconds after 3 tries
2023-01-03 17:20:40.480 DEBUG (MainThread) [pymodbus.client.base] send: 0x1 0x3 0xa7 0xfe 0x0 0x1 0xc6 0x8e
2023-01-03 17:20:40.481 DEBUG (MainThread) [pymodbus.transaction] Adding transaction 1
2023-01-03 17:20:43.484 INFO (MainThread) [backoff] Backing off _do_read(...) for 8.0s (asyncio.exceptions.TimeoutError)
2023-01-03 17:20:43.484 DEBUG (MainThread) [huawei_solar.huawei_solar] Backing off reading for 8.0 seconds after 4 tries
2023-01-03 17:20:51.486 DEBUG (MainThread) [pymodbus.client.base] send: 0x1 0x3 0xa7 0xfe 0x0 0x1 0xc6 0x8e
2023-01-03 17:20:51.488 DEBUG (MainThread) [pymodbus.transaction] Adding transaction 1
2023-01-03 17:20:54.490 INFO (MainThread) [backoff] Backing off _do_read(...) for 16.0s (asyncio.exceptions.TimeoutError)
2023-01-03 17:20:54.490 DEBUG (MainThread) [huawei_solar.huawei_solar] Backing off reading for 16.0 seconds after 5 tries
2023-01-03 17:21:03.523 INFO (SyncWorker_3) [roombapy.remote_client] Connecting to 192.168.0.158, attempt 1 of 3
2023-01-03 17:21:06.589 ERROR (SyncWorker_3) [roombapy.remote_client] Can't connect to 192.168.0.158, error: [Errno 113] Host is unreachable
2023-01-03 17:21:06.590 INFO (SyncWorker_3) [roombapy.remote_client] Connecting to 192.168.0.158, attempt 2 of 3
2023-01-03 17:21:09.661 ERROR (SyncWorker_3) [roombapy.remote_client] Can't connect to 192.168.0.158, error: [Errno 113] Host is unreachable
2023-01-03 17:21:09.662 INFO (SyncWorker_3) [roombapy.remote_client] Connecting to 192.168.0.158, attempt 3 of 3
2023-01-03 17:21:10.492 DEBUG (MainThread) [pymodbus.client.base] send: 0x1 0x3 0xa7 0xfe 0x0 0x1 0xc6 0x8e
2023-01-03 17:21:10.493 DEBUG (MainThread) [pymodbus.transaction] Adding transaction 1
2023-01-03 17:21:12.733 ERROR (SyncWorker_3) [roombapy.remote_client] Can't connect to 192.168.0.158, error: [Errno 113] Host is unreachable
2023-01-03 17:21:12.734 ERROR (SyncWorker_3) [roombapy.remote_client] Unable to connect to 192.168.0.158
2023-01-03 17:21:13.495 ERROR (MainThread) [backoff] Giving up _do_read(...) after 6 tries (asyncio.exceptions.TimeoutError)
2023-01-03 17:21:13.498 ERROR (MainThread) [huawei_solar.huawei_solar] Aborting client creation due to error.
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/asyncio/tasks.py", line 456, in wait_for
    return fut.result()
asyncio.exceptions.CancelledError

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

Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/backoff/_async.py", line 151, in retry
    ret = await target(*args, **kwargs)
  File "/usr/local/lib/python3.10/site-packages/huawei_solar/huawei_solar.py", line 276, in _do_read
    response = await self._client.protocol.read_holding_registers(
  File "/usr/local/lib/python3.10/site-packages/pymodbus/client/base.py", line 295, in execute
    resp = await asyncio.wait_for(req, timeout=self.params.timeout)
  File "/usr/local/lib/python3.10/asyncio/tasks.py", line 458, in wait_for
    raise exceptions.TimeoutError() from exc
asyncio.exceptions.TimeoutError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/huawei_solar/huawei_solar.py", line 150, in create_rtu
    await huawei_solar._initialize()
  File "/usr/local/lib/python3.10/site-packages/huawei_solar/huawei_solar.py", line 85, in _initialize
    self.time_zone = (await self.get(rn.TIME_ZONE)).value
  File "/usr/local/lib/python3.10/site-packages/huawei_solar/huawei_solar.py", line 194, in get
    return (await self.get_multiple([name], slave))[0]
  File "/usr/local/lib/python3.10/site-packages/huawei_solar/huawei_solar.py", line 229, in get_multiple
    response = await self._read_registers(registers[0].register, total_length, slave)
  File "/usr/local/lib/python3.10/site-packages/huawei_solar/huawei_solar.py", line 309, in _read_registers
    result = await _do_read()
  File "/usr/local/lib/python3.10/site-packages/backoff/_async.py", line 159, in retry
    await _call_handlers(on_giveup, **details, exception=e)
  File "/usr/local/lib/python3.10/site-packages/backoff/_async.py", line 37, in _call_handlers
    await handler(details)
  File "/usr/local/lib/python3.10/site-packages/backoff/_async.py", line 16, in f
    return coro_or_func(*args, **kwargs)
  File "/usr/local/lib/python3.10/site-packages/huawei_solar/huawei_solar.py", line 255, 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:

  • The problem is still present in the latest release of this integration.
  • I did not find an existing issue describing this problem.
  • I did upload the diagnostics-file that I could retrieve from the ‘Devices & Services Page’
  • I increased the logging configuration, restarted HA, and have copied all relevant log lines from the ‘Full Logs’ into the textarea.

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Reactions: 1
  • Comments: 15 (7 by maintainers)

Commits related to this issue

Most upvoted comments

Version 1.2.1 does indeed fix this issue. Thx for the quick support !