by Fran T
Demonstrates the use of the United States National Weather Service Forecast and Alerts services. Several unconnected blocks are also provided which demonstrate parsing dates from the APIs.
The flows are written as subroutines to be easier to copy and incorporate into your own flows.
Also included is a simple-minded flow for determining whether the current location is within the United States. -Although the NWS API services return a 400 or 404 status if the given location is not within the United States, it's usually quicker to check via reverse geocoding. If you elect not to use it, the weather flows will show the same message if such a status is received.
The main 'Forecast with Alerts' flow displays the selected number of upcoming 12-hour forecast intervals (from the returned week's worth) and any weather alerts which are active. It does this by issuing the two HTTP requests in parallel and coalescing the results when they complete. The "For each in serviceEndpoints" loop can be used as a general-purpose flow to do this in your own flows.
Be aware that the service is sometimes slow and the requests may time out. The flow will retry each up to three times. Detailed information about each failure is logged if logging for the flow is enabled.
o Added a dialog to show the weather information, so that the flow easier to use as more than a demo
o Now lets you choose the number of forecast intervals
o Improved modularity of subroutines
o Added a flow with a default number of forecast intervals (convenient for desktop shortcuts)
o Fixed duplicate forecast when there were no alerts
o Fixed Weather Alerts flow error path, added a flow to clear the default number of intervals
o Improved factoring of HTTP response status processing to make the request subroutine more universal for inclusion in other flows