Go for it my friend !!!
I think hours you are thinking are fine ! … are you going to share ? I will invite you a couple of
Yes, there were a few other posts where people are querying the various Open Weather APIs.
Here’s a few reference threads:
Edit: I can’t seem to find it now, but someone had also recently done something with the Open Weather API and they were using the new expressions feature. @Jason_K_Jennings was that perhaps you?
Check out the last link in my reply above. In that thread, @JKB121 was using the ‘OneCall’ API endpoint from OpenWeather which also has forecast data. OneCall used to be available with a free account – it still is, but now it requires that you add a credit card even if you still set your daily limit within the free allotment.
Thanks Josh !..I think… I need a guide for dummies, anyway I will fool around a bit to find it how …
Works great. Haven’t had a charge yet… LOL
Thanks, no use reinventing the wheel.
Oooohhh Im getting !.. how can I know all the “value using expression” I can get from openweather ? b.e. I can see: “data.daily.0.temp.max” and “…min”… which others ? THANKS !
Check out OpenWeatherMap API guide - OpenWeatherMap
There are about 1700 line items that are returned with the API call. Basically anything you can imagine is there.
thanks my friend…You rock !!
Hi my friend. This is really cool…I had made some attempts with that…and it works for:
- round($context.response.data.current.temp)
- round($context.response.data.daily.0.temp.min)
- round($context.response.data.daily.0.temp.max)
And they work !!.. but I had not got set next ones, Sharptools variables are text type, but they are set to blanks when rule is triggered, do you know why ?:
- $context.response.data.current.weather.description
- $context.response.data.daily.weather.description
In other idea the “0” value in .daily.0 expression is referred to number of the day ? …how can I get temperature o weather forecasting for next day ?
THANKS !
Based on their sample data, it looks like the current weather is nested within an array.
{
"lat": 39.31,
"lon": -74.5,
"timezone": "America/New_York",
"timezone_offset": -18000,
"current": {
"dt": 1646318698,
"sunrise": 1646306882,
"sunset": 1646347929,
"temp": 282.21,
"feels_like": 278.41,
"pressure": 1014,
"humidity": 65,
"dew_point": 275.99,
"uvi": 2.55,
"clouds": 40,
"visibility": 10000,
"wind_speed": 8.75,
"wind_deg": 360,
"wind_gust": 13.89,
"weather": [
{
"id": 802,
"main": "Clouds",
"description": "scattered clouds",
"icon": "03d"
}
]
},
Notice that immediately after "weather":
there is a [
which indicates an array. That means you would need something like the following to grab the first array item.
$context.response.data.current.weather.0.description
Like the above, the 0
is referring to the position of the item within the array. Arrays start at ‘0’ rather than ‘1’. You can find more details on how properties are accessed from objects in this thread.
Thanks Josh… I will play around with it while enjoy the World Cup !!
Don’t know if this is relevant here, but Todd Austin has made an Edge weatherstation.
The catch is it needs his edgebridge running on a server to link to an API. Since I have my camera server running and also using his phone presence app, I added this one as well. Simply use it in a rule or create a tile with the relevant info…
This is a long shot from me !!
$context.response.data.daily.0.weather.0.description
Nested array !
That looks right.
For future reference here is an example of the data found under each of the 9 days of DAILY data provided by the OneCall API.
"daily": [
{
"dt": 1669662000,
"sunrise": 1669647705,
"sunset": 1669682682,
"moonrise": 1669665600,
"moonset": 1669701420,
"moon_phase": 0.18,
"temp": {
"day": 55.92,
"min": 46.11,
"max": 58.71,
"night": 46.11,
"eve": 57.33,
"morn": 47.46
},
"feels_like": {
"day": 53.65,
"night": 45.1,
"eve": 55.06,
"morn": 46.38
},
"pressure": 1014,
"humidity": 52,
"dew_point": 38.05,
"wind_speed": 6.89,
"wind_deg": 157,
"wind_gust": 11.63,
"weather": [
{
"id": 803,
"main": "Clouds",
"description": "broken clouds",
"icon": "04d"
}
],
"clouds": 81,
"pop": 0.06,
"uvi": 1.78
},
This is what I use.
{{$context.response.data.daily.1.weather.0.description}}
I should have been clear that I was referring to the format only. The number after daily should correspond to the day for data is wanted.
This is really cool !.. I got this weather report ready to send it to Alexa or Pushover message…
“At this moment there is 20 C. For today there will be scattered clouds and a mild weather, with a minimum of 14 C and a maximum of 22 C. Enjoy your day.”
I will be to make the same but for a night report for next day weather …
Would you mind sharing your http string for pulling the today, tonight and tomorrow reports? All I seem to get is “scattered clouds”, “sunny” etc.