Page 1 of 1

warningsUSRegions Block Stopped Working

Posted: Tue Mar 12, 2024 12:33 am
by dmgould
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.

Re: warningsUSRegions Block Stopped Working

Posted: Mon Apr 01, 2024 7:59 pm
by Bigbaywx
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.

Re: warningsUSRegions Block Stopped Working

Posted: Tue Apr 02, 2024 11:01 am
by enephler
Correct, my warnings are not working either. We're under a winter storm warning in Baraga County, MI.
Is there any fix for this?

Re: warningsUSRegions Block Stopped Working

Posted: Thu Apr 04, 2024 10:23 am
by rogers
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".

Re: warningsUSRegions Block Stopped Working

Posted: Thu Apr 04, 2024 3:04 pm
by dmgould
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.

Re: warningsUSRegions Block Stopped Working

Posted: Thu Apr 04, 2024 6:33 pm
by enephler
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.

Re: warningsUSRegions Block Stopped Working

Posted: Tue May 14, 2024 9:26 pm
by MonyMony
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.

Re: warningsUSRegions Block Stopped Working

Posted: Thu May 16, 2024 7:24 pm
by rogers
MonyMony,

That worked out great, Thanks!

Steve

Re: warningsUSRegions Block Stopped Working

Posted: Tue Jun 04, 2024 10:15 pm
by armyslowrdr
Wow that seems complex. I will need a free day with nothing on my mind to contemplate that. I just need Bell, Williamson, Travis, and Coryell Counties in TX. Maybe I will wait ontil this fall/winter and see if the block gets updated,

OTOH the fix to get the forecast icons working on the nwsRegionalForecast block was super simple!

Still not on user map/list either on the meteotemplate home page.

Re: warningsUSRegions Block Stopped Working

Posted: Tue Feb 18, 2025 5:26 pm
by Dehatter
I was not aware of the block not working.

This substitute worked out great except for a couple of issues.
Please follow the directions in the post.

Issue #1: Code not readily available from that specific link any longer BUT there are there. you have to dig to "Land areas with zones" DO NOT CLICK YOUR STATE NAME!!! Click "Public Zones" in your state's row and you can get the Zone Code. Then you have to start over and the next time click "County Zones" in your state's row to get the County Code. Now you can populate the $myZC string in nws-alerts-config.php.

Issue #2: You have to remove the remark lines in the $myZC string selection or you will get a warning to use a cron. If you have more than 4 areas this does not matter as you will be using a cron anyway.

Issue #3: You will still get the header for Cecil County etc. You have to edit nwsBlock.php - line 32 and put your county in the header string or your warning will show for Cecil County etc even though the warnings displayed are yours.

Otherwise - this works great!!

Tom

Re: warningsUSRegions Block Stopped Working

Posted: Mon May 26, 2025 7:10 am
by andyk1
Tom, I haven't been on in awhile myself. Did you get it working as your website isn't listing anymore either. Not sure how much longer I'm going to keep mine up. How you been?, long time no talk...

Andy

Re: warningsUSRegions Block Stopped Working

Posted: Mon Jun 30, 2025 9:35 pm
by livefeed
Tom and MonyMony, Thank you very much for this, got it working. - Tom, I am not a million miles from you I am down in Calvert Co!