Thank you again Bill.
I managed it with the Dark Sky script by changing line 26 to var forecastUrl = “https://api.darksky.net/forecast/” + apiKey + “/” + latitude + “,” + longitude + “?exclude=minutely,hourly,flag,lang=zh-tw&units=si”
Trying to set up some weather status on a page, using the openweather plugin.
I can display the current temperature in a label, but would also like to display the current weather icon. I added a webimage control with source CurrentWeather.Icon
It does not display anything, but in the log it does show “weather icon: http://openweathermap.org/img/wn/04n@4x.png”. If I put that actual URL in the source it works.
That’s the wrong attribute. You need to set the source to CurrentWeather.WeatherIcon
. CurrentWeather.Icon
is the common device object icon attribute that all objects have.
Thanks! I should have noticed the other attribute…
Hi All, I’ve installed the weather plugin, I added the API key and longitudinal and attitude, I then created a Label with the appropriate device bindings but nothing appears! Any help would be very much appreciated.
Replace LATITUDE LONGITUDE and APIKEY below with your correct info and then paste that link into your browser and tell me if it returns good info.
https://api.openweathermap.org/data/2.5/onecall?units=imperial&lat=LATITUDE&lon=LONGITUDE&appid=APIKEY
I get this, but I’m copying and pasting the API key from the email I got from OpenWeater so I know it’s correct.
{“cod”:401, “message”: “Invalid API key. Please see Frequently Asked Questions - OpenWeatherMap for more info.”}
If I use this then it’s ok
http://api.openweathermap.org/data/2.5/weather?q=London,uk&APPID=
And I get this
{“coord”:{“lon”:-0.1257,“lat”:51.5085},“weather”:[{“id”:801,“main”:“Clouds”,“description”:“few clouds”,“icon”:“02n”}],“base”:“stations”,“main”:{“temp”:292.68,“feels_like”:292.49,“temp_min”:290.25,“temp_max”:293.76,“pressure”:1014,“humidity”:69},“visibility”:10000,“wind”:{“speed”:3.6,“deg”:100},“clouds”:{“all”:14},“dt”:1662326766,“sys”:{“type”:2,“id”:2075535,“country”:“GB”,“sunrise”:1662268666,“sunset”:1662316911},“timezone”:3600,“id”:2643743,“name”:“London”,“cod”:200}
I tried it and got success with both links. Can you post the exact link you are using with only the api key removed? When you do, highlight the link and choose the “preformatted text” option in the message options here for this forum (it’s the icon to the right of the large quotes.
Sorry didn’t realise.
https://api.openweathermap.org/data/2.5/onecall?units=imperial&lat=51.340402&lon=0.731596&appid=
I tried it and it worked for me, so this must be one of two things.
-
Since you’re not posting the entire request here because it would not be good to share your api key, the issue could still lie with your request. Make sure that after
appid=
you do not have any spaces or quotes. Your request should look likehttps://api.openweathermap.org/data/2.5/onecall?units=imperial&lat=51.340402&lon=0.731596&appid=a1b1c1d1
. Also when you paste it in your browser, scroll to the end of what you pasted after you press enter and make sure there are no characters after the last character in your api key. If there’s an accidental space, it could show%20
after your api key which could cause the request to fail. -
There’s an issue with your api key. I know you were able to successfully use your api key in a different request so it seems that it works, but I don’t know enough to know if it’s still not an issue. Does openweathermap limit certain api keys to certain functions? Consider trying to add another api key and use it. If you login to the openweathermap website, under your account, you should be able to add another api key.
Unfortunately, this is as far as my knowledge base goes. Hopefully you get it figured out or someone else chimes in. Please report back and let us know.
Hi, I did already checked those possibilities and tried a new API key but still nothing.
I do have a free account is that the limitation why it’s not working?
No, unless it’s changed. I am using the free account.
I’ve kept this thread in mind because I knew someday my DarSky plugin would stop working… Looks like I’ve got about 3 months (March 31st 2023) until the DarkSky switch is flipped. I’m going to see it to the end and go down with the ship. lol
Hi everyone,
Now that the DarkSky plugin has officially sunset, I thought I’d try to make the OpenWeather plugin work. Is it working for anyone ?
I’m having the same issue as colhemm where:
This doesn’t work:
https://api.openweathermap.org/data/2.5/onecall?units=imperial&lat=LATITUDE&lon=LONGITUDE&appid=APIKEY
But this works:
http://api.openweathermap.org/data/2.5/weather?q=London,uk&appid=APIKEY
Thanks,
M.
I just tried the example you give of “this doesn’t work” above and it still works for me. Very strange. If I were you, I would dig in to their API docs, and then if I didn’t uncover anything try to contact them and see if you get a response.
Could it be a regional thing? Try my lat/lon and see if you get a response
https://api.openweathermap.org/data/2.5/onecall?units=imperial&lat=35.682789&lon=-97.348061&appid=
Doesn’t work. Very odd, looks like any additional parameters such as units, or oncall or lat, … generates an error.
Also, for my call, I get this output. Does that seem like enough parameters for the plugin to be functional ? I don’t have a paid subscription btw, could this be the problem ?
{“coord”:{“lon”:-0.1257,“lat”:51.5085},“weather”:[{“id”:803,“main”:“Clouds”,“description”:“broken clouds”,“icon”:“04n”}],“base”:“stations”,“main”:{“temp”:282.45,“feels_like”:279.81,“temp_min”:280.94,“temp_max”:284.14,“pressure”:1001,“humidity”:82},“visibility”:10000,“wind”:{“speed”:5.14,“deg”:290},“clouds”:{“all”:75},“dt”:1682277371,“sys”:{“type”:2,“id”:268730,“country”:“GB”,“sunrise”:1682225318,“sunset”:1682276927},“timezone”:3600,“id”:2643743,“name”:“London”,“cod”:200}
Thank you.
I think I see the problem. There are actually two types of API calls, one being the older 2.5 version, and the other being the “onecall” 3.0 version. Even though they use the same API key, OpenWeatherMap has to enable the API key they give you separately for the 2.5 or 3.0 calls. Also note that the syntax of the URL is slightly different between the two types, and the results are also slightly different (3.0 returns more stuff). Getting a 3.0 enabled API key also requires the registration of a payment capability, but allows for quite a lot of requests for free.
Check the OpenWeatherMap site (api page) for more information on pricing and the differences between the two types of API calls.
Hello, I’m curious if you were able to get this figured out. I’m at the same place where your 1st link returns an error but the 2nd link works. That said, nothing from the 2nd link populates in the app.
Thanks!
OpenWeatherMap is retiring version 2.5 in June 2024. I have made the changes to the plugins which are in the first post, but you will need to get a new API key. They require you to put a credit card on file and will give you the first 1,000 api calls per day for free, then charge you for subsequent api calls. You can put an api call limit in your settings, so if you limit them to 1,000, then you should never get charged.
Get your new API key and update it in this new plugin. After you sign up for it, it can take up to 24 hours for it to take effect. All instructions are in the first post.