huawei_solar: Exception importing component in Home Assistant 2023.6

I got the following exception, when I try to use the component

2023-06-09 05:18:38.640 ERROR (MainThread) [homeassistant.loader] Unexpected exception importing platform custom_components.huawei_solar.sensor
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/loader.py", line 833, in get_platform
    cache[full_name] = self._import_platform(platform_name)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/loader.py", line 850, in _import_platform
    return importlib.import_module(f"{self.pkg_path}.{platform_name}")
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "", line 1206, in _gcd_import
  File "", line 1178, in _find_and_load
  File "", line 1149, in _find_and_load_unlocked
  File "", line 690, in _load_unlocked
  File "", line 940, in exec_module
  File "", line 241, in _call_with_frames_removed
  File "/config/custom_components/huawei_solar/sensor.py", line 26, in 
    from huawei_solar import AsyncHuaweiSolar, ConnectionException, ReadException
  File "/usr/local/lib/python3.11/site-packages/huawei_solar/__init__.py", line 6, in 
    from .huawei_solar import *  # noqa: F401 F403
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/huawei_solar/huawei_solar.py", line 15, in 
    from pymodbus.client.asynchronous.async_io import init_tcp_client
  File "/usr/local/lib/python3.11/site-packages/pymodbus/client/asynchronous/async_io/__init__.py", line 228, in 
    class ReconnectingAsyncioModbusTcpClient(object):
  File "/usr/local/lib/python3.11/site-packages/pymodbus/client/asynchronous/async_io/__init__.py", line 262, in ReconnectingAsyncioModbusTcpClient
    @asyncio.coroutine
     ^^^^^^^^^^^^^^^^^
AttributeError: module 'asyncio' has no attribute 'coroutine'

Home Assistant 2023.6.1 Supervisor 2023.06.1 Frontend 20230607.0 - latest

About this issue

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

Most upvoted comments

@agmuz Ja przełożyłem na https://github.com/wlcrs/huawei_solar/ i śmiga aż miło i to bez grzebania w konfigu.

You can upgrade the py package to a more recent version (manifest update)

{ “domain”: “huawei_solar”, “name”: “huawei_solar”, “documentation”: “https://github.com/Emilv2/huawei_solar”, “dependencies”: [], “codeowners”: [“Emilv2”], “requirements”: [“huawei-solar>=2.0.0,<=2.2.6”], “version”: “1.2.4” }

  • change the sensor.py file to use the new way to instantiate the class

      inverter = await AsyncHuaweiSolar.create(
          host=config[CONF_HOST], port=config[CONF_PORT], slave=config[CONF_SLAVE]
      )
    

It works back on my HA after those changes