Skip to content
This repository has been archived by the owner on May 17, 2021. It is now read-only.

[weather1] Request: add support for the free version of forecasts for OpenWeatherMap #5309

Closed
dominikkv opened this issue Sep 17, 2017 · 23 comments
Labels

Comments

@dominikkv
Copy link

Wrong url for weather forecast request for OpenWeatherMap. There is no "daily" in the url, see documentation https://openweathermap.org/forecast5

Expected Behavior

Working forecast for OpenWeatherMap (http://docs.openhab.org/addons/bindings/weather1/readme.html#forecast)

Current Behavior

Forecast is broken, see karaf log:

13:16:22.182 [TRACE] [nal.provider.AbstractWeatherProvider] - OPENWEATHERMAP[openweather]: request : http://api.openweathermap.org/data/2.5/forecast/daily?lat=48.xxx&lon=7.yyy&lang=de&cnt=5&mode=json&units=metric&APPID=123notthateasy
13:16:22.239 [TRACE] [nal.provider.AbstractWeatherProvider] - OPENWEATHERMAP[openweather]: response: {"cod":401, "message": "Invalid API key. Please see http://openweathermap.org/faq#error401 for more info."}
13:16:22.239 [ERROR] [nal.provider.AbstractWeatherProvider] - OPENWEATHERMAP[openweather]: Can't retreive weather data: HTTP/1.1 401 Unauthorized

Possible Solution

See merge request #5308

Steps to Reproduce (for bugs)

  1. Install binding weather1
  2. Create /conf/services/weather.cfg with appropriate content like:
apikey.OpenWeatherMap=123456789

location.openweather.name=Openweather
location.openweather.latitude=48.xxxx
location.openweather.longitude=7.yyyy
location.openweather.provider=OpenWeatherMap
location.openweather.language=de
location.openweather.updateInterval=10
location.openweather.units=si
  1. Add any weather item
  2. Open karaf console, set trace level: log:set TRACE org.openhab.binding.weather
  3. After 10 minutes, see log entries above

Your Environment

  • Version used: openhab2, openhab-binding-weather1 1.10.0
  • Operating System and version: Docker image openhab/openhab:2.1.0-amd64 hosted on an Ubuntu 17.04
@9037568
Copy link
Contributor

9037568 commented Sep 17, 2017

The error you're getting is because you're using an invalid API key. There's nothing wrong with the binding.

And the forecast URL certainly does have 'daily' in the path. See here.

@dominikkv
Copy link
Author

OK, there are indeed 2 API endpoints

  • The 5 days forecast (without "daily" in url)
  • The 16 days forecast (with "daily" in url)

The problem is that the 16 day forecast is not included in the free plan, that's the reason why I'm getting the "Unauthorized" message.

So the question is if this is intended. The documentation of this addon says that forecast is possible for OpenWeatherMap: 5 days (0-4). Furthermore, I think it is good when also non paying users can use this addon.

If this is not intended we have to figure out how to change addon to use the 5 days forecast. I see now that simply removing the "daily" from the url is not sufficient, because the result will not be divided in days, but in 3-hour blocks.

What do you think?

(Additional info: the API access key is correct, the call to get the current weather works fine)

@9037568 9037568 changed the title [weather1] Fix weather forecast url for OpenWeatherMap [weather1] Request: add support for the free version of forecasts for OpenWeatherMap Sep 17, 2017
@9037568
Copy link
Contributor

9037568 commented Sep 17, 2017

Ok. That is indeed a different thing. I've changed the title accordingly.

@felixloesch
Copy link

The bug is still there. No forecast possible with OpenWeatherMap.

@tobiasisenberg
Copy link

I notice the same issue. Could this be fixed somehow?

@9037568
Copy link
Contributor

9037568 commented Jun 23, 2018

There's an ESH binding for OWM in development.

@mjansing
Copy link

mjansing commented Aug 9, 2018

Any updates on this? It would be great if it's possible to use free OpenWeatherMap-API with weather1 binding. What about a toggle for free and paid more detailed forecast?

@cweitkamp
Copy link
Contributor

No, not yet (see #5344 (comment)). It cannot be implemented without reaching a decision on the following questions.

I would love to see a working forecast for OWM provider to be part of this binding. Even better without anyone has to pay for it.

I agree, that it should be configurable for the user which version he wants to use. But that is not simply possible by switching the URLs.

If you have a closer look at the API documentation of OWM you will see that the 5 day API provides weather data for every 3 hours. We have to adopt that in the binding too. Currently the binding parses every result set as a separate day. Meaning that you will currently see the weather data for the next 3 hours as forecast for tomorrow, the weather data for the next 6 hours as forecast for the day after tomorrow, and so on.

How do you think can we archive that? Should we skip the result sets for the next 3, 6, ..., 21 hours and use the result set for the next 24 hours as forecast for tomorrow, skip 27, 30, ..., 45 hours again and use the result set of 48 hours as forecast for the day after tomorrow, and so on? Wdyt? This could end in a forecast which could change every few hours.

Another approach could be to use a specific time of the day (e.g. 12 o'clock) as forecast.

A third approach could be to break the general logic of the binding to return 3 hours forecast instead of daily forecast (especially if you're using OWM, but maybe other provider support other forecast options as well).

@staehler
Copy link

staehler commented Nov 2, 2018

Please update your docu accordingly. I freshly have requested an API key and run into the same problem. Just wasted my time till I found this postings ....

@skoona
Copy link

skoona commented Nov 4, 2018

I'm another person who has wasted hours setting this up only to find this thread and experience the same issue. I'm not interested in paying for weather info for residential use.

Have no choice but to switch to Yahoo (which has limited availability) as my free provider, until OpenWeatherMap and its common multi-hour forecasting feature is supported.

To comment on the question related to forecasting data being in multiple segments per day, rather than one blob per day. I would suggest configuration params on top of location.<locationId>.new-params to capture the number of expected daily samples, and the number to use in computations and/or archiving.

Otherwise, your add-on looks excellent -- thanks for the hard work thus far!

@chemical1979
Copy link

chemical1979 commented Nov 7, 2018

I also walked straight into this issue one hour ago. As I'm doing the first steps with openHAB i was confused by successfully getting stuff from the API while at the same time getting an invalid API key error.

openHAB/userdata/logs/events.log
2018-11-07 22:27:12.962 [vent.ItemStateChangedEvent] - Temperature changed from UNDEF to 13.65
2018-11-07 22:27:12.968 [vent.ItemStateChangedEvent] - Humidity changed from UNDEF to 66.00

openHAB/userdata/logs/openhab.log
2018-11-07 22:27:12.960 [ERROR] [nal.provider.AbstractWeatherProvider] - OPENWEATHERMAP[home]: Can't retreive weather data: Invalid API key. Please see http://openweathermap.org/faq#error401 for more info.

@kgooris
Copy link

kgooris commented Nov 19, 2018

I'm expiriancing the same issues. I just upgraded to the latest available version and now these errors are showing. So for me this worked before, but not anymore.

@cweitkamp
Copy link
Contributor

All,

Just a short heads-up: I will not come up with a solution for this. We now have a dedicated OpenWeatherMap binding available in the ESH / OH2 distribution. I recommend you to use the new binding if you like to fetch data of the free 5 day / 3 hour forecast.

Please update your docu accordingly.

@staehler Feel free to add it to the documentation and contribute.

@9037568 Shall we consider to close this issue?

@kgooris
Copy link

kgooris commented Nov 20, 2018

This new binding is not available in my installation openhab 2.3.0-1 (stable)
How can I add it, without having to move my installation to a unstable testing openhab installation?

@9037568
Copy link
Contributor

9037568 commented Nov 20, 2018

@9037568 Shall we consider to close this issue?

Agreed.

@cweitkamp
Copy link
Contributor

How can I add it, without having to move my installation to a unstable testing openhab installation?

@kgooris I am afraid that is not possible. The OWN binding uses features which are not available in OH2.3.

@kgooris
Copy link

kgooris commented Nov 21, 2018

When will it become available in stable version?

@cweitkamp
Copy link
Contributor

When will it become available in stable version?

@kgooris In the next release version (OH 2.4). I do not know an exact release date for it yet.

@maihacke
Copy link
Contributor

maihacke commented Dec 3, 2018

I created a version with the free api for forecast.
You may download it here https://github.com/maihacke/openhab1-addons/releases/download/20181202_own_free_forecast/org.openhab.binding.weather-1.13.0-SNAPSHOT.jar.
For installation, first uninstall weather-binding via paperui and copy the jar to your addons folder.

@MrTheBarbarian
Copy link

Hello!
Could you please specify where is the addon folder on Linux for OH2. Is it : /usr/share/openhab2/addons ? Because in this folder I have two files: openhab-addons-2.3.0.kar & openhab-addons-legacy-2.3.0.kar
Is it the right place where I have to put this file?
Thanks!

@AngelosF
Copy link
Member

AngelosF commented Dec 4, 2018

@MrTheBarbarian : yes, that's the correct location
by the way: It's better to use the forum for this kind of questions.
Also: You don't really need openhab-addons-2.3.0.kar & openhab-addons-legacy-2.3.0.kar
You can remove them from your addons folder (optional)

@felixschndr
Copy link

For installation, first uninstall weather-binding via paperui and copy the jar to your addons folder.
do I have to do anything else? I unistalled the weather1 binding, put the jar into the folder and rebootet but the paper ui doesn't show the binding

@9037568
Copy link
Contributor

9037568 commented Dec 10, 2018

This conversation needs to move to the community forum.

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

No branches or pull requests