hass-variables icon indicating copy to clipboard operation
hass-variables copied to clipboard

Breaking change in latest HA: aionotify not compatible with python 3.11

Open Zynth-dev opened this issue 1 year ago • 1 comments

Latest HA upgrades to python 3.11 which is incompatible with aionotify. Another issue with the same rootcause that occurred (for reference) is this: https://github.com/home-assistant/core/issues/94215

Error: 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 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/variable/__init__.py", line 111, in <module> class Variable(RestoreEntity): File "/config/custom_components/variable/__init__.py", line 158, in Variable @asyncio.coroutine ^^^^^^^^^^^^^^^^^ AttributeError: module 'asyncio' has no attribute 'coroutine'

Unfortunatey I don't have the skill to fix this. I have removed the "@asyncio.coroutine" lines, and replaced them with a "async def", but that does not solve the issue. It leads to this, which I don't know how to solve. File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed File "/config/custom_components/variable/__init__.py", line 100 yield from asyncio.wait(tasks) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ SyntaxError: 'yield from' inside async function

Zynth-dev avatar Jun 18 '23 11:06 Zynth-dev

Update: Solved by moving to the "improved" version of variables: https://github.com/Wibias/hass-variables

Only delta in your *.yaml apparently is to update "variable.variablename" to "sensor.variablename". (Don't update "variable.set_variable", just leave that as is!) It worked for me.

Zynth-dev avatar Jun 18 '23 13:06 Zynth-dev