Limych / ha-car_wash

Car Wash Binary Sensor for Home Assistant
Other
81 stars 13 forks source link

Broken on HA 2024.4.0b0 #130

Closed tjorim closed 2 months ago

tjorim commented 3 months ago

Environment

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)
JGrantman commented 3 months ago

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 commented 3 months ago

See also #128

sudoxnym commented 3 months ago

Having this same issue.

tanker11 commented 3 months ago

Same here with 2024.4.1

Valen13776 commented 3 months ago

Same here with 2024.4.1

gridlockjoe commented 3 months ago

Here too.

sudoxnym commented 3 months ago

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 commented 3 months ago

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 commented 2 months ago

fixed