Weather data from NWS

I had a need to grab weather forecast.
The first step where, the nation weather serve seem to be a good answer.
I have not automated location as yet as my locations are pretty static and set this part up manually.
navigate to “API Web Service
From there you can learn about the API and tools available to make this simple.
the basic call to get your data start with:,-94.192”, Replacing the coordinates with yours.
Firefox works best as you can change from JSON to Raw data json is by far the easiest to read.
Within the results you will find a link for forecast, this will be formatted like this.,96/forecast[Station]/[Grid 1],{Grid 2]/forecast”
What you are looking for in the first call is your station and the 2 grid numbers.
I intend to automat this portion but have not had time yet.
Using these 2 calls in fire fox should give an idea of what the data should look like.
Adding this call to a button will allow you to start parsing the data.

The next step is making the call in the real world and doing something with the data.
Here is the script I will break it down in further posts.
It has tag writes but I have the final write commented out and print enabled for all variables.
So make sure your output console is on and cleared and pop this on a button and take off.

# make the API call
myEndpoint = ",99/forecast"
#Move the data to a results tag
results =
#Drill down paste the headers
decodedDict = system.util.jsonDecode(results)['properties']
# the forecasts are called periods this line pulls the periods out of the larger file
if "periods" in decodedDict:
    forecast = decodedDict["periods"]
#Grabe each period and move it to a Variable
Period0 =  forecast[0]
Period1 = forecast[1]
Period2 = forecast[2]
Period3 = forecast[3]
Period4 = forecast[4]
Period5 = forecast[5]
#look for the name of the forecast and move ity to another vaiable
# this could be done witha for statement but there are 14 forecasts in the file and I only want the first 4 or 5
if "name" in Period0:
        p0N = Period0["name"]
if "detailedForecast" in Period0:
    	p0FC= Period0["detailedForecast"]
if "name" in Period1:
        p1N = Period1["name"]
if "detailedForecast" in Period1:
        p1FC = Period1["detailedForecast"]
if "name" in Period2:
        p2N = Period2["name"]
if "detailedForecast" in Period2:
       p2FC = Period2["detailedForecast"]
if "name" in Period3:
        p3N = Period3["name"]
if "detailedForecast" in Period3:
        p3FC = Period3["detailedForecast"]
if "name" in Period4:
        p4N = Period4["name"]
if "detailedForecast" in Period4:
        p4FC = Period4["detailedForecast"]
if "name" in Period5:
        p5N = Period5["name"]
if "detailedForecast" in Period5:
        p5FC = Period5["detailedForecast"]
#print the results to check data
print p0N
print p0FC
print p1N
print p1FC
print p2N
print p2FC
print p3N
print p3FC
print p4N
print p4FC
print p5N
print p5FC

# Create a list with the tag paths to be updated.
paths = ["[REF_TAGS]Weather/P0/Name",
# Create a list with the update values, one value for each path.
values = [p0N,p0FC,p1N,p1FC,p2N,p2FC,p3N,p3FC]
 #commented out to only print data
# Execute the write operation.
#system.tag.writeBlocking(paths, values)