huawei_solar: [Bug]: Integration crashes after updating HA to 2023.7

Describe the issue

Integration crashes after updating HA to 2023.7 Tested releases 1.2.5 and 1.2.6b7

Bescribe your Huawei Solar Setup

Inverter Type: SUN2000-8KTL-M101074300-002 Inverter Firmware version: SDongle present: yes Power meter present: three phase Battery: LUNA2000 10kWh Battery Firmware version:

How do you connect to the inverter?

Via the SDongle, wireless connection

Upload your Diagnostics File

Logger: homeassistant.setup Source: custom_components/huawei_solar/init.py:25 Integration: Huawei Solar First occurred: 22:46:16 (1 occurrences) Last logged: 22:46:16

Setup failed for custom integration huawei_solar: Unable to import component: cannot import name ‘make_byte_string’ from ‘pymodbus.utilities’ (/usr/local/lib/python3.11/site-packages/pymodbus/utilities.py) Traceback (most recent call last): File “/usr/src/homeassistant/homeassistant/setup.py”, line 215, in _async_setup_component component = integration.get_component() ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File “/usr/src/homeassistant/homeassistant/loader.py”, line 813, in get_component ComponentProtocol, importlib.import_module(self.pkg_path) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File “/usr/local/lib/python3.11/importlib/init.py”, line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File “<frozen importlib._bootstrap>”, line 1204, in _gcd_import File “<frozen importlib._bootstrap>”, line 1176, in _find_and_load File “<frozen importlib._bootstrap>”, line 1147, in _find_and_load_unlocked File “<frozen importlib._bootstrap>”, line 690, in _load_unlocked File “<frozen importlib._bootstrap_external>”, line 940, in exec_module File “<frozen importlib._bootstrap>”, line 241, in _call_with_frames_removed File “/config/custom_components/huawei_solar/init.py”, line 25, in <module> from huawei_solar import HuaweiSolarBridge, HuaweiSolarException, InvalidCredentials File “/usr/local/lib/python3.11/site-packages/huawei_solar/init.py”, line 6, in <module> from .bridge import HuaweiSolarBridge # noqa ^^^^^^^^^^^^^^^^^^^ home-assistant_huawei_solar_2023-07-06T07-38-36.214Z.log ^^^^^^^^^^^^^^^^^^ File “/usr/local/lib/python3.11/site-packages/huawei_solar/bridge.py”, line 16, in <module> from .huawei_solar import DEFAULT_BAUDRATE, DEFAULT_SLAVE, DEFAULT_TCP_PORT, AsyncHuaweiSolar, Result File “/usr/local/lib/python3.11/site-packages/huawei_solar/huawei_solar.py”, line 17, in <module> from pymodbus.payload import BinaryPayloadBuilder, BinaryPayloadDecoder File “/usr/local/lib/python3.11/site-packages/pymodbus/payload.py”, line 18, in <module> from pymodbus.utilities import ( ImportError: cannot import name ‘make_byte_string’ from ‘pymodbus.utilities’ (/usr/local/lib/python3.11/site-packages/pymodbus/utilities.py)

Upload your relevant debug logs

2023-07-05 22:44:35.721 WARNING (SyncWorker_2) [homeassistant.loader] We found a custom integration huawei_solar which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2023-07-05 22:46:16.628 ERROR (MainThread) [homeassistant.setup] Setup failed for custom integration huawei_solar: Unable to import component: cannot import name 'make_byte_string' from 'pymodbus.utilities' (/usr/local/lib/python3.11/site-packages/pymodbus/utilities.py)
File "/config/custom_components/huawei_solar/__init__.py", line 25, in <module>
from huawei_solar import HuaweiSolarBridge, HuaweiSolarException, InvalidCredentials
File "/usr/local/lib/python3.11/site-packages/huawei_solar/__init__.py", line 6, in <module>
File "/usr/local/lib/python3.11/site-packages/huawei_solar/bridge.py", line 16, in <module>
from .huawei_solar import DEFAULT_BAUDRATE, DEFAULT_SLAVE, DEFAULT_TCP_PORT, AsyncHuaweiSolar, Result
File "/usr/local/lib/python3.11/site-packages/huawei_solar/huawei_solar.py", line 17, in <module>

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 did upload the relevant debug logs (via ‘Enable Debug Logging’-feature or by manually configuring HA logging)

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Reactions: 6
  • Comments: 19 (4 by maintainers)

Most upvoted comments

The 1.2.6 beta 8 seems to be working as well as my core modbus!

@boku78 Please enable diagnostics and create a new issue with the logs you gathered once the problem shows itself.

Unfortunately it seems to crash from time to time, and i have to restart HA for the Huawei solar integration to work again!

Thanks for diagnosis. I use indeed the core modbus integration for my Pluggit ventilation system. After disabling this your integration is working fine. I’ll wait for your update to reintegrate vents.

The core Modbus integration has a dependency on a newer version of pymodbus: https://github.com/home-assistant/core/blob/de24860c87b2042fdba548367d6d70dc5f9a38d0/homeassistant/components/modbus/manifest.json#L9 .

I’ll need to upgrade this library to match the same pymodbus version. This requires some testing as upgrades have caused bugs in the past.