Frost Warnings

  • 1
  • Question
  • Updated 5 years ago
Using the API, is there a way to either retrieve a frost warning OR retrieve the following day's minimum temperature forecast?

Paul
Photo of Paul Reed

Paul Reed

  • 23 Posts
  • 7 Reply Likes

Posted 5 years ago

  • 1
Photo of WunderWilliam

WunderWilliam

  • 267 Posts
  • 18 Reply Likes
The alerts don't have a specific frost category, but they can appear in the weather advisories. But you could certainly do a forecast for the day's low.

The API will just send data; there are no "or" commands built into it that would save a call.
Photo of Paul Reed

Paul Reed

  • 23 Posts
  • 7 Reply Likes
Thank you, I can't see where I can call a JSON feed from to retrieve tomorrows predicted low? I am currently getting observation data from a pws - IFINNING3, but 'tomorrows low' does not form part of the data set. Can I use the api to get this information anywhere?
If I can, then I can code an alarm to trigger if its less than 3 degrees.
Photo of WunderWilliam

WunderWilliam

  • 267 Posts
  • 18 Reply Likes
If you do a forecast call, like this:

http://api.wunderground.com/api/__you...

...each period will have both high and low, like this:

},
"period":1,
"high": {
"fahrenheit":"63",
"celsius":"17"
},
"low": {
"fahrenheit":"41",
"celsius":"5"
},
Photo of Paul Reed

Paul Reed

  • 23 Posts
  • 7 Reply Likes
Thanks William, I can retrieve the data OK from a browser call, but have spent hours trying to parse the data without success. I would appreciate any help.

$tomorrows_low = $parsed_json->{'forecast'}->{'simpleforecast'}->{'forecastday'}->{'period'}[1]->{'low'}->{'celsius'};

Returns;
PHP Notice: Trying to get property of non-object in /home/pi/myscripts/old_weather.php on line 9
Photo of Paul Reed

Paul Reed

  • 23 Posts
  • 7 Reply Likes
Well, 3hrs later...
I think that the code is:
$lowtemp = $parsed_json->{'forecast'}->{'simpleforecast'}->{'forecastday'}[3]->{'low'}->{'celsius'};

Not totally sure if forecastday'}[3] relates to the following night.....