National Weather Service Integration |
Top Previous Next |
Requirements: GetAscii, Filter Pack
The NWS (National Weather Service) provides a live feed of public alerts based on state, zone and county at their website https://alerts.weather.gov/
PageGate can be configured to routinely poll the NWS for weather alerts in any area of interest and automatically trigger notifications, alerts and messages based on them.
To start, we'll need to create a few directories. While they can reside anywhere, you'll need to create: \weather\ \weather\posts\ \weather\ids\
For example, if you're using PageGate's default data location, we would recommend creating: c:\PageGateData\Weather\ c:\PageGateData\Weather\posts\ c:\PageGateData\Weather\ids\
Next, we'll need to configure the National Weather Service API in PageGate: 1) Open PG Admin.
2) Right click Carriers, select 'Add'.
3) Specify the following: Name: NWS-GetData Protocol: HTTPGET Host: The link to the NWS data feed. See note below Port: 443 Max Chars: 16000
NOTE: The 'Host' is the link to the NWS data feed you're interested in. To find that link, go to https://alerts.weather.gov/ and scroll to the Zone and County list. When you find the state, zone or county you're interested in, right click on the link for the specific Zone or County code and copy it.
After pasting the URL into the 'Host' field, remove the https://
For example, the link to the NWS data feed for Alameda, CA is https://alerts.weather.gov/cap/wwaatmget.php?x=CAC001&y=1
We would need this in 'Host' field: alerts.weather.gov/cap/wwaatmget.php?x=CAC001&y=1
4) Click Apply.
5) Go to Carriers - NWS-GetData - Template
6) In the 'Settings' section of the Template, specify the following: ResponsePath = The path to the weather folder. Note: Declare \ as \092 Example: ResponsePath = C:\092PageGateData\092weather
7) Click Apply.
Next, we'll need to configure a recipient that will allow us to go 'check the weather': 1) Right click Recipients, select 'Add'.
2) Specify the following: Full Name: WeatherCheck recipient: weathercheck Carrier: NWS-GetData ID/PIN: Leave blank Max Chars: 16000
3) Click Apply.
Now that we have the ability to check the weather, we'll need to configure GetAscii to use PageGate's NWS Filter, which can be downloaded here: https://www.notepage.net/support/nwsfilter.zip
You can also find a copy of the script here in the documentation.
Unzip the file in the root \weather\ folder. For example, if you're using the default paths, you would unzip nwsfilter.zip in to c:\PageGateData\weather\
Next, we'll need to configure the filter for your system:
1) Open nwsfilter.xml in your preferred text editor (NotePad, NotePad++, EditPad, etc)
2) Find all lines that say 'INSERT THE PATH TO YOUR WEATHER FOLDER'. Please replace that text with the path to your root folder. For example, you'll see this line in the filter: INSERT THE PATH TO YOUR WEATHER FOLDER\posts\%InputFileNameBase%-%FilterIndex%.asc
If you're using the default paths, you would use: c:\PageGateData\weather\posts\%InputFileNameBase%-%FilterIndex%.asc
3) Search for YourRecipientOrGroup and replace that with the name of a recipient or group in PageGate. This is the recipient or group that will receive the weather alerts.
For example, if you want the weather alerts to be sent by email, text, page and API call at the same time, you would definitely want to reference a group name.
4) Save and close the filter.
Now that we have the filter primed and ready, we'll need to tell GetAscii to use it and then configure GetAscii to start reading the weather data.
1) Back in PG Admin, go to Interfaces - GetAscii - Template
2) Specify the following in the 'Settings' section of the template: RawInterfaceFilter = The full path to your nwsfilter.xml file and declare \ as \092* UseFilterDll = True
*For Example: c:\092PageGateData\092weather\092nwsfilter.xml
3) Click Apply.
4) Go to Interfaces - GetAscii - Settings - Advanced Polling - Files
5) Click Add, then specify the following: Recipient: * From: Leave Blank File(s): *.txt Path: The path to your \weather\ folder. If you're using the default paths, you would specify c:\PageGateData\weather\ File Type: Standard
6) Click Apply.
7) Click Add, then specify the following: Recipient: * From: Leave Blank File(s): *.asc Path: The path to your \weather\posts\ folder. If you're using the default paths, you would specify c:\PageGateData\weather\posts File Type: Standard
8) Click Apply.
9) Click Apply again.
The final step is to configure a scheduled message to 'check the weather' every few minutes:
1) Open the PageGate Admin.
2) Right click on the 'WeatherCheck' recipient and select 'Send Message'
3) Leave 'From' and 'Message' blank.
4) Check 'Repeat message every X minutes'
5) Specify the interval at which PageGate should poll the NWS data feed. Fractions of a minute will be expressed as seconds. For example, a value of 0.5 will poll every 30 seconds.
6) Click Send.
From that point forward, PageGate will automatically check the weather every X minutes and will deliver alerts, warnings and watches to the specified recipient or group! |