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: 24
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: 12
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: 189
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: 12
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

armyslowrdr
Newbie
Newbie
Posts: 1
Joined: Wed Feb 07, 2024 11:42 pm
Station model: Davis Vantage Pro 2
Software: Cumulus

Re: warningsUSRegions Block Stopped Working

Post by armyslowrdr » Tue Jun 04, 2024 10:15 pm

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.

User avatar
Dehatter
Professional
Professional
Posts: 350
Joined: Sun Jan 07, 2018 5:11 am
Location: Matthews, NC, USA
Station model: Ecowitt WH80
Software: Ecowitt GW1000
Contact:

Re: warningsUSRegions Block Stopped Working

Post by Dehatter » Tue Feb 18, 2025 5:26 pm

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
Image

andyk1
Professional
Professional
Posts: 432
Joined: Tue Feb 27, 2018 10:56 pm
Location: OKLAHOMA, USA
Station model: Ecowitt WS90
Software: Meteobridge/GW2000B
Contact:

Re: warningsUSRegions Block Stopped Working

Post by andyk1 » Mon May 26, 2025 7:10 am

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
Image

livefeed
Observer
Observer
Posts: 25
Joined: Sat Jan 26, 2019 6:05 am
Location: Lusby, MD
Station model: Davis pro 2
Software: Meteobridge
Contact:

Re: warningsUSRegions Block Stopped Working

Post by livefeed » Mon Jun 30, 2025 9:35 pm

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!
Image

Post Reply