Closed jkreileder closed 5 months ago
I only have a free subscription. When I tried this change, I get this error:
[18/01/2024, 12:43:22] [WeatherPlus] Could not retrieve weather report with neither API 3.0 or API 2.5. You may need to wait up to 30 minutes after creating your api key. If the error persist, check if you copied the api key correctly.
[18/01/2024, 12:43:22] [WeatherPlus] {
cod: 401,
message: 'Invalid API key. Please see https://openweathermap.org/faq#error401 for more info.'
}
When I revert back to the existing code, then the error goes away and I start getting forecasts in the Eve app again.
Are you sure that the free API can access /data/2.5/onecall
?
Are you sure that the free API can access
/data/2.5/onecall
?
@dacarson Yes, at least my key works for both the 2.5/weather
and 2.5/onecall
endpoints (but not
for 3.0/onecall
). Please try:
$ curl "https://api.openweathermap.org/data/2.5/weather?units=metric&lat=49.0195333&lon=12.0974869&appid=<Your API key>"
$ curl "https://api.openweathermap.org/data/2.5/onecall?units=metric&lat=49.0195333&lon=12.0974869&appid=<Your API key>"
Both calls should work. If they do, please try to debug why the changed code doesn't work for you - it doesn't change anything related to passing the API key.
The second one doesn't work.
$ curl "https://api.openweathermap.org/data/2.5/weather?units=metric&lat=49.0195333&lon=12.0974869&appid=key" {"coord":{"lon":12.0975,"lat":49.0195},"weather":[{"id":804,"main":"Clouds","description":"overcast clouds","icon":"04n"}],"base":"stations","main":{"temp":-1.02,"feels_like":-3.36,"temp_min":-1.14,"temp_max":0.4,"pressure":1007,"humidity":87},"visibility":10000,"wind":{"speed":1.79,"deg":322,"gust":4.92},"clouds":{"all":100},"dt":1705614202,"sys":{"type":2,"id":2010541,"country":"DE","sunrise":1705561112,"sunset":1705592679},"timezone":3600,"id":2849483,"name":"Regensburg","cod":200}
$ curl "https://api.openweathermap.org/data/2.5/onecall?units=metric&lat=49.0195333&lon=12.0974869&appid=key" {"cod":401, "message": "Invalid API key. Please see https://openweathermap.org/faq#error401 for more info."}
I got my free key from here: https://openweathermap.org/price#weather I picked the "Free" column. Below is a screen shot of my services tab.
That's strange then. I have the same but my key works for both.
Is there a way I can share privately my key?
Not necessary I guess. The issue is that apparently 2.5/onecall
is disabled for newer accounts (see https://github.com/domoticz/domoticz/issues/5336#issuecomment-1243023845). So the only real solution for dew point and UV index is to get a base subscription (basically enter payment details, then set a limit so you don't get over the 1000 free calls).
Should dew point and UV index be removed if using 2.5 API?
When using the 2.5/weather
endpoint? Yes. The code actually seems to try this:
This doesn't seem to do the trick, though. The characteristics are still announced.
Closing this PR as the 2.5/onecall
endpoint doesn't work for new accounts.
Use
/data/2.5/onecall
as a fall-back instead of/data/2.5/weather
. It returns virtually the same data as/data/3.0/onecall
, so the legacy code can be removed.Note: This has been tested only with 2.5 as I don't have a paid 3.0 subscription.
Fixes https://github.com/naofireblade/homebridge-weather-plus/issues/264 Fixes https://github.com/naofireblade/homebridge-weather-plus/issues/274