home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
72.71k stars 30.45k forks source link

AEMET Unexpected error fetching aemet data: 'Station' object has no attribute 'dew_point' #105168

Closed figorr closed 10 months ago

figorr commented 10 months ago

The problem

After updating to 2023.12 I am receiving the following error from the AEMET integration. And finally the integration fails setting up. ERROR 1

Logger: homeassistant.components.aemet.weather_update_coordinator Source: helpers/update_coordinator.py:300 Integration: AEMET OpenData (documentation, issues) First occurred: 23:52:26 (1 occurrences) Last logged: 23:52:26

Unexpected error fetching aemet data: 'Station' object has no attribute 'dew_point' Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 300, in _async_refresh self.data = await self._async_update_data() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/aemet/weather_update_coordinator.py", line 147, in _async_update_data return self._convert_weather_response(weather_response) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/aemet/weather_update_coordinator.py", line 250, in _convert_weather_response data = self.aemet.data() ^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/aemet_opendata/interface.py", line 227, in data data[AOD_STATION] = self.station.data() ^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/aemet_opendata/station.py", line 236, in data dew_point = self.get_dew_point() ^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/aemet_opendata/station.py", line 110, in get_dew_point return self.dew_point ^^^^^^^^^^^^^^ AttributeError: 'Station' object has no attribute 'dew_point'

ERROR 2

Logger: homeassistant.config_entries Source: config_entries.py:402 First occurred: 6 de diciembre de 2023, 23:54:03 (1 occurrences) Last logged: 6 de diciembre de 2023, 23:54:03

