New OpenWeatherMap API

175 views
Skip to first unread message

JanPedaal

unread,
Oct 15, 2015, 10:25:06 AM10/15/15
to WebSolarLog
Hi,
Recently it appears OWM changed its API. I am having trouble retrieving weather data.
One of the changes is, you need an API key to connect. It is free (at the moment) to subscribe and get an API key, so that's what I did. It needs to be included in the API call by inserting "&APPID=", followed by the key which is a 32 byte string.

My API call looks like:

The info received is (apparently) different than before, because WSL is having a hard time understanding:
20151015 154854 debug onDebug - WeatherOWM::getData::Looks like we didn't receive useful weather data::stdClass Object (     [coord] => stdClass Object         (             [lon] => 5.04             [lat] => 52.31         )      [weather] => Array         (             [0] => stdClass Object                 (                     [id] => 501                     [main] => Rain                     [description] => moderate rain                     [icon] => 10d                 )          )      [base] => cmc stations     [main] => stdClass Object         (             [temp] => 281.39             [pressure] => 1019             [humidity] => 87             [temp_min] => 279.82             [temp_max] => 283.71         )      [wind] => stdClass Object         (             [speed] => 2.1             [deg] => 20         )      [rain] => stdClass Object         (             [1h] => 1.14         )      [clouds] => stdClass Object         (             [all] => 75         )      [dt] => 1444916671     [sys] => stdClass Object         (             [type] => 1             [id] => 5204             [message] => 0.0046             [country] => NL             [sunrise] => 1444889115             [sunset] => 1444927497         )      [id] => 2744903     [name] => Gemeente Weesp     [cod] => 200 ) 
20151015 154854 debug onDebug - OTHER error (8) in /usr/share/nginx/www/websolarlog/classes/devices/WeatherOWM.php [101] :: Trying to get property of non-object

Any suggestions how to fix this?

André M.

unread,
Oct 18, 2015, 8:34:30 AM10/18/15
to WebSolarLog
I don't have a solution but I would like to get one!
Without the weather data pvoutput doesn't log the temps any more.
This is very useful and the 'empty' weather block in Wsl is not so nice.
André

JanPedaal

unread,
Oct 19, 2015, 4:02:09 AM10/19/15
to WebSolarLog
At the moment I am receiving weather data again, although not all data fields I think (city name is missing).


My api call in the communication manager looks like:

Make sure you replace {APIKEY} with your own key.

André M.

unread,
Oct 19, 2015, 4:45:57 AM10/19/15
to WebSolarLog
I can't go into admin from my work location, I'll try this tonight.
At least the weather data is back this way and it looks correct to me.
André

Nico Bogaert

unread,
Oct 20, 2015, 6:21:22 AM10/20/15
to WebSolarLog
I tried it as well, but it only updated for a few minutes this morning, then it stopped updating. I will have a look at the logs tonight (should be working :) ) to find out what is wrong. The test page says "failure" anyway, but it came through in the beginning.

I also noticed that it should be units=metric according to the API page of openweathermap, not units=metrics. Not sure if this is relevant because in the test page, I see that if you change it to "metric", WSL is subtracting 273°C so it is actually already taking into account it gets input in Kelvin. (So i think this can be removed but I am not touching anything right now until I understand where it is failing to update).

JanPedaal

unread,
Oct 20, 2015, 7:23:57 AM10/20/15
to WebSolarLog
Hi Nico,
I have a test failure as well, but the weather data seem to be retrieved anyway.
The WSL page here says "metrics" but it sounds more logical to use "metric".
I can't look up the OWM documentation as the OWM site is down at the moment (which could also be a reason you are not getting any weather data).


André M.

unread,
Dec 10, 2015, 9:05:02 AM12/10/15
to WebSolarLog
I had the problem of no data displaying on the front-end, I found out that the Weather device had not ticked the show weather data on the front-end.
Further I added a free api key and now it works again!
The units and metrics things are not needed to show correct weather data.
André

oosterlo

unread,
Jul 26, 2016, 3:35:50 PM7/26/16
to WebSolarLog
Hi,
I am trying to include openweathermap.
the URI I'm using in the communication  is = http://api.openweathermap.org/data/2.5/find?units=metrics&cnt=1&mode=json&APPID={mijn ID bij openweathermap}.
when I test the communication i get next result data:

Weather Object
(
    [id] => 
    [deviceId] => -1
    [time] => 1469561212
    [temp] => 20.73
    [temp_min] => 19
    [temp_max] => 23.33
    [pressure] => 1020
    [humidity] => 68
    [conditionId] => 803
    [rain1h] => 
    [rain3h] => 
    [clouds] => 80
    [wind_speed] => 1.5
    [wind_direction] => 310
)
the test result is 'failure'.
In the dashboard I get next result:

Can soimebody help me?
Paul

Auto Generated Inline Image 1

André M.

unread,
Jul 26, 2016, 4:59:59 PM7/26/16
to WebSolarLog

oosterlo

unread,
Jul 27, 2016, 10:33:58 AM7/27/16
to WebSolarLog
André,
with the new URI the same result/
I am not sure about:
- filling in the port in the communication section: none or 81 or ???
- the address is automatically filled in as "2". Is this correct?

Paul

JanPedaal

unread,
Jul 28, 2016, 3:39:52 AM7/28/16
to WebSolarLog
Hi Paul,
I use the same URI as you did, and it still works. Which address do you mean? I have filled in only name and uri, and it works. Port field is empty.

oosterlo

unread,
Jul 28, 2016, 4:49:46 AM7/28/16
to WebSolarLog
Hi Jan,
When test the communication, the following text is displayed. the fields name and address are automatically filled in. In the field 'address' the number 2 is filled in.

Test this communication on a device
name
address
device APIOpen-Weather-Map

André M.

unread,
Jul 28, 2016, 5:17:15 AM7/28/16
to WebSolarLog

I gave the comm a name and there is no 2 in my address field.
The api test fails, but it works fine.
It is still a kind of horror to me to see Select AN device :-(
I have access to the website with Wordpress, so I could correct most errors in the WSL pages.
The menu structure is a different story, I don' t know how to come there.
Message has been deleted

JanPedaal

unread,
Jul 28, 2016, 8:58:26 AM7/28/16
to WebSolarLog
I get a test failure as well, but the weather data is loaded fine:

Note that adress = 2 is filled in here automatically as well.


Weather info looks like:







Reply all
Reply to author
Forward
Message has been deleted
0 new messages