lichtteil / local_luftdaten

Custom component for Home Assistant that integrates your (own) local Luftdaten sensor (air quality/particle sensor) without using the cloud.
MIT License
46 stars 19 forks source link

Platform error sensor.local_luftdaten - Exception importing custom_components.local_luftdaten.sensor #58

Closed derheinrich2019 closed 1 year ago

derheinrich2019 commented 1 year ago

Upgrade to HA 2023.6.0 and the configuration is now invalid. Is there a way to fix this?

sensor:

hudecitydave commented 1 year ago

Same here!

mattsches commented 1 year ago

Adding the traceback output:

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 "<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/local_luftdaten/sensor.py", line 61, in <module>
    @asyncio.coroutine
     ^^^^^^^^^^^^^^^^^
AttributeError: module 'asyncio' has no attribute 'coroutine'
mattsches commented 1 year ago

I found this answer on StackOverflow, so I just deleted the @asyncio.coroutine decorator in the line before

async def async_setup_platform(hass, config, async_add_entities, discovery_info=None):

and this seems to have solved the issue. Beware that I'm not a Python dev, and I don't actually know what I'm doing here :grin:

TheLordVader commented 1 year ago

Same here, waiting for new version :-)

ddmmcz commented 1 year ago

Also same error, after updating to 2023.6.0.

OrionVIII commented 1 year ago

Same here, updated to 2023.6.1. This issue seems to be caused by the use of Python 3.11 in HA now?

ddmmcz commented 1 year ago

I temporarily solved it by commenting #@asyncio.coroutine on line 61. I don't know if it's good, but it works.

hessel-a commented 1 year ago

It looks like the issue In the LIFX integration. https://github.com/home-assistant/core/issues/90297

saschaludwig commented 1 year ago

Same problem here

lichtteil commented 1 year ago

Sorry for the late response and the inconvenience! This issue is fixed in the newest release 2.3.0 ( https://github.com/lichtteil/local_luftdaten/releases/tag/2.3.0 ).