Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Broken on HA 2024.4.0b0 #130

Closed
tjorim opened this issue Mar 27, 2024 · 9 comments
Closed

Broken on HA 2024.4.0b0 #130

tjorim opened this issue Mar 27, 2024 · 9 comments
Labels
bug Something isn't working.

Comments

@tjorim
Copy link

tjorim commented Mar 27, 2024

Environment

  • Home Assistant Core release with the issue: 2024.4.0b0
  • This custom component release with the issue: 1.5.5
  • Last working this custom component release (if known): n/a
  • Operating environment (Home Assistant/Supervisor/Docker/venv): HA OS

Describe the bug
After updating HA to 2023.4 the integration does not load anymore.

Steps to Reproduce
Update to HA core April beta release.

Expected behavior
Integration still works.

Debug log

Logger: homeassistant.config
Source: config.py:1437
First occurred: 20:50:40 (1 occurrences)
Last logged: 20:50:40

Platform error: binary_sensor - cannot import name 'ATTR_FORECAST' from 'homeassistant.components.weather' (/usr/src/homeassistant/homeassistant/components/weather/__init__.py)
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config.py", line 1437, in _async_load_and_validate_platform_integration
    platform = await p_integration.integration.async_get_platform(domain)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/loader.py", line 1072, in async_get_platform
    platforms = await self.async_get_platforms((platform_name,))
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/loader.py", line 1147, in async_get_platforms
    import_future.result()
  File "/usr/src/homeassistant/homeassistant/loader.py", line 1135, in async_get_platforms
    platforms.update(self._load_platforms(platform_names))
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/loader.py", line 1062, in _load_platforms
    platform_name: self._load_platform(platform_name)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/loader.py", line 1235, in _load_platform
    cache[full_name] = self._import_platform(platform_name)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/loader.py", line 1265, in _import_platform
    return importlib.import_module(f"{self.pkg_path}.{platform_name}")
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/importlib/__init__.py", line 90, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 995, in exec_module
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
  File "/config/custom_components/car_wash/binary_sensor.py", line 18, in <module>
    from homeassistant.components.weather import (
ImportError: cannot import name 'ATTR_FORECAST' from 'homeassistant.components.weather' (/usr/src/homeassistant/homeassistant/components/weather/__init__.py)
@tjorim tjorim added the bug Something isn't working. label Mar 27, 2024
@JGrantman
Copy link

JGrantman commented Apr 4, 2024

Environment

Home Assistant Core release 2023.04

This custom component release with the issue

1.5.5

Last working this custom component release (if known)

All previous releases before 2024.04

Operating environment (Home Assistant/Supervisor/Docker/venv)

Home Assistant Core 2024.4.0
Supervisor 2024.03.1
Operating System 12.1
Frontend 20240403.1

Describe the bug

Updatting to the 2024.04 release version immediately broke the integration. Similar/same error as described above for the 2024.04 beta release.

Steps to Reproduce

From the Developer tools page the following error shows under Check and Restart:

Configuration warnings
Platform error 'binary_sensor' from integration 'car_wash' - cannot import name 'ATTR_FORECAST' from 'homeassistant.components.weather' (/usr/src/homeassistant/homeassistant/components/weather/init.py)

As a quick troubleshooting attempt I changed my config to point to an alternate forecast sensor but it did not change the error.

Expected behavior

No errors in log, no errors on Developer tools page, Car Wash sensor updates same as before update to 2024.04

Debug log

The full error from the log is below (and looks same as previously mentioned error above other than the line numbers being off by a few lines). The error below is from the log after a successful update to the HA release version 2024.04.

Logger: homeassistant.config
Source: config.py:1437

Platform error: binary_sensor - cannot import name 'ATTR_FORECAST' from 'homeassistant.components.weather' (/usr/src/homeassistant/homeassistant/components/weather/init.py)
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/config.py", line 1437, in _async_load_and_validate_platform_integration
platform = await p_integration.integration.async_get_platform(domain)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/loader.py", line 1070, in async_get_platform
platforms = await self.async_get_platforms((platform_name,))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/loader.py", line 1145, in async_get_platforms
import_future.result()
File "/usr/src/homeassistant/homeassistant/loader.py", line 1133, in async_get_platforms
platforms.update(self._load_platforms(platform_names))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/loader.py", line 1060, in _load_platforms
platform_name: self._load_platform(platform_name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/loader.py", line 1232, in _load_platform
cache[full_name] = self._import_platform(platform_name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/loader.py", line 1264, in _import_platform
return importlib.import_module(f"{self.pkg_path}.{platform_name}")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/importlib/init.py", line 90, 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 995, in exec_module
File "", line 488, in _call_with_frames_removed
File "/config/custom_components/car_wash/binary_sensor.py", line 18, in
from homeassistant.components.weather import (
ImportError: cannot import name 'ATTR_FORECAST' from 'homeassistant.components.weather' (/usr/src/homeassistant/homeassistant/components/weather/init.py)

@golles
Copy link

golles commented Apr 4, 2024

See also #128

@tjorim tjorim changed the title Broken on HA 2023.4.0b0 Broken on HA 2024.4.0b0 Apr 4, 2024
@sudoxnym
Copy link

sudoxnym commented Apr 8, 2024

Having this same issue.

@tanker11
Copy link

tanker11 commented Apr 9, 2024

Same here with 2024.4.1

1 similar comment
@Valen13776
Copy link

Same here with 2024.4.1

@gridlockjoe
Copy link

Here too.

@sudoxnym
Copy link

sudoxnym commented Apr 9, 2024

This is why it is broken:
Weather
The previously deprecated forecast attribute of weather entities, has now been removed. Use the weather.get_forecasts service to get the forecast data instead.
NEEDS TO CHANGE: line 19 binary_sensor.py
from homeassistant.components.weather import ( GET_FORECASTS,
and line 160 binary_sensor.py
forecast = wdata.attributes.get(GET_FORECASTS)

WHAT it needs to change to, I have no clue. According to the release notes it should allow you to pull the info by using weather.get_forcasts, but I have no idea how to convert that from yaml to (I believe) Python? (Novice coder)

@Fischelsberger Fischelsberger mentioned this issue Apr 14, 2024
9 tasks
@Fischelsberger
Copy link

Fischelsberger commented Apr 14, 2024

Hi,

I've just create a PR #131, fix is working in my instance, but i'm not sure at all, if this is the right approach...
Thank you @Pronown, that were the right hints.

@Limych
Copy link
Owner

Limych commented May 9, 2024

fixed

@Limych Limych closed this as completed May 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants