kamaradclimber / heishamon-homeassistant

An integration for heatpumps handled by heishamon
Apache License 2.0
42 stars 22 forks source link

Integration setup fails with 2024.1 #171

Closed dbpprt closed 8 months ago

dbpprt commented 8 months ago

The integration setup fails with the latest integration and home assistant version.

Sorry for the poor report, I'm on the go with now access to a computer and just reverted back to the previous version using a partial backup.

giedriuskilcauskas commented 8 months ago

getting the same

Logger: homeassistant.loader
Source: loader.py:842
First occurred: 23:32:01 (8 occurrences)
Last logged: 23:32:01

Unexpected exception importing platform custom_components.aquarea.select
Unexpected exception importing platform custom_components.aquarea.number
Unexpected exception importing platform custom_components.aquarea.climate
Unexpected exception importing platform custom_components.aquarea.water_heater
Unexpected exception importing platform custom_components.aquarea.update
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/loader.py", line 842, in get_platform
    cache[full_name] = self._import_platform(platform_name)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/loader.py", line 859, 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 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/aquarea/sensor.py", line 34, in <module>
    from .definitions import (
  File "/config/custom_components/aquarea/definitions.py", line 239, in <module>
    @dataclass
     ^^^^^^^^^
  File "/usr/local/lib/python3.11/dataclasses.py", line 1230, in dataclass
    return wrap(cls)
           ^^^^^^^^^
  File "/usr/local/lib/python3.11/dataclasses.py", line 1220, in wrap
    return _process_class(cls, init, repr, eq, order, unsafe_hash,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dataclasses.py", line 1027, in _process_class
    _init_fn(all_init_fields,
  File "/usr/local/lib/python3.11/dataclasses.py", line 545, in _init_fn
    raise TypeError(f'non-default argument {f.name!r} '
TypeError: non-default argument 'key' follows default argument
lolobar commented 8 months ago

Same Problem here with 2024.1.

sergey08 commented 8 months ago

Same here

help!

kanttti commented 8 months ago

Same.

This is related to the problem? https://developers.home-assistant.io/blog/2023/12/11/entity-description-changes/

And if understood correctly it shouldn't be a breaking change until 2025.1. So something wrong in HA as well?

Jannilein commented 8 months ago

Yes, it is lousy... Same here, need support. Bach to 23.12.3- all fine

giedriuskilcauskas commented 8 months ago

Not sure if it's best way to do it (probably, NOT), but I've replaced all @dataclass with @dataclass(frozen=True, kw_only=True) and it looks like working again

kamaradclimber commented 8 months ago

@giedriuskilcauskas this seems to be the only way to fix it if I want to avoid the code duplication proposed in https://github.com/home-assistant/core/issues/106617#issuecomment-1871979644. However, it makes the integration non-backward compatible with 2023.12 leading to a sub optimal uprgade path:

I'll propose a non backward compatible version first to solve the issue for people having already updated and see how to improve it.

giedriuskilcauskas commented 8 months ago

Maybe HA version restriction is not fully correct?

image
kamaradclimber commented 8 months ago

True, I always fall for this one. Anyway, I've published 1.4.6 that restore backward compatibility so it should fix this annoyance as well.

giedriuskilcauskas commented 8 months ago

True, I always fall for this one. Anyway, I've published 1.4.6 that restore backward compatibility so it should fix this annoyance as well.

Thanks for quick fixing, @kamaradclimber !