core: OpenWeatherMap Integration dont Accept API Key

The problem

I followed the instructions, after several days of confirming my API key is still active, the integration is still not accepting the API key as valid.

What version of Home Assistant Core has the issue?

2022.8.7

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant Core

Integration causing the issue

Open weather Map API Code issue

Link to integration documentation on our website

No response

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

Web page  response: "Invalid API key"

Additional information

No response

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 24 (9 by maintainers)

Most upvoted comments

How do we get it to work for us? It seems the new api not supported without subscription. pwowm still uses the 2.5 API. The one_call API works with old accounts. The HA config flow uses https://api.openweathermap.org/data/2.5/onecall which only works with new free API keys. To fix that we could use the old weather API which still works for all keys:

diff --git a/homeassistant/components/openweathermap/config_flow.py b/homeassistant/components/openweathermap/config_flow.py
index 612965bdb2f..c418231946f 100644
--- a/homeassistant/components/openweathermap/config_flow.py
+++ b/homeassistant/components/openweathermap/config_flow.py
@@ -130,4 +130,4 @@ class OpenWeatherMapOptionsFlow(config_entries.OptionsFlow):
 
 async def _is_owm_api_online(hass, api_key, lat, lon):
     owm = OWM(api_key).weather_manager()
-    return await hass.async_add_executor_job(owm.one_call, lat, lon)
+    return await hass.async_add_executor_job(owm.weather_at_coords, lat, lon)

This will allow to setup, Furher the only working mode will be hourly. Tested this with a new account.

Hey there @fabaff, @freekode, @nzapponi, mind taking a look at this issue as it has been labeled with an integration (openweathermap) you are listed as a code owner for? Thanks! (message by CodeOwnersMention)

Just tested this, and I cannnot reproduce your error at the moment. The integration seems to be working with my (free) API key.