Error setting up entry AEMET for aemet Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/config_entries.py", line 402, in async_setup result = await component.async_setup_entry(hass, self) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/aemet/init.py", line 37, in async_setup_entry await aemet.select_coordinates(latitude, longitude) File "/usr/local/lib/python3.11/site-packages/aemet_opendata/interface.py", line 399, in select_coordinates await self.get_conventional_observation_station_by_coordinates( File "/usr/local/lib/python3.11/site-packages/aemet_opendata/interface.py", line 305, in get_conventional_observation_station_by_coordinates stations = await self.get_conventional_observation_stations() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/aemet_opendata/interface.py", line 298, in get_conventional_observation_stations return await self.api_call("observacion/convencional/todas", fetch_data) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/aemet_opendata/interface.py", line 165, in api_call data = await self.api_data(json_response[AEMET_ATTR_DATA]) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/aemet_opendata/interface.py", line 183, in api_data resp: ClientResponse = await self.aiohttp_session.request( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/aiohttp/client.py", line 601, in _request await resp.start(conn) File "/usr/local/lib/python3.11/site-packages/aiohttp/client_reqrep.py", line 960, in start with self._timer: File "/usr/local/lib/python3.11/site-packages/aiohttp/helpers.py", line 735, in exit raise asyncio.TimeoutError from None TimeoutError

What version of Home Assistant Core has the issue?

core-2023.12.0

What was the last working version of Home Assistant Core?

core-2023.11.3

What type of installation are you running?

Home Assistant OS

Integration causing the issue

AEMET

Link to integration documentation on our website

https://www.home-assistant.io/integrations/aemet

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

ERROR 1
Logger: homeassistant.components.aemet.weather_update_coordinator
Source: helpers/update_coordinator.py:300
Integration: AEMET OpenData (documentation, issues)
First occurred: 23:52:26 (1 occurrences)
Last logged: 23:52:26

Unexpected error fetching aemet data: 'Station' object has no attribute 'dew_point'
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 300, in _async_refresh
    self.data = await self._async_update_data()
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/aemet/weather_update_coordinator.py", line 147, in _async_update_data
    return self._convert_weather_response(weather_response)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/aemet/weather_update_coordinator.py", line 250, in _convert_weather_response
    data = self.aemet.data()
           ^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/aemet_opendata/interface.py", line 227, in data
    data[AOD_STATION] = self.station.data()
                        ^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/aemet_opendata/station.py", line 236, in data
    dew_point = self.get_dew_point()
                ^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/aemet_opendata/station.py", line 110, in get_dew_point
    return self.dew_point
           ^^^^^^^^^^^^^^
AttributeError: 'Station' object has no attribute 'dew_point'

ERROR 2
Logger: homeassistant.config_entries
Source: config_entries.py:402
First occurred: 6 de diciembre de 2023, 23:54:03 (1 occurrences)
Last logged: 6 de diciembre de 2023, 23:54:03

Error setting up entry AEMET for aemet
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 402, in async_setup
    result = await component.async_setup_entry(hass, self)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/aemet/__init__.py", line 37, in async_setup_entry
    await aemet.select_coordinates(latitude, longitude)
  File "/usr/local/lib/python3.11/site-packages/aemet_opendata/interface.py", line 399, in select_coordinates
    await self.get_conventional_observation_station_by_coordinates(
  File "/usr/local/lib/python3.11/site-packages/aemet_opendata/interface.py", line 305, in get_conventional_observation_station_by_coordinates
    stations = await self.get_conventional_observation_stations()
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/aemet_opendata/interface.py", line 298, in get_conventional_observation_stations
    return await self.api_call("observacion/convencional/todas", fetch_data)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/aemet_opendata/interface.py", line 165, in api_call
    data = await self.api_data(json_response[AEMET_ATTR_DATA])
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/aemet_opendata/interface.py", line 183, in api_data
    resp: ClientResponse = await self.aiohttp_session.request(
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/aiohttp/client.py", line 601, in _request
    await resp.start(conn)
  File "/usr/local/lib/python3.11/site-packages/aiohttp/client_reqrep.py", line 960, in start
    with self._timer:
  File "/usr/local/lib/python3.11/site-packages/aiohttp/helpers.py", line 735, in __exit__
    raise asyncio.TimeoutError from None
TimeoutError

Additional information

No response

home-assistant[bot] commented 10 months ago

Hey there @noltari, mind taking a look at this issue as it has been labeled with an integration (aemet) you are listed as a code owner for? Thanks!

Code owner commands Code owners of `aemet` can trigger bot actions by commenting: - `@home-assistant close` Closes the issue. - `@home-assistant rename Awesome new title` Renames the issue. - `@home-assistant reopen` Reopen the issue. - `@home-assistant unassign aemet` Removes the current integration label and assignees on the issue, add the integration domain after the command. - `@home-assistant add-label needs-more-information` Add a label (needs-more-information, problem in dependency, problem in custom component) to the issue. - `@home-assistant remove-label needs-more-information` Remove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.

(message by CodeOwnersMention)


aemet documentation aemet source (message by IssueLinks)

djrm05 commented 10 months ago

same error here just after upgrade to 2023.12

tenallero commented 10 months ago

Me too, after upgrading to 2023.12

michaelkun commented 10 months ago

Same in the 2023.12

terierul commented 10 months ago

me too after the same upgrade

2023-12-07 09:41:32.242 WARNING (MainThread) [homeassistant.components.aemet.weather_update_coordinator] Station data is outdated 2023-12-07 09:41:32.252 ERROR (MainThread) [homeassistant.components.aemet.weather_update_coordinator] Unexpected error fetching aemet data: 'Station' object has no attribute 'dew_point' Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 300, in _async_refresh self.data = await self._async_update_data() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/aemet/weather_update_coordinator.py", line 147, in _async_update_data return self._convert_weather_response(weather_response) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/aemet/weather_update_coordinator.py", line 250, in _convert_weather_response data = self.aemet.data() ^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/aemet_opendata/interface.py", line 227, in data data[AOD_STATION] = self.station.data() ^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/aemet_opendata/station.py", line 236, in data dew_point = self.get_dew_point() ^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/aemet_opendata/station.py", line 110, in get_dew_point return self.dew_point ^^^^^^^^^^^^^^ AttributeError: 'Station' object has no attribute 'dew_point' 2023-12-07 09:41:32.261 DEBUG (MainThread) [homeassistant.components.aemet.weather_update_coordinator] Finished fetching aemet data in 0.454 seconds (success: False) 2023-12-07 09:41:52.738 DEBUG (MainThread) [aemet_opendata.interface] api_call: cmd=observacion/convencional/todas 2023-12-07 09:42:08.634 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry AEMET for aemet Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/config_entries.py", line 402, in async_setup result = await component.async_setup_entry(hass, self) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/aemet/init.py", line 37, in async_setup_entry await aemet.select_coordinates(latitude, longitude) File "/usr/local/lib/python3.11/site-packages/aemet_opendata/interface.py", line 399, in select_coordinates await self.get_conventional_observation_station_by_coordinates( File "/usr/local/lib/python3.11/site-packages/aemet_opendata/interface.py", line 305, in get_conventional_observation_station_by_coordinates stations = await self.get_conventional_observation_stations() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/aemet_opendata/interface.py", line 298, in get_conventional_observation_stations return await self.api_call("observacion/convencional/todas", fetch_data) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/aemet_opendata/interface.py", line 135, in api_call resp: ClientResponse = await self.aiohttp_session.request( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/aiohttp/client.py", line 601, in _request await resp.start(conn) File "/usr/local/lib/python3.11/site-packages/aiohttp/client_reqrep.py", line 960, in start with self._timer: File "/usr/local/lib/python3.11/site-packages/aiohttp/helpers.py", line 735, in exit raise asyncio.TimeoutError from None TimeoutError

javixuhc commented 10 months ago

Me too, after upgrading to 2023.12.

PacoCT commented 10 months ago

Me too. After 2023.12 upgrade

amaseroc commented 10 months ago

Mismo problema despues de actualizar a 2023.12

daesdel commented 10 months ago

Mismo problema después de actualizar a 2023.12

drakhart commented 10 months ago

Same happening here after upgrading to 2023.12

FYI: as a temp workaround until this is fixed, you can edit the culprit file (in my case located in /srv/homeassistant/lib/python3.11/site-packages/aemet_opendata/station.py as I'm running an isolated Python env) and edit the get_dew_point and get_pressure methods so they both return a plain 0.

Sure, it won't return real data but hey, afaik there's no real data to be returned.

image

image

afharo commented 10 months ago

I found a way to fix the bug leading to "ERROR 1"

AttributeError: 'Station' object has no attribute 'dew_point'

I've submitted https://github.com/Noltari/AEMET-OpenData/pull/7 to fix the underlying library. Once @Noltari helps me merge it and release it, we'll need to bump the version in this repo.

You can modify your local installation in the same way for a workaround while we get it there. If you are running the docker distribution (like I do), the file is in /usr/local/lib/python3.11/site-packages/aemet_opendata/station.py


For ERROR 2, all I can think we can do is retry on Timeout... that'll require more work... I'll play around to see if I can put a PR together for that.

themaninspain commented 10 months ago

I have the same problem after upgrading. Using HassOS on an intel NUC and cannot find the file mentioned in previous posts to temporarily fix the problem.