hasl-sensor / integration

Swedish Public Transport Sensor (HASL). Formerly named HomeAssistant SL Sensor
https://hasl.sorlov.com
Apache License 2.0
36 stars 8 forks source link

Setup fails with Home Assistant 2023.6.0 #56

Closed jthun closed 1 year ago

jthun commented 1 year ago

Hi,

The HASL integration setup fails after upgrading to HA 2023.6.0. Worked fine with HA 2023.5.

Log output:

Logger: homeassistant.loader
Source: custom_components/hasl3/__init__.py:41
Integration: Svensk Kollektivtrafikssensor (HASL) ([documentation](https://hasl.sorlov.com/), [issues](https://github.com/hasl-sensor/integration/issues))
First occurred: 12:11:11 (1 occurrences)
Last logged: 12:11:11

Unexpected exception importing component custom_components.hasl3
Traceback (most recent call last):
  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 1206, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1178, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1149, 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/hasl3/__init__.py", line 41, in <module>
    @asyncio.coroutine
     ^^^^^^^^^^^^^^^^^
AttributeError: module 'asyncio' has no attribute 'coroutine'

Maybe related to Python 3.11?

EDIT: Commenting out line 41 (@asyncio.coroutine) in hasl3/__init__.py makes it work just fine again.

morlic commented 1 year ago

it is related to Python 3.11, yes:

Removed the @asyncio.coroutine() decorator enabling legacy generator-based coroutines to be compatible with async / await code. The function has been deprecated since Python 3.8 and the removal was initially scheduled for Python 3.10. Use async def instead. (Contributed by Illia Volochii in bpo-43216.)

systemcrash commented 1 year ago

Also just ran into this.

DSorlov commented 1 year ago

Fixed in 3.1.1 pushed just now. Thanks @morlic.