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

AEMET "unknown error ocurred" trying to add/configure the integration #120017

Closed
djrm05 opened this issue Jun 20, 2024 · 11 comments · Fixed by #120065
Closed

AEMET "unknown error ocurred" trying to add/configure the integration #120017

djrm05 opened this issue Jun 20, 2024 · 11 comments · Fixed by #120065

Comments

@djrm05
Copy link

djrm05 commented Jun 20, 2024

The problem

I removed the integration and now trying to readd it, I got only an error message in the screen as "unknown error ocurred" . I would like to understand if this is something related to my instance, the AEMET site or what :) Anyone else with this issue?

What version of Home Assistant Core has the issue?

2024.6.3

What was the last working version of Home Assistant Core?

2024.5.5 (I think this was the one I had when I removed the integration)

What type of installation are you running?

Home Assistant Container

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?

`Registrador: aiohttp.server
Fuente: /usr/local/lib/python3.12/site-packages/aiohttp/web_protocol.py:421
Ocurrió por primera vez: 11:00:55 (5 ocurrencias)
Último inicio de sesión: 12:06:52

Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/aiohttp/web_protocol.py", line 452, in _handle_request
    resp = await request_handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/web_app.py", line 543, in _handle
    resp = await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/web_middlewares.py", line 114, in impl
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 92, in security_filter_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 210, in forwarded_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 26, in request_context_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 85, in ban_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 242, in auth_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/headers.py", line 32, in headers_middleware
    response = await handler(request)
               ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/http.py", line 73, in handle
    result = await handler(request, **request.match_info)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/decorators.py", line 81, in with_admin
    return await func(self, request, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/config/config_entries.py", line 222, in post
    return await super().post(request, flow_id)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/data_validator.py", line 70, in wrapper
    return await method(view, request, data, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/data_entry_flow.py", line 122, in post
    result = await self._flow_mgr.async_configure(flow_id, data)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 368, in async_configure
    result = await self._async_configure(flow_id, user_input)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 414, in _async_configure
    result = await self._async_handle_step(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 517, in _async_handle_step
    result: _FlowResultT = await getattr(flow, method)(user_input)
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/aemet/config_flow.py", line 51, in async_step_user
    await aemet.select_coordinates(latitude, longitude)
  File "/usr/local/lib/python3.12/site-packages/aemet_opendata/interface.py", line 390, in select_coordinates
    town_data = await self.get_town_by_coordinates(latitude, longitude)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aemet_opendata/interface.py", line 353, in get_town_by_coordinates
    for cur_town in towns[ATTR_DATA]:
                    ~~~~~^^^^^^^^^^^
KeyError: 'data'
`

Additional information

No response

@home-assistant
Copy link

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)

@jescanellas
Copy link

jescanellas commented Jun 20, 2024

I get a different error. It hasn't worked for me since for last week. First it was an "API error", even thought it then worked for a few hours with the same API key, but for the last days it shows this error:

Font: config_entries.py:594
Produït per primer cop: 19 de juny de 2024, a les 17:05:41 (3 ocurrències)
Últim registre: 12:43:39

Error setting up entry AEMET for aemet
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 594, in async_setup
    result = await component.async_setup_entry(hass, self)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/aemet/__init__.py", line 42, in async_setup_entry
    await aemet.select_coordinates(latitude, longitude)
  File "/usr/local/lib/python3.12/site-packages/aemet_opendata/interface.py", line 390, in select_coordinates
    town_data = await self.get_town_by_coordinates(latitude, longitude)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aemet_opendata/interface.py", line 353, in get_town_by_coordinates
    for cur_town in towns[ATTR_DATA]:
                    ~~~~~^^^^^^^^^^^
KeyError: 'data'```
  • Core: 2024.6.3
  • Supervisor: 2024.06.0
  • OS: 12.4

@joe7045
Copy link

joe7045 commented Jun 20, 2024

Same error

Registrador: homeassistant.config_entries
Fuente: config_entries.py:594
Ocurrió por primera vez: 07:56:04 (5 ocurrencias)
Último inicio de sesión: 15:54:36

Error setting up entry AEMET for aemet
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 594, in async_setup
result = await component.async_setup_entry(hass, self)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/aemet/init.py", line 42, in async_setup_entry
await aemet.select_coordinates(latitude, longitude)
File "/usr/local/lib/python3.12/site-packages/aemet_opendata/interface.py", line 390, in select_coordinates
town_data = await self.get_town_by_coordinates(latitude, longitude)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/aemet_opendata/interface.py", line 353, in get_town_by_coordinates
for cur_town in towns[ATTR_DATA]:
~~~~~^^^^^^^^^^^
KeyError: 'data'

Core
2024.6.3
Supervisor
2024.06.0
Operating System
12.4
Frontend
20240610.1

@JohnRobo
Copy link

Same error as above here.

I noticed the integration was reporting 'Unknown error' so deleted and tried to reinstall with a new API code. When I click ok it gives 'Unknown error occurred' and won't now install.

Core 2024.6.3
Supervisor 2024.06.0
Operating System 12.4
Frontend 20240610.1

@tergontor
Copy link

Same error as above here.

It started crashing when I installed Core 2024.6.3

Core 2024.6.3
Supervisor 2024.06.0
Operating System 12.4
Frontend 20240610.1

@obaldius
Copy link

obaldius commented Jun 21, 2024

Same here, definetely not the core version

Core 2024.4.2
Supervisor 2024.06.0
Operating System 12.2
Frontend 20240404.1

@scinos
Copy link

scinos commented Jun 21, 2024

The error seems to come from Python lib AEMET-OpenData. In fact, running the examples from that library shows the same error.

Current lib version is 0.5.1, which was released a few months ago, in February. So it is not a recent change. Therefore my guess is there was a change in AEMET's API response, making it incompatible with AEMET-OpenData 0.5.1.

TLDR: not our fault.

@Noltari
Copy link
Contributor

Noltari commented Jun 21, 2024

Current lib version is 0.5.1, which was released a few months ago, in February. So it is not a recent change. Therefore my guess is there was a change in AEMET's API response, making it incompatible with AEMET-OpenData 0.5.1.

You're totally right, AEMET has introduced a minor change in the API related to the towns response:
Noltari/AEMET-OpenData@c97892d

It should be fixed in the next Home Assistant version and hopefully the fix can be backported to the next 2024.6.X release.

Sorry for the inconvenience...

@scinos
Copy link

scinos commented Jun 21, 2024

Thanks for the quick fix @Noltari

@joe7045
Copy link

joe7045 commented Jun 21, 2024

Thank you very much

@djrm05
Copy link
Author

djrm05 commented Jun 21, 2024

Fixed in last release! Many thanks!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants