warningsUSRegions Block Stopped Working

Post Reply
User avatar
dmgould
Forecaster
Forecaster
Posts: 173
Joined: Sat Aug 26, 2017 2:43 am
Location: Divide, Colorado, USA
Station model: Davis Pro 2 Plus Wireless
Software: Meteobridge
Contact:

warningsUSRegions Block Stopped Working

Post by dmgould » Tue Mar 12, 2024 12:33 am

Anyone else? It looks like NWS changed how to "get" the warnings, but it might just be on my end. I'm just checking to be sure. So far I haven't figured out a fix.
Dave G
Image

Bigbaywx
Observer
Observer
Posts: 23
Joined: Mon Jun 22, 2020 8:47 pm
Station model: Davis Vantate Pro2
Software: weatherlink data logger

Re: warningsUSRegions Block Stopped Working

Post by Bigbaywx » Mon Apr 01, 2024 7:59 pm

Same on my website as well. Another block on the fritz. Right now we have a winter storm watch and the main page still showing no watches, warnings or advisories.

enephler
Observer
Observer
Posts: 17
Joined: Mon Sep 04, 2017 9:49 pm
Location: L'Anse, MI USA
Station model: Davis Pro2
Software: Meteobridge
Contact:

Re: warningsUSRegions Block Stopped Working

Post by enephler » Tue Apr 02, 2024 11:01 am

Correct, my warnings are not working either. We're under a winter storm warning in Baraga County, MI.
Is there any fix for this?

rogers
Observer
Observer
Posts: 10
Joined: Sun Aug 20, 2017 8:10 pm
Location: Lindale, GA USA
Contact:

Re: warningsUSRegions Block Stopped Working

Post by rogers » Thu Apr 04, 2024 10:23 am

Same here...no idea how to look for the error in the code. It does not error out on the block, it just always shows "no current warnings".

User avatar
dmgould
Forecaster
Forecaster
Posts: 173
Joined: Sat Aug 26, 2017 2:43 am
Location: Divide, Colorado, USA
Station model: Davis Pro 2 Plus Wireless
Software: Meteobridge
Contact:

Re: warningsUSRegions Block Stopped Working

Post by dmgould » Thu Apr 04, 2024 3:04 pm

This is the code in the block that gets the warning data. Substitute ".$location." with your zone code you have listed in your block setup.

https://alerts.weather.gov/cap/wwaatmge ... ion."&?y=0

For example using my county zone code it would be:

https://alerts.weather.gov/cap/wwaatmge ... OC119&?y=0

That displays the information on the NWS Alerts page, but it no longer brings the information to the block. I believe they have changed over to using an api for alerts. Changing the block code to use the api is beyond my php abilities at this point. Following the api URL listed for my zone code seems to be leading toward the warning data. For my county it would be:

https://api.weather.gov/alerts/active.atom?zone=COC119

Maybe this will help someone that's more familiar with php than I am at this point in time to find a fix.
Dave G
Image

enephler
Observer
Observer
Posts: 17
Joined: Mon Sep 04, 2017 9:49 pm
Location: L'Anse, MI USA
Station model: Davis Pro2
Software: Meteobridge
Contact:

Re: warningsUSRegions Block Stopped Working

Post by enephler » Thu Apr 04, 2024 6:33 pm

I've noticed the same, but I'm not proficient enough in PHP to make it work.
dmgould wrote: Thu Apr 04, 2024 3:04 pm This is the code in the block that gets the warning data. Substitute ".$location." with your zone code you have listed in your block setup.

https://alerts.weather.gov/cap/wwaatmge ... ion."&?y=0

For example using my county zone code it would be:

https://alerts.weather.gov/cap/wwaatmge ... OC119&?y=0

That displays the information on the NWS Alerts page, but it no longer brings the information to the block. I believe they have changed over to using an api for alerts. Changing the block code to use the api is beyond my php abilities at this point. Following the api URL listed for my zone code seems to be leading toward the warning data. For my county it would be:

https://api.weather.gov/alerts/active.atom?zone=COC119

Maybe this will help someone that's more familiar with php than I am at this point in time to find a fix.

User avatar
MonyMony
Forecaster
Forecaster
Posts: 184
Joined: Sun Aug 20, 2017 12:54 pm
Location: Elkton, Maryland, US
Station model: Davis Pro 2
Software: WeatherCat/Meteobridge
Contact:

Re: warningsUSRegions Block Stopped Working

Post by MonyMony » Tue May 14, 2024 9:26 pm

Hello All,

Back in 2021, I posted how I created a custom block to utilize the NWS Alert script developed by Saratoga-weather.org. I have updated my provided zip file that can be used to create a block on your page. Just make sure update the variables listed below to match your website and regional settings. I hope this will help!

DOWNLOAD - https://www.cecilweather.com/weather/ce ... s_v1.2.zip
MonyMony wrote: Sat Jan 02, 2021 1:45 am
I did take the code you posted for the Saratoga National Weather Service Alerts and made some modification to better integrate it into Meteotemplate. The updated block can be downloaded by going to https://www.cecilweather.com/weather/ce ... s_v1.2.zip and installed just like any other Meteotemplete block.

To make this work, the nws-alerts-config.php file needs to be directly edited. I did the following updates in this file to make this work well within Meteotemplate:
  • $myZC - with the wanted zones by getting codes from alerts.weather.gov
  • $ourTZ - with the current time zone
  • $cacheFileDir - directory with the alerts cache is stored.
  • $icons_folder - directory for the icons are stored
  • $blockpath - this is something customized for Meteotemplete. This is the path where this block resides on your website.
  • $alertURL - path to where the nws-details.php file is located
  • $summaryURL - path to where the nws-summary.php file is located
The rest of the variables should also be checked and adjusted as needed. Particularly if you are going to retrieve more than a couple zones then you should set the $noCron to FALSE and setup a CRON job. If anyone is reading this wondering how all this works, please check out the README file included in the zip as it contains all of the details from Saratoga-weather.org who get all of the credit for developing this script. I also left my settings in the nws-alerts-config.php file to be used as a guide. Hope this helps!

You can view the updates in action by going to my site - https://www.cecilweather.com. I would say PM me if you have questions but I might not be able to reply back privately.
Image

rogers
Observer
Observer
Posts: 10
Joined: Sun Aug 20, 2017 8:10 pm
Location: Lindale, GA USA
Contact:

Re: warningsUSRegions Block Stopped Working

Post by rogers » Thu May 16, 2024 7:24 pm

MonyMony,

That worked out great, Thanks!

Steve

Post Reply