inspired-technologies/signalk-openweather-plugin

Onecall 3.0

Closed this issue · 9 comments

I've been having issues using anything other than simple data and current time. It's not a time since api key created problem as it's been days since the key was created. I do have a paid one call subscription.

Looking at the https://www.npmjs.com/package/openweather-apis library that's being used it looks like they're using the 2.5 version in the api calls for one call. https://github.com/CICCIOSGAMINO/openweather-apis/blob/master/index.js

  function buildPathOneCall(){
    return '/data/2.5/onecall?' + getCoordinate() + '&' + querystring.stringify({units: config.units, lang: config.lan, exclude: config.exclude, APPID: config.APPID});
  }

I can't find any reference currently with openweather on the 2.5 api. It's all 3.0 on the website. https://openweathermap.org/api/one-call-3#current

Or maybe I've just done something else wrong.

Looks like 2.5 will be sunset soon https://openweathermap.org/api/one-call-api

https://forums.homeseer.com/forum/hs4-products/hs4-plugins/weather-plug-ins-aa/akweather-alexbk66/1660724-openweather-api-key-problem

This link seems to say that for new accounts the 2.5 api has already been deprecated and won't work. That would mean I can't use this until it's using the 3.0 api.

I just checked and this URL did not work for 2.5 but did work if I replaced 2.5 with 3.0

https://api.openweathermap.org/data/3.0/onecall?lat=33.44&lon=-94.04&exclude=hourly,daily&appid=

I did fork this project and openweather-apis and made the change from 2.5 to 3.0 and confirmed this did fix the problem and I'm now able to get the full weather object and forecasts.

https://github.com/adam6806/openweather-apis/tree/API-v3.0

Looks like 2.5 will be sunset soon https://openweathermap.org/api/one-call-api

Many thanks, @adam6806, for raising this issue and your investigations to fix.

I did fork this project and openweather-apis and made the change from 2.5 to 3.0 and confirmed this did fix the problem and I'm now able to get the full weather object and forecasts.

https://github.com/adam6806/openweather-apis/tree/API-v3.0

Probably best to raise a pull-request with the original maintainer of the repo in order to creeate an updated version. However, this may result in a breaking change for people using the package if AppIds are not compatible and have to be re-generated.

this may result in a breaking change for people using the package if AppIds are not compatible and have to be re-generated.

I don't believe the issue would be keys. The big difference I believe between 2.5 and 3 is that 3 requires you to have billing setup on your account. So if you hadn't done that, then it will stop working until you do. The pricing is that you get 1000 free calls per day which should be plenty I would think. By default they set your limit to 2000 but I just changed mine back to 1000 to make sure I never pay for it. As soon as someone sets up their billing then after some short delay like an hour or two it should be working again.

In the meantime you could update the dependency for the plugin to use my changed version.

"openweather-apis": "git+https://github.com/adam6806/openweather-apis.git#onecall-3.0"

We decided to refactor the plugin and eliminate the library by calling the OWM OneCall API v3.0 directly; also allows for making the full set of attributes available to be published in SignalK. Other functionality remains mostly unchanged. Let us know, in case of any further issues.