OpenWeatherMap Forecast not working

openweathermap
Tags: #<Tag:0x00007fe054f3b2b8>

(Dan) #1

I am using Openhab 2.4 and the OpenWeatherMap binding. I have an API key which is valid and working, and am able to pull in current weather conditions. However, the forecast function is not working. I confirmed that my API key can successfully pull forecast data using their API instructions (see below). I can see days worth of forecasts returned on the API but openhab will not show me any forecast data.
http://api.openweathermap.org/data/2.5/forecast?id=[]&appid=[]

The following is my current condition item in openhab which is working

Number:Temperature localCurrentTemperature “Current temperature [%.1f %unit%]” { channel=“openweathermap:weather-and-forecast:d75e50c9:current#temperature” }

The following are the forecast max temp for today and the forecast max temp for tomorrow which are not working.

Number:Temperature localDailyForecastTodayMaxTemperature “Maximum temperature for today [%.1f %unit%]” { channel=“openweathermap:weather-and-forecast:d75e50c9:forecastToday#max-temperature” }

Number:Temperature localDailyForecastDay2MaxTemperature “Maximum temperature in 2 days [%.1f %unit%]” { channel=“openweathermap:weather-and-forecast:d75e50c9:forecastDay2#max-temperature” }

I have read countless posts to try and figure out what is going on to no avail. I noticed that the forecast function for non-paid accounts doesn’t seem to work for the old openhab 1.x weather binding and that folks needing this functionality were referred to this new 2.x binding specific to openweathermap (which I am attempting to use). What am I missing that is preventing me from obtaining forecast data?


(namraccr) #2

What does the DEBUG log you pulled say?

Also, please use code fences.


(Dan) #3

I turned on debug mode and in my events.log I can see I’m getting current conditions and up to 24 hours forecast in 3 hour increments but there are no future days coming in. I looked into the openweathermap binding in paperui and I don’t see forecast days there either. Clicking around in paperui I don’t see a way for me to tell openhab that I want to add in future days. In reading https://www.openhab.org/addons/bindings/openweathermap/ it appeared as if I add the openweathermap thing and then I can use any of the forecast syntax listed but I must have done something wrong. What should I check next?


(namraccr) #4

Did you check the openhab.log file?


(Alex) #5

@dhog12

Only to be sure, you’ve configured your thing “Local weather and forecast” the “Number of Days”?

see here:


(Chris) #6

I think max/min temperature ist part of the daily forecast. You need a paid api for the daily forecast. With a free api you only can acces the hourly forecast.


(Alex) #7

@dhog12

Do you have a “paid account” or “free account”? If it is free, then @momo90 is right!


(Allen) #8

if you look at this link :
https://openweathermap.org/price
under free account it said " 5 days/3 hour forecast"

if you open the link it gives the api instructions . and states the following.
“5 day forecast is available at any location or city. It includes weather data every 3 hours. Forecast is available in JSON or XML format.”

but can’t get it to work. but web request with my key works

if I run the internet request : https://api.openweathermap.org/data/2.5/forecast?lat=-31.49&lon=25.01&appid=XXXX(Your API key)

And I get the reply . son don’t agree that it is only for payed. you can only get a 5 day and not 16 day forecast. and you can request every 3 hours. (if I understand it correctly )

{"cod":"200","message":0.0282,"cnt":40,"list":[{"dt":1547629200,"main":{"temp":305.2,"temp_min":298.575,"temp_max":305.2,"pressure":864.48,"sea_level":1024.9,"grnd_level":864.48,"humidity":44,"temp_kf":6.63},"weather":[{"id":800,"main":"Clear","description":"clear sky","icon":"01d"}],"clouds":{"all":0},"wind":{"speed":1.62,"deg":136},"sys":{"pod":"d"},"dt_txt":"2019-01-16 09:00:00"},{"dt":1547640000,"main":{"temp":309.45,"temp_min":304.475,"temp_max":309.45,"pressure":861.7,"sea_level":1020.7,"grnd_level":861.7,"humidity":26,"temp_kf":4.97},"weather":[{"id":800,"main":"Clear","description":"clear sky","icon":"01d"}],"clouds":{"all":0},"wind":{"speed":3,"deg":294.501},"sys":{"pod":"d"},"dt_txt":"2019-01-16 12:00:00"},{"dt":1547650800,"main":{"temp":308.14,"temp_min":304.824,"temp_max":308.14,"pressure":859.58,"sea_level":1018.52,"grnd_level":859.58,"humidity":15,"temp_kf":3.31},"weather":[{"id":500,"main":"Rain","description":"light rain","icon":"10d"}],"clouds":{"all":0},"wind":{"speed":4.76,"deg":277},"rain":{"3h":0.0775},"sys":{"pod":"d"},"dt_txt":"2019-01-16 15:00:00"},{"dt":1547661600,"main":{"temp":298.58,"temp_min":296.923,"temp_max":298.58,"pressure":860.04,"sea_level":1019.72,"grnd_level":860.04,"humidity":18,"temp_kf":1.66},"weather":[{"id":800,"main":"Clear","description":"clear sky","icon":"01n"}],"clouds":{"all":0},"wind":{"speed":2.76,"deg":282.502},"rain":{},"sys":{"pod":"n"},"dt_txt":"2019-01-16 18:00:00"},{"dt":1547672400,"main":{"temp":287.864,"temp_min":287.864,"temp_max":287.864,"pressure":861.03,"sea_level":1021.98,"grnd_level":861.03,"humidity":65,"temp_kf":0},"weather":[{"id":800,"main":"Clear","description":"clear sky","icon":"01n"}],"clouds":{"all":0},"wind":{"speed":1.13,"deg":222.001},"rain":{},"sys":{"pod":"n"},"dt_txt":"2019-01-16 21:00:00"},{"dt":1547683200,"main":{"temp":283.907,"temp_min":283.907,"temp_max":283.907,"pressure":861.31,"sea_level":1022.77,"grnd_level":861.31,"humidity":85,"temp_kf":0},"weather":[{"id":800,"main":"Clear","description":"clear sky","icon":"01n"}],"clouds":{"all":0},"wind":{"speed":1.12,"deg":186.5},"rain":{},"sys":{"pod":"n"},"dt_txt":"2019-01-17 00:00:00"},{"dt":1547694000,"main":{"temp":281.694,"temp_min":281.694,"temp_max":281.694,"pressure":861.35,"sea_level":1023.48,"grnd_level":861.35,"humidity":86,"temp_kf":0},"weather":[{"id":800,"main":"Clear","description":"clear sky","icon":"01n"}],"clouds":{"all":0},"wind":{"speed":1.12,"deg":181.008},"rain":{},"sys":{"pod":"n"},"dt_txt":"2019-01-17 03:00:00"},{"dt":1547704800,"main":{"temp":291.978,"temp_min":291.978,"temp_max":291.978,"pressure":862.37,"sea_level":1023.47,"grnd_level":862.37,"humidity":63,"temp_kf":0},"weather":[{"id":800,"main":"Clear","description":"clear sky","icon":"01d"}],"clouds":{"all":0},"wind":{"speed":0.86,"deg":291.501},"rain":{},"sys":{"pod":"d"},"dt_txt":"2019-01-17 06:00:00"},{"dt":1547715600,"main":{"temp":302.986,"temp_min":302.986,"temp_max":302.986,"pressure":861.31,"sea_level":1020.52,"grnd_level":861.31,"humidity":27,"temp_kf":0},"weather":[{"id":800,"main":"Clear","description":"clear sky","icon":"01d"}],"clouds":{"all":0},"wind":{"speed":3.68,"deg":304.503},"rain":{},"sys":{"pod":"d"},"dt_txt":"2019-01-17 09:00:00"},{"dt":1547726400,"main":{"temp":306.04,"temp_min":306.04,"temp_max":306.04,"pressure":859.92,"sea_level":1017.99,"grnd_level":859.92,"humidity":15,"temp_kf":0},"weather":[{"id":800,"main":"Clear","description":"clear sky","icon":"01d"}],"clouds":{"all":0},"wind":{"speed":4.96,"deg":288.509},"rain":{},"sys":{"pod":"d"},"dt_txt":"2019-01-17 12:00:00"},{"dt":1547737200,"main":{"temp":305.67,"temp_min":305.67,"temp_max":305.67,"pressure":858.75,"sea_level":1016.36,"grnd_level":858.75,"humidity":12,"temp_kf":0},"weather":[{"id":800,"main":"Clear","description":"clear sky","icon":"01d"}],"clouds":{"all":0},"wind":{"speed":4.61,"deg":277.005},"rain":{},"sys":{"pod":"d"},"dt_txt":"2019-01-17 15:00:00"},{"dt":1547748000,"main":{"temp":296.48,"temp_min":296.48,"temp_max":296.48,"pressure":858.84,"sea_level":1017.45,"grnd_level":858.84,"humidity":22,"temp_kf":0},"weather":[{"id":800,"main":"Clear","description":"clear sky","icon":"01n"}],"clouds":{"all":0},"wind":{"speed":2.17,"deg":296.004},"rain":{},"sys":{"pod":"n"},"dt_txt":"2019-01-17 18:00:00"},{"dt":1547758800,"main":{"temp":288.5,"temp_min":288.5,"temp_max":288.5,"pressure":859.24,"sea_level":1019.31,"grnd_level":859.24,"humidity":64,"temp_kf":0},"weather":[{"id":800,"main":"Clear","description":"clear sky","icon":"01n"}],"clouds":{"all":0},"wind":{"speed":0.97,"deg":319.501},"rain":{},"sys":{"pod":"n"},"dt_txt":"2019-01-17 21:00:00"},{"dt":1547769600,"main":{"temp":285.236,"temp_min":285.236,"temp_max":285.236,"pressure":858.88,"sea_level":1019.4,"grnd_level":858.88,"humidity":64,"temp_kf":0},"weather":[{"id":800,"main":"Clear","description":"clear sky","icon":"01n"}],"clouds":{"all":0},"wind":{"speed":1.13,"deg":349.5},"rain":{},"sys":{"pod":"n"},"dt_txt":"2019-01-18 00:00:00"},{"dt":1547780400,"main":{"temp":282.706,"temp_min":282.706,"temp_max":282.706,"pressure":858.61,"sea_level":1019.58,"grnd_level":858.61,"humidity":63,"temp_kf":0},"weather":[{"id":800,"main":"Clear","description":"clear sky","icon":"01n"}],"clouds":{"all":0},"wind":{"speed":1.16,"deg":355.5},"rain":{},"sys":{"pod":"n"},"dt_txt":"2019-01-18 03:00:00"},{"dt":1547791200,"main":{"temp":296.722,"temp_min":296.722,"temp_max":296.722,"pressure":859.5,"sea_level":1019.68,"grnd_level":859.5,"humidity":19,"temp_kf":0},"weather":[{"id":800,"main":"Clear","description":"clear sky","icon":"01d"}],"clouds":{"all":0},"wind":{"speed":2.48,"deg":337.003},"rain":{},"sys":{"pod":"d"},"dt_txt":"2019-01-18 06:00:00"},{"dt":1547802000,"main":{"temp":305.454,"temp_min":305.454,"temp_max":305.454,"pressure":859.05,"sea_level":1017.4,"grnd_level":859.05,"humidity":13,"temp_kf":0},"weather":[{"id":800,"main":"Clear","description":"clear sky","icon":"01d"}],"clouds":{"all":0},"wind":{"speed":4.96,"deg":303.003},"rain":{},"sys":{"pod":"d"},"dt_txt":"2019-01-18 09:00:00"},{"dt":1547812800,"main":{"temp":307.006,"temp_min":307.006,"temp_max":307.006,"pressure":857.88,"sea_level":1015.51,"grnd_level":857.88,"humidity":12,"temp_kf":0},"weather":[{"id":800,"main":"Clear","description":"clear sky","icon":"01d"}],"clouds":{"all":0},"wind":{"speed":7.96,"deg":296.51},"rain":{},"sys":{"pod":"d"},"dt_txt":"2019-01-18 12:00:00"},{"dt":1547823600,"main":{"temp":305.412,"temp_min":305.412,"temp_max":305.412,"pressure":857.13,"sea_level":1014.87,"grnd_level":857.13,"humidity":11,"temp_kf":0},"weather":[{"id":800,"main":"Clear","description":"clear sky","icon":"01d"}],"clouds":{"all":0},"wind":{"speed":7.62,"deg":290.001},"rain":{},"sys":{"pod":"d"},"dt_txt":"2019-01-18 15:00:00"},{"dt":1547834400,"main":{"temp":299.097,"temp_min":299.097,"temp_max":299.097,"pressure":857.93,"sea_level":1017.17,"grnd_level":857.93,"humidity":12,"temp_kf":0},"weather":[{"id":800,"main":"Clear","description":"clear sky","icon":"01n"}],"clouds":{"all":0},"wind":{"speed":5.03,"deg":289.502},"rain":{},"sys":{"pod":"n"},"dt_txt":"2019-01-18 18:00:00"},{"dt":1547845200,"main":{"temp":292.469,"temp_min":292.469,"temp_max":292.469,"pressure":859.66,"sea_level":1020.54,"grnd_level":859.66,"humidity":15,"temp_kf":0},"weather":[{"id":800,"main":"Clear","description":"clear sky","icon":"01n"}],"clouds":{"all":0},"wind":{"speed":3.61,"deg":273.002},"rain":{},"sys":{"pod":"n"},"dt_txt":"2019-01-18 21:00:00"},{"dt":1547856000,"main":{"temp":289.091,"temp_min":289.091,"temp_max":289.091,"pressure":860.66,"sea_level":1023.37,"grnd_level":860.66,"humidity":34,"temp_kf":0},"weather":[{"id":800,"main":"Clear","description":"clear sky","icon":"01n"}],"clouds":{"all":0},"wind":{"speed":4.01,"deg":232.503},"rain":{},"sys":{"pod":"n"},"dt_txt":"2019-01-19 00:00:00"},{"dt":1547866800,"main":{"temp":284.864,"temp_min":284.864,"temp_max":284.864,"pressure":863.01,"sea_level":1027.44,"grnd_level":863.01,"humidity":72,"temp_kf":0},"weather":[{"id":800,"main":"Clear","description":"clear sky","icon":"01n"}],"clouds":{"all":0},"wind":{"speed":3.66,"deg":190.002},"rain":{},"sys":{"pod":"n"},"dt_txt":"2019-01-19 03:00:00"},{"dt":1547877600,"main":{"temp":284.752,"temp_min":284.752,"temp_max":284.752,"pressure":865.64,"sea_level":1030.21,"grnd_level":865.64,"humidity":69,"temp_kf":0},"weather":[{"id":500,"main":"Rain","description":"light rain","icon":"10d"}],"clouds":{"all":20},"wind":{"speed":6.16,"deg":184},"rain":{"3h":0.0275},"sys":{"pod":"d"},"dt_txt":"2019-01-19 06:00:00"},{"dt":1547888400,"main":{"temp":291.758,"temp_min":291.758,"temp_max":291.758,"pressure":865.63,"sea_level":1028.31,"grnd_level":865.63,"humidity":28,"temp_kf":0},"weather":[{"id":800,"main":"Clear","description":"clear sky","icon":"01d"}],"clouds":{"all":0},"wind":{"speed":6.17,"deg":171.505},"rain":{},"sys":{"pod":"d"},"dt_txt":"2019-01-19 09:00:00"},{"dt":1547899200,"main":{"temp":295.161,"temp_min":295.161,"temp_max":295.161,"pressure":865.54,"sea_level":1027.13,"grnd_level":865.54,"humidity":18,"temp_kf":0},"weather":[{"id":500,"main":"Rain","description":"light rain","icon":"10d"}],"clouds":{"all":0},"wind":{"speed":6.71,"deg":170},"rain":{"3h":0.005},"sys":{"pod":"d"},"dt_txt":"2019-01-19 12:00:00"},{"dt":1547910000,"main":{"temp":294.428,"temp_min":294.428,"temp_max":294.428,"pressure":865.98,"sea_level":1027.61,"grnd_level":865.98,"humidity":19,"temp_kf":0},"weather":[{"id":800,"main":"Clear","description":"clear sky","icon":"01d"}],"clouds":{"all":0},"wind":{"speed":6.81,"deg":166.003},"rain":{},"sys":{"pod":"d"},"dt_txt":"2019-01-19 15:00:00"},{"dt":1547920800,"main":{"temp":289.444,"temp_min":289.444,"temp_max":289.444,"pressure":868.17,"sea_level":1031.44,"grnd_level":868.17,"humidity":28,"temp_kf":0},"weather":[{"id":800,"main":"Clear","description":"clear sky","icon":"01n"}],"clouds":{"all":0},"wind":{"speed":6.22,"deg":156.001},"rain":{},"sys":{"pod":"n"},"dt_txt":"2019-01-19 18:00:00"},{"dt":1547931600,"main":{"temp":285.369,"temp_min":285.369,"temp_max":285.369,"pressure":870.41,"sea_level":1035.82,"grnd_level":870.41,"humidity":44,"temp_kf":0},"weather":[{"id":800,"main":"Clear","description":"clear sky","icon":"01n"}],"clouds":{"all":0},"wind":{"speed":6.01,"deg":147.003},"rain":{},"sys":{"pod":"n"},"dt_txt":"2019-01-19 21:00:00"},{"dt":1547942400,"main":{"temp":281.852,"temp_min":281.852,"temp_max":281.852,"pressure":870.56,"sea_level":1037.37,"grnd_level":870.56,"humidity":63,"temp_kf":0},"weather":[{"id":800,"main":"Clear","description":"clear sky","icon":"01n"}],"clouds":{"all":0},"wind":{"speed":5.57,"deg":144.002},"rain":{},"sys":{"pod":"n"},"dt_txt":"2019-01-20 00:00:00"},{"dt":1547953200,"main":{"temp":279.341,"temp_min":279.341,"temp_max":279.341,"pressure":870.22,"sea_level":1037.84,"grnd_level":870.22,"humidity":73,"temp_kf":0},"weather":[{"id":800,"main":"Clear","description":"clear sky","icon":"01n"}],"clouds":{"all":0},"wind":{"speed":3.83,"deg":137.502},"rain":{},"sys":{"pod":"n"},"dt_txt":"2019-01-20 03:00:00"},{"dt":1547964000,"main":{"temp":284.386,"temp_min":284.386,"temp_max":284.386,"pressure":870.75,"sea_level":1037.1,"grnd_level":870.75,"humidity":55,"temp_kf":0},"weather":[{"id":800,"main":"Clear","description":"clear sky","icon":"01d"}],"clouds":{"all":0},"wind":{"speed":4.96,"deg":129.502},"rain":{},"sys":{"pod":"d"},"dt_txt":"2019-01-20 06:00:00"},{"dt":1547974800,"main":{"temp":292.977,"temp_min":292.977,"temp_max":292.977,"pressure":869.99,"sea_level":1033.26,"grnd_level":869.99,"humidity":34,"temp_kf":0},"weather":[{"id":800,"main":"Clear","description":"clear sky","icon":"01d"}],"clouds":{"all":0},"wind":{"speed":4.91,"deg":129.01},"rain":{},"sys":{"pod":"d"},"dt_txt":"2019-01-20 09:00:00"},{"dt":1547985600,"main":{"temp":298.528,"temp_min":298.528,"temp_max":298.528,"pressure":868.14,"sea_level":1029.85,"grnd_level":868.14,"humidity":23,"temp_kf":0},"weather":[{"id":800,"main":"Clear","description":"clear sky","icon":"01d"}],"clouds":{"all":0},"wind":{"speed":3.67,"deg":134.503},"rain":{},"sys":{"pod":"d"},"dt_txt":"2019-01-20 12:00:00"},{"dt":1547996400,"main":{"temp":298.665,"temp_min":298.665,"temp_max":298.665,"pressure":867.2,"sea_level":1028.24,"grnd_level":867.2,"humidity":19,"temp_kf":0},"weather":[{"id":800,"main":"Clear","description":"clear sky","icon":"01d"}],"clouds":{"all":0},"wind":{"speed":4.01,"deg":151.007},"rain":{},"sys":{"pod":"d"},"dt_txt":"2019-01-20 15:00:00"},{"dt":1548007200,"main":{"temp":292.261,"temp_min":292.261,"temp_max":292.261,"pressure":867.7,"sea_level":1029.86,"grnd_level":867.7,"humidity":27,"temp_kf":0},"weather":[{"id":800,"main":"Clear","description":"clear sky","icon":"01n"}],"clouds":{"all":0},"wind":{"speed":3.57,"deg":150},"rain":{},"sys":{"pod":"n"},"dt_txt":"2019-01-20 18:00:00"},{"dt":1548018000,"main":{"temp":284.219,"temp_min":284.219,"temp_max":284.219,"pressure":868.52,"sea_level":1032.25,"grnd_level":868.52,"humidity":65,"temp_kf":0},"weather":[{"id":800,"main":"Clear","description":"clear sky","icon":"01n"}],"clouds":{"all":0},"wind":{"speed":1.61,"deg":159},"rain":{},"sys":{"pod":"n"},"dt_txt":"2019-01-20 21:00:00"},{"dt":1548028800,"main":{"temp":280.043,"temp_min":280.043,"temp_max":280.043,"pressure":867.88,"sea_level":1032.72,"grnd_level":867.88,"humidity":79,"temp_kf":0},"weather":[{"id":800,"main":"Clear","description":"clear sky","icon":"01n"}],"clouds":{"all":0},"wind":{"speed":1.21,"deg":187.002},"rain":{},"sys":{"pod":"n"},"dt_txt":"2019-01-21 00:00:00"},{"dt":1548039600,"main":{"temp":277.948,"temp_min":277.948,"temp_max":277.948,"pressure":867.5,"sea_level":1032.99,"grnd_level":867.5,"humidity":84,"temp_kf":0},"weather":[{"id":800,"main":"Clear","description":"clear sky","icon":"01n"}],"clouds":{"all":0},"wind":{"speed":1.15,"deg":166.502},"rain":{},"sys":{"pod":"n"},"dt_txt":"2019-01-21 03:00:00"},{"dt":1548050400,"main":{"temp":289.474,"temp_min":289.474,"temp_max":289.474,"pressure":867.57,"sea_level":1031.27,"grnd_level":867.57,"humidity":42,"temp_kf":0},"weather":[{"id":800,"main":"Clear","description":"clear sky","icon":"01d"}],"clouds":{"all":0},"wind":{"speed":1.66,"deg":38.5058},"rain":{},"sys":{"pod":"d"},"dt_txt":"2019-01-21 06:00:00"}],"city":{"id":976358,"name":"Middelburg","coord":{"lat":-31.4929,"lon":25.0063},"country":"ZA","population":18164}}

(Alex) #9

This means you will get a forecast for 5 days = 120 hours, in 3 hours incremental steps.

So you have to fill 120 hours and 0 days in your config.


(Allen) #10

ok how would I then get say day 2 forecast out of the string ?


(Chris) #11

@5iver made a workaround here


(Alex) #12

Example:

You will get up to 8 different values for tomorrow (24/3=8), e.g.

21,22,23,24,21,26,27,28 (which value is the correct one for tomorrow?) You have to calculate the average (=24)

Your max value will be 28, but how will you know?

Then you should use this, like @momo90 mentioned above:


Weather OpenWeatherMap
(Scott Rushworth) #13

Also, the temp_max and temp_min in the forecast are not the high/low temps for the day. They are the max and min temps within the city, since there could be a temp difference depending on where you are. You won’t see much difference between these and the temp.

If you wait an hour or so, I’ll be pushing an update with some more features!


(Allen) #14

I will wait. I am anyway at work and will only have time to play tonight


(Dan) #15

Lot’s of feedback, thank you everyone
@namraccr - nothing helpful in the openhab.log
@celaeno1 - number of days is 0, if i change it to 5 the thing goes offline
@momo90 - thank you for that clarification
@celaeno1 - I have the free account which includes up to 5 days of free forecast, I can call the API directly and get forecast data
@allen - & @celaeno1 - i think this is the missing link, i thought the forecast was up to 5 days in days but as you pointed out I think its really 5 days in 3 hour increments which is why it isn’t working for me, I need to use the hourly forecast data

I’ll look into the @5iver posted work around. Thanks everyone for pointing me in the right direction on this