homebridge-smart-irrigation
homebridge-smart-irrigation copied to clipboard
API Error - 401 Unauthorised
Hi there,
I just discovered this plugin today, and also created an OpenWeatherMap account at the same time, but it looks like my API key is being rejected:
[30/11/2022, 10:55:44] [Sprinklers] Error getting weather data or Response code 401 (Unauthorized) [30/11/2022, 10:56:45] [Sprinklers] Error getting weather data or Response code 401 (Unauthorized) [30/11/2022, 10:57:46] [Sprinklers] Error getting weather data or Response code 401 (Unauthorized) [30/11/2022, 10:58:46] [Sprinklers] Error getting weather data or Response code 401 (Unauthorized)
From what I've read in here, it appears there's a difference between v2.5 and v3.0 of the API - is there a setting I need to change in the config to get this working?
Thank you!
This happened to me a couple of months ago after first opening a v3.0 account. After some research and discussion with open weather map I concluded the same thing you did and submitted a bug report. Then suddenly a couple of weeks later, it started working. At first I thought it was a software version upgrade but when I checked the version history there had been no upgrades. And it’s still working normally now. Hopefully this will happen for you too.
Sent from my iPhone
On Nov 29, 2022, at 17:06, CameronSmith93 @.***> wrote:
Hi there,
I just discovered this plugin today, and also created an OpenWeatherMap account at the same time, but it looks like my API key is being rejected:
[30/11/2022, 10:55:44] [Sprinklers] Error getting weather data or Response code 401 (Unauthorized) [30/11/2022, 10:56:45] [Sprinklers] Error getting weather data or Response code 401 (Unauthorized) [30/11/2022, 10:57:46] [Sprinklers] Error getting weather data or Response code 401 (Unauthorized) [30/11/2022, 10:58:46] [Sprinklers] Error getting weather data or Response code 401 (Unauthorized)
From what I've read in here, it appears there's a difference between v2.5 and v3.0 of the API - is there a setting I need to change in the config to get this working?
Thank you!
— Reply to this email directly, view it on GitHubhttps://github.com/MTry/homebridge-smart-irrigation/issues/46, or unsubscribehttps://github.com/notifications/unsubscribe-auth/A2XK7VCQEU2EGSNT7VMOLL3WK2SAXANCNFSM6AAAAAASPCURNM. You are receiving this because you are subscribed to this thread.Message ID: @.***>
Hi, Have you been able to solve this problem. I am experiencing the same error.
I checked the API using the link api.openweathermap.org/data/2.5/weather?q=peshawar&appid=API_key
everything looks correct" {"coord":{"lon":xx.xxxx,"lat":xx.xxxx},"weather":[{"id":721,"main":"Haze","description":"haze","icon":"50d"},{"id":500,"main":"Rain","description":"light rain","icon":"10d"}],"base":"stations","main":{"temp":290.23,"feels_like":289.01,"temp_min":290.23,"temp_max":290.23,"pressure":1014,"humidity":39},"visibility":6000,"wind":{"speed":2.06,"deg":310},"rain":{"1h":0.16},"clouds":{"all":75},"dt":1674983442,"sys":{"type":1,"id":7590,"country":"PK","sunrise":1674958388,"sunset":1674996004},"timezone":18000,"id":1168197,"name":"Peshawar","cod":200}
Hi there,
I just discovered this plugin today, and also created an OpenWeatherMap account at the same time, but it looks like my API key is being rejected:
[30/11/2022, 10:55:44] [Sprinklers] Error getting weather data or Response code 401 (Unauthorized) [30/11/2022, 10:56:45] [Sprinklers] Error getting weather data or Response code 401 (Unauthorized) [30/11/2022, 10:57:46] [Sprinklers] Error getting weather data or Response code 401 (Unauthorized) [30/11/2022, 10:58:46] [Sprinklers] Error getting weather data or Response code 401 (Unauthorized)
From what I've read in here, it appears there's a difference between v2.5 and v3.0 of the API - is there a setting I need to change in the config to get this working?
Thank you!
Be aware that:
One Call API 2.5 will be deprecated on April 15, 2024. Please read the detailed guide for transitioning to the more advanced One Call API 3.0 which includes several useful upgrades like 40+ years of history archive, daily aggregation and human readable daily summary in comparison with One Call API 2.5 version. Read more about One Call API 3.0 in the product documentation page and FAQ.
https://openweathermap.org/api/one-call-api
BTW, this call works:
https://api.openweathermap.org/data/2.5/weather?lat=41,44205054070333&lon=-8,3115741152312&exclude=current,minutely,hourly,alerts&units=metric&appid=KEY
but this doesn't:
https://api.openweathermap.org/data/2.5/onecall?lat=41,44205054070333&lon=-8,3115741152312&exclude=current,minutely,hourly,alerts&units=metric&appid=KEY
/weather
vs /onecall
.
There is strong evidence that the onecall
API for version 2.5 has been deprecated. Version 3.0 has a new payment scheme.
Thank you for this wonderful plugin ! I subscribed to One Call API 3.0 https://openweathermap.org/api/one-call-3 and I modify /var/lib/homebridge/node_modules/homebridge-smart-irrigation/index.js this line : "const url = 'https://api.openweathermap.org/data/2.5/onecall?lat=' + this.latitude + '&lon=' + this.longitude + '&exclude=current,minutely,hourly>" in this "const url = 'https://api.openweathermap.org/data/3.0/onecall?lat=' + this.latitude + '&lon=' + this.longitude + '&exclude=current,minutely,hourly>" and now I haven't API Error - 401 Unauthorised ever.
Please make an update for other users.
Have a good day.
Louison.
@Louison-B Can you submit a pull request?
@jmaferreira here you go: #65
Note: Users will have to add payment details to use v3.0 one call api.
Hi All - can someone explain how I modify my install to use the new API 3.0 calls please? Everything else should be in place, including the OWM subscription & I can see the line (168) in the index.js file here on GitHub, but I can't find that file on my Pi to make the changes - I'm guessing its not that simple?
Thanks for your help