midea_ac_lan icon indicating copy to clipboard operation
midea_ac_lan copied to clipboard

Depreciated constant in HA 2025.1.0 breaks integration

Open johnwilson1969 opened this issue 10 months ago • 12 comments

HA core version

2025.1.0

Intergration version

0.3.22

Device type and model

Dehumidifier

Used App

Home Assistant

The description of problem

I have the same issue covered under the umbrella of "unable to start after update to 2025.1.0" but a different error message:

Setup failed for custom integration 'midea_ac_lan': Unable to import component: cannot import name 'TIME_DAYS' from 'homeassistant.const' (/usr/src/homeassistant/homeassistant/const.py)

This seems to be due to TIME_DAYS being depreciated - notes in the source code says:

"""Deprecated: please use UnitOfTime.DAYS."""

EDIT: These and possibly others are all used in the integration and have been decreciated to new constants

TIME_DAYS
TIME_HOURS
TIME_MINUTES
TIME_SECONDS

EDIT 2: Seems like all have been updated to new values with the exception of PERCENTAGE

The logs

Logger: homeassistant.setup Source: setup.py:334 First occurred: 5:40:21 PM (1 occurrences) Last logged: 5:40:21 PM

Setup failed for custom integration 'midea_ac_lan': Unable to import component: cannot import name 'TIME_DAYS' from 'homeassistant.const' (/usr/src/homeassistant/homeassistant/const.py) Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/loader.py", line 1015, in async_get_component comp = await self.hass.async_add_import_executor_job( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ self._get_component, True ^^^^^^^^^^^^^^^^^^^^^^^^^ ) ^ File "/usr/local/lib/python3.13/concurrent/futures/thread.py", line 59, in run result = self.fn(*self.args, **self.kwargs) File "/usr/src/homeassistant/homeassistant/loader.py", line 1075, in _get_component ComponentProtocol, importlib.import_module(self.pkg_path) ~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/util/loop.py", line 200, in protected_loop_func return func(*args, **kwargs) File "/usr/local/lib/python3.13/importlib/init.py", line 88, in import_module return _bootstrap._gcd_import(name[level:], package, level) ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "", line 1387, in _gcd_import File "", line 1360, in _find_and_load File "", line 1331, in _find_and_load_unlocked File "", line 935, in _load_unlocked File "", line 1026, in exec_module File "", line 488, in _call_with_frames_removed File "/config/custom_components/midea_ac_lan/init.py", line 17, in from .midea_devices import MIDEA_DEVICES File "/config/custom_components/midea_ac_lan/midea_devices.py", line 1, in from homeassistant.const import ( ...<12 lines>... ) ImportError: cannot import name 'TIME_DAYS' from 'homeassistant.const' (/usr/src/homeassistant/homeassistant/const.py)

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/setup.py", line 334, in _async_setup_component component = await integration.async_get_component() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/loader.py", line 1035, in async_get_component self._component_future.result() ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^ File "/usr/src/homeassistant/homeassistant/loader.py", line 1027, in async_get_component comp = self._get_component() File "/usr/src/homeassistant/homeassistant/loader.py", line 1075, in _get_component ComponentProtocol, importlib.import_module(self.pkg_path) ~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/util/loop.py", line 200, in protected_loop_func return func(*args, **kwargs) File "/usr/local/lib/python3.13/importlib/init.py", line 88, in import_module return _bootstrap._gcd_import(name[level:], package, level) ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "", line 1387, in _gcd_import File "", line 1360, in _find_and_load File "", line 1331, in _find_and_load_unlocked File "", line 935, in _load_unlocked File "", line 1026, in exec_module File "", line 488, in _call_with_frames_removed File "/config/custom_components/midea_ac_lan/init.py", line 17, in from .midea_devices import MIDEA_DEVICES File "/config/custom_components/midea_ac_lan/midea_devices.py", line 1, in from homeassistant.const import ( ...<12 lines>... ) ImportError: cannot import name 'TIME_DAYS' from 'homeassistant.const' (/usr/src/homeassistant/homeassistant/const.py)

johnwilson1969 avatar Jan 03 '25 22:01 johnwilson1969

I'm having the same here. Will be waiting for a fix. Thanks for reporting.

pauloon avatar Jan 04 '25 01:01 pauloon

我这里也遇到了同样的问题。请大佬修复。 谢谢。

fangming828 avatar Jan 04 '25 04:01 fangming828

Same issue had to downgrade HA core

jesterod avatar Jan 04 '25 07:01 jesterod

Just submitted a fix PR, you can also replace all deprecated constants by yourself. Changes in the PR above.

vergil-zhao avatar Jan 04 '25 07:01 vergil-zhao

Your PR works like a charm, thanks :)

leonhuhn avatar Jan 04 '25 09:01 leonhuhn

Same, waiting for this update to go live

pcmike avatar Jan 04 '25 14:01 pcmike

So we wait for a HACS Midea update? Right?

superpower10 avatar Jan 04 '25 14:01 superpower10

same here after update HA 2025.1.0

deenx avatar Jan 04 '25 17:01 deenx

So we wait for a HACS Midea update? Right?

i would suggest updating your local copy of the repo through a HA file editor.

All necessary updates can be seen here: https://github.com/georgezhao2010/midea_ac_lan/pull/635/commits/3bd4cf10b7d76686fe195f99528cab1d06f9dbec

Just add the changes to your local files to: /homeassistant/custom_components/midea_ac_lan/... (and there are 3 python files to be changed)

I have a gut feeling that this PR will be unanswered for quite some time as the repos original maintainer seems to be absent

also you could use this guide -> https://github.com/georgezhao2010/midea_ac_lan/pull/635#issuecomment-2571260746

leonhuhn avatar Jan 04 '25 19:01 leonhuhn

just went through it to correct mine, seems there are these 2 not changed: CONCENTRATION_MICROGRAMS_PER_CUBIC_METER, CONCENTRATION_PARTS_PER_MILLION and cause an error. Trying to figure out what to change them to.

Edit: In the meanwhile i just imported the files via terminal and now it doesn't care about these constants anymore!

thanks a lot for the work

mf76130 avatar Jan 05 '25 06:01 mf76130

This reporistory is dead because the maintainer has not been available for a long time and no more pull requests are being merged. You should switch to https://github.com/wuwentao/midea_ac_lan.

erikgieseler avatar Jan 05 '25 15:01 erikgieseler

Mine is/was working just fine. How gave permission for the integration to be removed from HACS....? Now I have a problem that I didn't have before.... Thanks.... FFS

Image

dougle03 avatar Jan 26 '25 09:01 dougle03