NWS Weather API

I didn’t like the OpenWeatherMap forecast, it wasn’t very accurate for my location. I’ve been getting weather from the NWS for years and it has always been the most accurate… I’m not a big talker so here’s what I’ve got… I was pretty happy with the widget that was provided for OpenWeatherMap, so I ended up reusing most of the code from that widget. I hope that doesn’t upset anyone…

For the HTTP_URL_Thing_Weather item, we pass the API URL for our area:
https://api.weather.gov/gridpoints/{Station Name}/{gridpoints,gridpoints}/forecast

To get the Station Name and grid point values, you must follow the instructions provided at api.weather.gov: General FAQs

For example, you can paste https://api.weather.gov/points/{lat},{lon} into your browser and put your latitude/longitude in, and the API will return back the appropriate link for your HTTP URL Thing under “Properties > Forecast”

I set up a refresh time of 6000 with a timeout of 15000. YMMV, adjust as needed…

HTTP_URL_Thing_Weather                  : This item is an HTTP URL thing (using the HTTP binding) It holds the JSON data that we get from the NWS API
df0 through df13                        : These items hold the detailed forecast
weather0day through weather13day        : These items hold a boolean value whether this is during the day or at night
weather0forecast                        : This item holds the timestamp for when the forecast was generated 
weather0icon through weather13icon      : These items hold the address for where the icon for the corresponding forecast can be loaded
weather0name through weather13name      : These items hold the name of the forecast period (i.e.: Today, Tonight, Sunday, Sunday Night, etc)
weather0rh                              : This item holds the value of the relative humidity for the current period
weather0sf through weather13sf          : These items hold the value of a brief summary of the forecast for that period
weather0temp through weather13temp      : These items hold the value of the forecast temperature for that period
weather0tempu through weather13tempu    : These items hold the value of the temperature unit used for that period
weather0wind                            : This item holds the value of the wind speed (including units) of the current period
rule weather

when 
    Item HTTP_URL_Thing_Weather received update
then
	val String json = (HTTP_URL_Thing_Weather.state as StringType).toString
	val String icon0  = transform("JSONPATH", "$.properties.periods[0].icon", json)
	val String icon1 = transform("JSONPATH", "$.properties.periods[1].icon", json)
        val String icon2 = transform("JSONPATH", "$.properties.periods[2].icon", json)
        val String icon3 = transform("JSONPATH", "$.properties.periods[3].icon", json)
        val String icon4 = transform("JSONPATH", "$.properties.periods[4].icon", json)
        val String icon5 = transform("JSONPATH", "$.properties.periods[5].icon", json)
        val String icon6 = transform("JSONPATH", "$.properties.periods[6].icon", json)
        val String icon7 = transform("JSONPATH", "$.properties.periods[7].icon", json)
        val String icon8 = transform("JSONPATH", "$.properties.periods[8].icon", json)
        val String icon9 = transform("JSONPATH", "$.properties.periods[9].icon", json)
        val String icon10 = transform("JSONPATH", "$.properties.periods[10].icon", json)
        val String icon11 = transform("JSONPATH", "$.properties.periods[11].icon", json)
        val String icon12 = transform("JSONPATH", "$.properties.periods[12].icon", json)
        val String icon13 = transform("JSONPATH", "$.properties.periods[13].icon", json)
        val String name0  = transform("JSONPATH", "$.properties.periods[0].name", json)
        val String name1 = transform("JSONPATH", "$.properties.periods[1].name", json)
        val String name2 = transform("JSONPATH", "$.properties.periods[2].name", json)
        val String name3 = transform("JSONPATH", "$.properties.periods[3].name", json)
        val String name4 = transform("JSONPATH", "$.properties.periods[4].name", json)
        val String name5 = transform("JSONPATH", "$.properties.periods[5].name", json)
        val String name6 = transform("JSONPATH", "$.properties.periods[6].name", json)
        val String name7 = transform("JSONPATH", "$.properties.periods[7].name", json)
        val String name8 = transform("JSONPATH", "$.properties.periods[8].name", json)
        val String name9 = transform("JSONPATH", "$.properties.periods[9].name", json)
        val String name10 = transform("JSONPATH", "$.properties.periods[10].name", json)
        val String name11 = transform("JSONPATH", "$.properties.periods[11].name", json)
        val String name12 = transform("JSONPATH", "$.properties.periods[12].name", json)
        val String name13 = transform("JSONPATH", "$.properties.periods[13].name", json)
        val String sf0  = transform("JSONPATH", "$.properties.periods[0].shortForecast", json)
        val String sf1 = transform("JSONPATH", "$.properties.periods[1].shortForecast", json)
        val String sf2 = transform("JSONPATH", "$.properties.periods[2].shortForecast", json)
        val String sf3 = transform("JSONPATH", "$.properties.periods[3].shortForecast", json)
        val String sf4 = transform("JSONPATH", "$.properties.periods[4].shortForecast", json)
        val String sf5 = transform("JSONPATH", "$.properties.periods[5].shortForecast", json)
        val String sf6 = transform("JSONPATH", "$.properties.periods[6].shortForecast", json)
        val String sf7 = transform("JSONPATH", "$.properties.periods[7].shortForecast", json)
        val String sf8 = transform("JSONPATH", "$.properties.periods[8].shortForecast", json)
        val String sf9 = transform("JSONPATH", "$.properties.periods[9].shortForecast", json)
        val String sf10 = transform("JSONPATH", "$.properties.periods[10].shortForecast", json)
        val String sf11 = transform("JSONPATH", "$.properties.periods[11].shortForecast", json)
        val String sf12 = transform("JSONPATH", "$.properties.periods[12].shortForecast", json)
        val String sf13 = transform("JSONPATH", "$.properties.periods[13].shortForecast", json)
        val String temp0  = transform("JSONPATH", "$.properties.periods[0].temperature", json)
        val String temp1 = transform("JSONPATH", "$.properties.periods[1].temperature", json)
        val String temp2 = transform("JSONPATH", "$.properties.periods[2].temperature", json)
        val String temp3 = transform("JSONPATH", "$.properties.periods[3].temperature", json)
        val String temp4 = transform("JSONPATH", "$.properties.periods[4].temperature", json)
        val String temp5 = transform("JSONPATH", "$.properties.periods[5].temperature", json)
        val String temp6 = transform("JSONPATH", "$.properties.periods[6].temperature", json)
        val String temp7 = transform("JSONPATH", "$.properties.periods[7].temperature", json)
        val String temp8 = transform("JSONPATH", "$.properties.periods[8].temperature", json)
        val String temp9 = transform("JSONPATH", "$.properties.periods[9].temperature", json)
        val String temp10 = transform("JSONPATH", "$.properties.periods[10].temperature", json)
        val String temp11 = transform("JSONPATH", "$.properties.periods[11].temperature", json)
        val String temp12 = transform("JSONPATH", "$.properties.periods[12].temperature", json)
        val String temp13 = transform("JSONPATH", "$.properties.periods[13].temperature", json)
        val String temp0u  = transform("JSONPATH", "$.properties.periods[0].temperatureUnit", json)
        val String temp1u = transform("JSONPATH", "$.properties.periods[1].temperatureUnit", json)
        val String temp2u = transform("JSONPATH", "$.properties.periods[2].temperatureUnit", json)
        val String temp3u = transform("JSONPATH", "$.properties.periods[3].temperatureUnit", json)
        val String temp4u = transform("JSONPATH", "$.properties.periods[4].temperatureUnit", json)
        val String temp5u = transform("JSONPATH", "$.properties.periods[5].temperatureUnit", json)
        val String temp6u = transform("JSONPATH", "$.properties.periods[6].temperatureUnit", json)
        val String temp7u = transform("JSONPATH", "$.properties.periods[7].temperatureUnit", json)
        val String temp8u = transform("JSONPATH", "$.properties.periods[8].temperatureUnit", json)
        val String temp9u = transform("JSONPATH", "$.properties.periods[9].temperatureUnit", json)
        val String temp10u = transform("JSONPATH", "$.properties.periods[10].temperatureUnit", json)
        val String temp11u = transform("JSONPATH", "$.properties.periods[11].temperatureUnit", json)
        val String temp12u = transform("JSONPATH", "$.properties.periods[12].temperatureUnit", json)
        val String temp13u = transform("JSONPATH", "$.properties.periods[13].temperatureUnit", json)
        val String day0  = transform("JSONPATH", "$.properties.periods[0].isDaytime", json)
        val String day1 = transform("JSONPATH", "$.properties.periods[1].isDaytime", json)
        val String day2 = transform("JSONPATH", "$.properties.periods[2].isDaytime", json)
        val String day3 = transform("JSONPATH", "$.properties.periods[3].isDaytime", json)
        val String day4 = transform("JSONPATH", "$.properties.periods[4].isDaytime", json)
        val String day5 = transform("JSONPATH", "$.properties.periods[5].isDaytime", json)
        val String day6 = transform("JSONPATH", "$.properties.periods[6].isDaytime", json)
        val String day7 = transform("JSONPATH", "$.properties.periods[7].isDaytime", json)
        val String day8 = transform("JSONPATH", "$.properties.periods[8].isDaytime", json)
        val String day9 = transform("JSONPATH", "$.properties.periods[9].isDaytime", json)
        val String day10 = transform("JSONPATH", "$.properties.periods[10].isDaytime", json)
        val String day11 = transform("JSONPATH", "$.properties.periods[11].isDaytime", json)
        val String day12 = transform("JSONPATH", "$.properties.periods[12].isDaytime", json)
        val String day13 = transform("JSONPATH", "$.properties.periods[13].isDaytime", json)
        val String rh = transform("JSONPATH", "$.properties.periods[0].relativeHumidity.value", json)
	val String wind = transform("JSONPATH", "$.properties.periods[0].windSpeed", json)
        val String forecast = transform("JSONPATH", "$.properties.generatedAt", json)
        val String wdf0  = transform("JSONPATH", "$.properties.periods[0].detailedForecast", json)
        val String wdf1 = transform("JSONPATH", "$.properties.periods[1].detailedForecast", json)
        val String wdf2 = transform("JSONPATH", "$.properties.periods[2].detailedForecast", json)
        val String wdf3 = transform("JSONPATH", "$.properties.periods[3].detailedForecast", json)
        val String wdf4 = transform("JSONPATH", "$.properties.periods[4].detailedForecast", json)
        val String wdf5 = transform("JSONPATH", "$.properties.periods[5].detailedForecast", json)
        val String wdf6 = transform("JSONPATH", "$.properties.periods[6].detailedForecast", json)
        val String wdf7 = transform("JSONPATH", "$.properties.periods[7].detailedForecast", json)
        val String wdf8 = transform("JSONPATH", "$.properties.periods[8].detailedForecast", json)
        val String wdf9 = transform("JSONPATH", "$.properties.periods[9].detailedForecast", json)
        val String wdf10 = transform("JSONPATH", "$.properties.periods[10].detailedForecast", json)
        val String wdf11 = transform("JSONPATH", "$.properties.periods[11].detailedForecast", json)
        val String wdf12 = transform("JSONPATH", "$.properties.periods[12].detailedForecast", json)
        val String wdf13 = transform("JSONPATH", "$.properties.periods[13].detailedForecast", json)
        logger.info("name0: " + name0 );
        logger.info("short: " + sf0 );
        logger.info("icon0: " + icon0 );
        logger.info("name1: " + name1 );
        logger.info("short: " + sf1 );
        logger.info("icon1: " + icon1 );
        logger.info("name2: " + name2 );
        logger.info("short: " + sf2 );
        logger.info("icon2: " + icon2 );
        logger.info("name3: " + name3 );
        logger.info("short: " + sf3 );
        logger.info("icon3: " + icon3 );
        logger.info("name4: " + name4 );
        logger.info("short: " + sf4 );
        logger.info("icon4: " + icon4 );
        logger.info("name5: " + name5 );
        logger.info("short: " + sf5 );
        logger.info("icon5: " + icon5 );
        logger.info("name6: " + name6 );
        logger.info("short: " + sf6 );
        logger.info("icon6: " + icon6 );
        logger.info("name7: " + name7 );
        logger.info("short: " + sf7 );
        logger.info("icon7: " + icon7 );
        logger.info("name8: " + name8 );
        logger.info("short: " + sf8 );
	logger.info("icon8: " + icon8 );
        logger.info("name9: " + name9 );
        logger.info("short: " + sf9 );
        logger.info("icon9: " + icon9 );
        logger.info("name10: " + name10 );
        logger.info("short: " + sf10 );
        logger.info("icon10: " + icon10 );
        logger.info("name11: " + name11 );
        logger.info("short: " + sf11 );
        logger.info("icon11: " + icon11 );
        logger.info("name12: " + name12 );
        logger.info("short: " + sf12 );
        logger.info("icon12: " + icon12 );
        logger.info("name13: " + name13 );
        logger.info("short: " + sf13 );
        logger.info("icon13: " + icon13 );
	weather0icon.postUpdate(icon0);
        weather1icon.postUpdate(icon1);
        weather2icon.postUpdate(icon2);
        weather3icon.postUpdate(icon3);                              
        weather4icon.postUpdate(icon4);
        weather5icon.postUpdate(icon5);                              
        weather6icon.postUpdate(icon6);
        weather7icon.postUpdate(icon7);                              
        weather8icon.postUpdate(icon8);
        weather9icon.postUpdate(icon9);                              
        weather10icon.postUpdate(icon10);
        weather11icon.postUpdate(icon11);                              
        weather12icon.postUpdate(icon12);
        weather13icon.postUpdate(icon13);                              
        weather0sf.postUpdate(sf0);
        weather1sf.postUpdate(sf1);
        weather2sf.postUpdate(sf2);
        weather3sf.postUpdate(sf3);
        weather4sf.postUpdate(sf4);
        weather5sf.postUpdate(sf5);
        weather6sf.postUpdate(sf6);
        weather7sf.postUpdate(sf7);
        weather8sf.postUpdate(sf8);
        weather9sf.postUpdate(sf9);
        weather10sf.postUpdate(sf10);
        weather11sf.postUpdate(sf11);
        weather12sf.postUpdate(sf12);
        weather13sf.postUpdate(sf13);
        weather0name.postUpdate(name0);
        weather1name.postUpdate(name1);
        weather2name.postUpdate(name2);
        weather3name.postUpdate(name3);
        weather4name.postUpdate(name4);
        weather5name.postUpdate(name5);
        weather6name.postUpdate(name6);
        weather7name.postUpdate(name7);
        weather8name.postUpdate(name8);
        weather9name.postUpdate(name9);
        weather10name.postUpdate(name10);
        weather11name.postUpdate(name11);
        weather12name.postUpdate(name12);
        weather13name.postUpdate(name13);
        weather0temp.postUpdate(temp0);
        weather1temp.postUpdate(temp1);
        weather2temp.postUpdate(temp2);
        weather3temp.postUpdate(temp3);
        weather4temp.postUpdate(temp4);
        weather5temp.postUpdate(temp5);
        weather6temp.postUpdate(temp6);
        weather7temp.postUpdate(temp7);
        weather8temp.postUpdate(temp8);
        weather9temp.postUpdate(temp9);
        weather10temp.postUpdate(temp10);
        weather11temp.postUpdate(temp11);
        weather12temp.postUpdate(temp12);
        weather13temp.postUpdate(temp13);
        weather0tempu.postUpdate(temp0u);
        weather1tempu.postUpdate(temp1u);
        weather2tempu.postUpdate(temp2u);
        weather3tempu.postUpdate(temp3u);
        weather4tempu.postUpdate(temp4u);
        weather5tempu.postUpdate(temp5u);
        weather6tempu.postUpdate(temp6u);
        weather7tempu.postUpdate(temp7u);
        weather8tempu.postUpdate(temp8u);
        weather9tempu.postUpdate(temp9u);
        weather10tempu.postUpdate(temp10u);
        weather11tempu.postUpdate(temp11u);
        weather12tempu.postUpdate(temp12u);
        weather13tempu.postUpdate(temp13u);
	weather0day.postUpdate(day0);
        weather1day.postUpdate(day1);
        weather2day.postUpdate(day2);
        weather3day.postUpdate(day3);
        weather4day.postUpdate(day4);
        weather5day.postUpdate(day5);
        weather6day.postUpdate(day6);
        weather7day.postUpdate(day7);
        weather8day.postUpdate(day8);
        weather9day.postUpdate(day9);
        weather10day.postUpdate(day10);
        weather11day.postUpdate(day11);
        weather12day.postUpdate(day12);
        weather13day.postUpdate(day13);
	weather0rh.postUpdate(rh);
	weather0wind.postUpdate(wind);
	weather0forecast.postUpdate(forecast);
	df0.postUpdate(wdf0);
        df1.postUpdate(wdf1);
        df2.postUpdate(wdf2);
        df3.postUpdate(wdf3);
        df4.postUpdate(wdf4);
        df5.postUpdate(wdf5);
        df6.postUpdate(wdf6);
        df7.postUpdate(wdf7);
        df8.postUpdate(wdf8);
        df9.postUpdate(wdf9);
        df10.postUpdate(wdf10);
        df11.postUpdate(wdf11);
        df12.postUpdate(wdf12);
        df13.postUpdate(wdf13);
end

I hope this helps someone…

1 Like

Thanks for posting! I spent a little bit of time with the NWS data but gave up awhile back because what I really cared about was total forecast precipitation and the format of the data they provide(ed?) was hard to manage. I’m happy so see someone make more progress than I did.

Some potential enhancements:

  • All the JSONPATH stuff could be embedded into the Thing. The big advantage you have there is if there is some piece of data you don’t care about, you simply don’t need to link an Item to that Channel. With the rule approach, you need to have an Item for every piece of data whether you want it or not or else you’ll get errors. This also gives the users the option to name these Items what they want and they can create them all in one go using “add equipment to model”. However, it’s a lot more code. Thankfully once you get one period it’s just copy/paste/find and replace to create the Channels for the other periods. The Thing below has all 14 periods represented. Temperature Items support Number:Temperature and percent Items support Number:Dimensionless. The unit is pulled from the JSON so it should work with what ever unit you us. It does require the JSONPATH and JS Scripting add-ons.

Create a new HTTP Thing, open the “Code” tab, paste the YAML below and modify the “baseURL” to your URL. Then use “add equiupment to model” to create all the Items you want. Be sure to set the units for the temperature and percent Items.

UID: http:url:nws
label: National Weather Service Forecast
thingTypeUID: http:url
configuration:
  authMode: BASIC
  ignoreSSLErrors: false
  baseURL: https://api.weather.gov/gridpoints/{Station Name}/{gridpoints,gridpoints}/forecast
  delay: 0
  stateMethod: GET
  refresh: 6000
  commandMethod: GET
  contentType: application/json
  timeout: 3000
  bufferSize: 2048
channels:
  - id: Updated
    channelTypeUID: http:datetime
    label: Updated
    description: ""
    configuration:
      stateTransformation: JSONPATH:$.properties.updated
  - id: Generated
    channelTypeUID: http:datetime
    label: Generated Time
    description: ""
    configuration:
      stateTransformation: JSONPATH:$.properties.generatedAt
  - id: Period_1_Name
    channelTypeUID: http:string
    label: Period 1 Name
    description: ""
    configuration:
      stateTransformation: JSONPATH:$.properties.periods[0].name
  - id: Period_1_Start
    channelTypeUID: http:datetime
    label: Period 1 Start
    description: ""
    configuration:
      stateTransformation: JSONPATH:$.properties.periods[0].startTime
  - id: Period_1_End
    channelTypeUID: http:datetime
    label: Period 1 End Time
    description: ""
    configuration:
      stateTransformation: JSONPATH:$.properties.periods[0].endTime
  - id: Period_1_Daytime
    channelTypeUID: http:switch
    label: Period 1 Is Daytime
    description: ""
    configuration:
      onValue: "true"
      offValue: "false"
      stateTransformation: JSONPATH:$.properties.periods[0].isDaytime
  - id: Period_1_Temperature
    channelTypeUID: http:number
    label: Period 1 Temperature
    description: ""
    configuration:
      stateTransformation: JS:| JSON.parse(input).properties.periods[0].temperature +
        ' °' + JSON.parse(input).properties.periods[0].temperatureUnit
  - id: Period_1_Temperature_Trend
    channelTypeUID: http:string
    label: Period 1 Temperature Trend
    description: ""
    configuration:
      stateTransformation: JSONPATH:$.properties.periods[0].temperatureTrend
  - id: Period_1_ProbPrecip
    channelTypeUID: http:number
    label: Period 1 Probability of Precipitation
    description: ""
    configuration:
      stateTransformation: "JS:|
        (JSON.parse(input).properties.periods[0].probabilityOfPrecipitation.val\
        ue === null) ? 0 :
        JSON.parse(input).properties.periods[0].probabilityOfPrecipitation.valu\
        e"
      unit: "%"
  - id: Period_1_Dewpoint
    channelTypeUID: http:number
    label: Period 1 Dewpoint
    description: ""
    configuration:
      stateTransformation: "JS:|
        JSON.parse(input).properties.periods[0].dewpoint.value + ' °' +
        JSON.parse(input).properties.periods[0].dewpoint. unitCode.slice(-1) "
  - id: Period_1_RelativeHumidity
    channelTypeUID: http:number
    label: Period 1 Relative Humidity
    description: ""
    configuration:
      stateTransformation: JSONPATH:$.properties.periods[0].relativeHumidity.value
      unit: "%"
  - id: Period_1_WindSpeed
    channelTypeUID: http:number
    label: Period 1 Wind Speed
    description: ""
    configuration:
      stateTransformation: JSONPATH:$.properties.periods[0].windSpeed
  - id: Period_1_Wind_Direction
    channelTypeUID: http:string
    label: Period 1 Wind Direction
    description: ""
    configuration:
      stateTransformation: JSONPATH:$.properties.periods[0].windDirection
  - id: Period_1_Icon_URL
    channelTypeUID: http:string
    label: Period 1 Icon URL
    description: ""
    configuration:
      stateTransformation: JSONPATH:$.properties.periods[0].icon
  - id: Period_1_Short_Forecast
    channelTypeUID: http:string
    label: Period 1 Short Forecast
    description: ""
    configuration:
      stateTransformation: JSONPATH:$.properties.periods[0].shortForecast
  - id: Period_1_Detailed_Forecast
    channelTypeUID: http:string
    label: Period 1 Detailed Forecast
    description: ""
    configuration:
      stateTransformation: JSONPATH:$.properties.periods[0].detailedForecast
  - id: Period_2_Name
    channelTypeUID: http:string
    label: Period 2 Name
    description: null
    configuration:
      stateTransformation: JSONPATH:$.properties.periods[1].name
  - id: Period_2_Start
    channelTypeUID: http:datetime
    label: Period 2 Start
    description: null
    configuration:
      stateTransformation: JSONPATH:$.properties.periods[1].startTime
  - id: Period_2_End
    channelTypeUID: http:datetime
    label: Period 2 End Time
    description: null
    configuration:
      stateTransformation: JSONPATH:$.properties.periods[1].endTime
  - id: Period_2_Daytime
    channelTypeUID: http:switch
    label: Period 2 Is Daytime
    description: null
    configuration:
      onValue: "true"
      offValue: "false"
      stateTransformation: JSONPATH:$.properties.periods[1].isDaytime
  - id: Period_2_Temperature
    channelTypeUID: http:number
    label: Period 2 Temperature
    description: null
    configuration:
      stateTransformation: JS:| JSON.parse(input).properties.periods[1].temperature +
        ' °' + JSON.parse(input).properties.periods[1].temperatureUnit
  - id: Period_2_Temperature_Trend
    channelTypeUID: http:string
    label: Period 2 Temperature Trend
    description: null
    configuration:
      stateTransformation: JSONPATH:$.properties.periods[1].temperatureTrend
  - id: Period_2_ProbPrecip
    channelTypeUID: http:number
    label: Period 2 Probability of Precipitation
    description: null
    configuration:
      stateTransformation: "JS:|
        (JSON.parse(input).properties.periods[1].probabilityOfPrecipitation.val\
        ue === null) ? 0 :
        JSON.parse(input).properties.periods[1].probabilityOfPrecipitation.valu\
        e"
      unit: "%"
  - id: Period_2_Dewpoint
    channelTypeUID: http:number
    label: Period 2 Dewpoint
    description: null
    configuration:
      stateTransformation: "JS:|
        JSON.parse(input).properties.periods[1].dewpoint.value + ' °' +
        JSON.parse(input).properties.periods[1].dewpoint. unitCode.slice(-1) "
  - id: Period_2_RelativeHumidity
    channelTypeUID: http:number
    label: Period 2 Relative Humidity
    description: null
    configuration:
      stateTransformation: JSONPATH:$.properties.periods[1].relativeHumidity.value
      unit: "%"
  - id: Period_2_WindSpeed
    channelTypeUID: http:number
    label: Period 2 Wind Speed
    description: null
    configuration:
      stateTransformation: JSONPATH:$.properties.periods[1].windSpeed
  - id: Period_2_Wind_Direction
    channelTypeUID: http:string
    label: Period 2 Wind Direction
    description: null
    configuration:
      stateTransformation: JSONPATH:$.properties.periods[1].windDirection
  - id: Period_2_Icon_URL
    channelTypeUID: http:string
    label: Period 2 Icon URL
    description: null
    configuration:
      stateTransformation: JSONPATH:$.properties.periods[1].icon
  - id: Period_2_Short_Forecast
    channelTypeUID: http:string
    label: Period 2 Short Forecast
    description: null
    configuration:
      stateTransformation: JSONPATH:$.properties.periods[1].shortForecast
  - id: Period_2_Detailed_Forecast
    channelTypeUID: http:string
    label: Period 2 Detailed Forecast
    description: null
    configuration:
      stateTransformation: JSONPATH:$.properties.periods[1].detailedForecast
  - id: Period_3_Name
    channelTypeUID: http:string
    label: Period 3 Name
    description: null
    configuration:
      stateTransformation: JSONPATH:$.properties.periods[2].name
  - id: Period_3_Start
    channelTypeUID: http:datetime
    label: Period 3 Start
    description: null
    configuration:
      stateTransformation: JSONPATH:$.properties.periods[2].startTime
  - id: Period_3_End
    channelTypeUID: http:datetime
    label: Period 3 End Time
    description: null
    configuration:
      stateTransformation: JSONPATH:$.properties.periods[2].endTime
  - id: Period_3_Daytime
    channelTypeUID: http:switch
    label: Period 3 Is Daytime
    description: null
    configuration:
      onValue: "true"
      offValue: "false"
      stateTransformation: JSONPATH:$.properties.periods[2].isDaytime
  - id: Period_3_Temperature
    channelTypeUID: http:number
    label: Period 3 Temperature
    description: null
    configuration:
      stateTransformation: JS:| JSON.parse(input).properties.periods[2].temperature +
        ' °' + JSON.parse(input).properties.periods[2].temperatureUnit
  - id: Period_3_Temperature_Trend
    channelTypeUID: http:string
    label: Period 3 Temperature Trend
    description: null
    configuration:
      stateTransformation: JSONPATH:$.properties.periods[2].temperatureTrend
  - id: Period_3_ProbPrecip
    channelTypeUID: http:number
    label: Period 3 Probability of Precipitation
    description: null
    configuration:
      stateTransformation: "JS:|
        (JSON.parse(input).properties.periods[2].probabilityOfPrecipitation.val\
        ue === null) ? 0 :
        JSON.parse(input).properties.periods[2].probabilityOfPrecipitation.valu\
        e"
      unit: "%"
  - id: Period_3_Dewpoint
    channelTypeUID: http:number
    label: Period 3 Dewpoint
    description: null
    configuration:
      stateTransformation: "JS:|
        JSON.parse(input).properties.periods[2].dewpoint.value + ' °' +
        JSON.parse(input).properties.periods[2].dewpoint. unitCode.slice(-1) "
  - id: Period_3_RelativeHumidity
    channelTypeUID: http:number
    label: Period 3 Relative Humidity
    description: null
    configuration:
      stateTransformation: JSONPATH:$.properties.periods[2].relativeHumidity.value
      unit: "%"
  - id: Period_3_WindSpeed
    channelTypeUID: http:number
    label: Period 3 Wind Speed
    description: null
    configuration:
      stateTransformation: JSONPATH:$.properties.periods[2].windSpeed
  - id: Period_3_Wind_Direction
    channelTypeUID: http:string
    label: Period 3 Wind Direction
    description: null
    configuration:
      stateTransformation: JSONPATH:$.properties.periods[2].windDirection
  - id: Period_3_Icon_URL
    channelTypeUID: http:string
    label: Period 3 Icon URL
    description: null
    configuration:
      stateTransformation: JSONPATH:$.properties.periods[2].icon
  - id: Period_3_Short_Forecast
    channelTypeUID: http:string
    label: Period 3 Short Forecast
    description: null
    configuration:
      stateTransformation: JSONPATH:$.properties.periods[2].shortForecast
  - id: Period_3_Detailed_Forecast
    channelTypeUID: http:string
    label: Period 3 Detailed Forecast
    description: null
    configuration:
      stateTransformation: JSONPATH:$.properties.periods[2].detailedForecast
  - id: Period_4_Name
    channelTypeUID: http:string
    label: Period 4 Name
    description: null
    configuration:
      stateTransformation: JSONPATH:$.properties.periods[3].name
  - id: Period_4_Start
    channelTypeUID: http:datetime
    label: Period 4 Start
    description: null
    configuration:
      stateTransformation: JSONPATH:$.properties.periods[3].startTime
  - id: Period_4_End
    channelTypeUID: http:datetime
    label: Period 4 End Time
    description: null
    configuration:
      stateTransformation: JSONPATH:$.properties.periods[3].endTime
  - id: Period_4_Daytime
    channelTypeUID: http:switch
    label: Period 4 Is Daytime
    description: null
    configuration:
      onValue: "true"
      offValue: "false"
      stateTransformation: JSONPATH:$.properties.periods[3].isDaytime
  - id: Period_4_Temperature
    channelTypeUID: http:number
    label: Period 4 Temperature
    description: null
    configuration:
      stateTransformation: JS:| JSON.parse(input).properties.periods[3].temperature +
        ' °' + JSON.parse(input).properties.periods[3].temperatureUnit
  - id: Period_4_Temperature_Trend
    channelTypeUID: http:string
    label: Period 4 Temperature Trend
    description: null
    configuration:
      stateTransformation: JSONPATH:$.properties.periods[3].temperatureTrend
  - id: Period_4_ProbPrecip
    channelTypeUID: http:number
    label: Period 4 Probability of Precipitation
    description: null
    configuration:
      stateTransformation: "JS:|
        (JSON.parse(input).properties.periods[3].probabilityOfPrecipitation.val\
        ue === null) ? 0 :
        JSON.parse(input).properties.periods[3].probabilityOfPrecipitation.valu\
        e"
      unit: "%"
  - id: Period_4_Dewpoint
    channelTypeUID: http:number
    label: Period 4 Dewpoint
    description: null
    configuration:
      stateTransformation: "JS:|
        JSON.parse(input).properties.periods[3].dewpoint.value + ' °' +
        JSON.parse(input).properties.periods[3].dewpoint. unitCode.slice(-1) "
  - id: Period_4_RelativeHumidity
    channelTypeUID: http:number
    label: Period 4 Relative Humidity
    description: null
    configuration:
      stateTransformation: JSONPATH:$.properties.periods[3].relativeHumidity.value
      unit: "%"
  - id: Period_4_WindSpeed
    channelTypeUID: http:number
    label: Period 4 Wind Speed
    description: null
    configuration:
      stateTransformation: JSONPATH:$.properties.periods[3].windSpeed
  - id: Period_4_Wind_Direction
    channelTypeUID: http:string
    label: Period 4 Wind Direction
    description: null
    configuration:
      stateTransformation: JSONPATH:$.properties.periods[3].windDirection
  - id: Period_4_Icon_URL
    channelTypeUID: http:string
    label: Period 4 Icon URL
    description: null
    configuration:
      stateTransformation: JSONPATH:$.properties.periods[3].icon
  - id: Period_4_Short_Forecast
    channelTypeUID: http:string
    label: Period 4 Short Forecast
    description: null
    configuration:
      stateTransformation: JSONPATH:$.properties.periods[3].shortForecast
  - id: Period_4_Detailed_Forecast
    channelTypeUID: http:string
    label: Period 4 Detailed Forecast
    description: null
    configuration:
      stateTransformation: JSONPATH:$.properties.periods[3].detailedForecast
  - id: Period_5_Name
    channelTypeUID: http:string
    label: Period 5 Name
    description: null
    configuration:
      stateTransformation: JSONPATH:$.properties.periods[4].name
  - id: Period_5_Start
    channelTypeUID: http:datetime
    label: Period 5 Start
    description: null
    configuration:
      stateTransformation: JSONPATH:$.properties.periods[4].startTime
  - id: Period_5_End
    channelTypeUID: http:datetime
    label: Period 5 End Time
    description: null
    configuration:
      stateTransformation: JSONPATH:$.properties.periods[4].endTime
  - id: Period_5_Daytime
    channelTypeUID: http:switch
    label: Period 5 Is Daytime
    description: null
    configuration:
      onValue: "true"
      offValue: "false"
      stateTransformation: JSONPATH:$.properties.periods[4].isDaytime
  - id: Period_5_Temperature
    channelTypeUID: http:number
    label: Period 5 Temperature
    description: null
    configuration:
      stateTransformation: JS:| JSON.parse(input).properties.periods[4].temperature +
        ' °' + JSON.parse(input).properties.periods[4].temperatureUnit
  - id: Period_5_Temperature_Trend
    channelTypeUID: http:string
    label: Period 5 Temperature Trend
    description: null
    configuration:
      stateTransformation: JSONPATH:$.properties.periods[4].temperatureTrend
  - id: Period_5_ProbPrecip
    channelTypeUID: http:number
    label: Period 5 Probability of Precipitation
    description: null
    configuration:
      stateTransformation: "JS:|
        (JSON.parse(input).properties.periods[4].probabilityOfPrecipitation.val\
        ue === null) ? 0 :
        JSON.parse(input).properties.periods[4].probabilityOfPrecipitation.valu\
        e"
      unit: "%"
  - id: Period_5_Dewpoint
    channelTypeUID: http:number
    label: Period 5 Dewpoint
    description: null
    configuration:
      stateTransformation: "JS:|
        JSON.parse(input).properties.periods[4].dewpoint.value + ' °' +
        JSON.parse(input).properties.periods[4].dewpoint. unitCode.slice(-1) "
  - id: Period_5_RelativeHumidity
    channelTypeUID: http:number
    label: Period 5 Relative Humidity
    description: null
    configuration:
      stateTransformation: JSONPATH:$.properties.periods[4].relativeHumidity.value
      unit: "%"
  - id: Period_5_WindSpeed
    channelTypeUID: http:number
    label: Period 5 Wind Speed
    description: null
    configuration:
      stateTransformation: JSONPATH:$.properties.periods[4].windSpeed
  - id: Period_5_Wind_Direction
    channelTypeUID: http:string
    label: Period 5 Wind Direction
    description: null
    configuration:
      stateTransformation: JSONPATH:$.properties.periods[4].windDirection
  - id: Period_5_Icon_URL
    channelTypeUID: http:string
    label: Period 5 Icon URL
    description: null
    configuration:
      stateTransformation: JSONPATH:$.properties.periods[4].icon
  - id: Period_5_Short_Forecast
    channelTypeUID: http:string
    label: Period 5 Short Forecast
    description: null
    configuration:
      stateTransformation: JSONPATH:$.properties.periods[4].shortForecast
  - id: Period_5_Detailed_Forecast
    channelTypeUID: http:string
    label: Period 5 Detailed Forecast
    description: null
    configuration:
      stateTransformation: JSONPATH:$.properties.periods[4].detailedForecast
  - id: Period_6_Name
    channelTypeUID: http:string
    label: Period 6 Name
    description: null
    configuration:
      stateTransformation: JSONPATH:$.properties.periods[5].name
  - id: Period_6_Start
    channelTypeUID: http:datetime
    label: Period 6 Start
    description: null
    configuration:
      stateTransformation: JSONPATH:$.properties.periods[5].startTime
  - id: Period_6_End
    channelTypeUID: http:datetime
    label: Period 6 End Time
    description: null
    configuration:
      stateTransformation: JSONPATH:$.properties.periods[5].endTime
  - id: Period_6_Daytime
    channelTypeUID: http:switch
    label: Period 6 Is Daytime
    description: null
    configuration:
      onValue: "true"
      offValue: "false"
      stateTransformation: JSONPATH:$.properties.periods[5].isDaytime
  - id: Period_6_Temperature
    channelTypeUID: http:number
    label: Period 6 Temperature
    description: null
    configuration:
      stateTransformation: JS:| JSON.parse(input).properties.periods[5].temperature +
        ' °' + JSON.parse(input).properties.periods[5].temperatureUnit
  - id: Period_6_Temperature_Trend
    channelTypeUID: http:string
    label: Period 6 Temperature Trend
    description: null
    configuration:
      stateTransformation: JSONPATH:$.properties.periods[5].temperatureTrend
  - id: Period_6_ProbPrecip
    channelTypeUID: http:number
    label: Period 6 Probability of Precipitation
    description: null
    configuration:
      stateTransformation: "JS:|
        (JSON.parse(input).properties.periods[5].probabilityOfPrecipitation.val\
        ue === null) ? 0 :
        JSON.parse(input).properties.periods[5].probabilityOfPrecipitation.valu\
        e"
      unit: "%"
  - id: Period_6_Dewpoint
    channelTypeUID: http:number
    label: Period 6 Dewpoint
    description: null
    configuration:
      stateTransformation: "JS:|
        JSON.parse(input).properties.periods[5].dewpoint.value + ' °' +
        JSON.parse(input).properties.periods[5].dewpoint. unitCode.slice(-1) "
  - id: Period_6_RelativeHumidity
    channelTypeUID: http:number
    label: Period 6 Relative Humidity
    description: null
    configuration:
      stateTransformation: JSONPATH:$.properties.periods[5].relativeHumidity.value
      unit: "%"
  - id: Period_6_WindSpeed
    channelTypeUID: http:number
    label: Period 6 Wind Speed
    description: null
    configuration:
      stateTransformation: JSONPATH:$.properties.periods[5].windSpeed
  - id: Period_6_Wind_Direction
    channelTypeUID: http:string
    label: Period 6 Wind Direction
    description: null
    configuration:
      stateTransformation: JSONPATH:$.properties.periods[5].windDirection
  - id: Period_6_Icon_URL
    channelTypeUID: http:string
    label: Period 6 Icon URL
    description: null
    configuration:
      stateTransformation: JSONPATH:$.properties.periods[5].icon
  - id: Period_6_Short_Forecast
    channelTypeUID: http:string
    label: Period 6 Short Forecast
    description: null
    configuration:
      stateTransformation: JSONPATH:$.properties.periods[5].shortForecast
  - id: Period_6_Detailed_Forecast
    channelTypeUID: http:string
    label: Period 6 Detailed Forecast
    description: null
    configuration:
      stateTransformation: JSONPATH:$.properties.periods[5].detailedForecast
  - id: Period_7_Name
    channelTypeUID: http:string
    label: Period 7 Name
    description: null
    configuration:
      stateTransformation: JSONPATH:$.properties.periods[6].name
  - id: Period_7_Start
    channelTypeUID: http:datetime
    label: Period 7 Start
    description: null
    configuration:
      stateTransformation: JSONPATH:$.properties.periods[6].startTime
  - id: Period_7_End
    channelTypeUID: http:datetime
    label: Period 7 End Time
    description: null
    configuration:
      stateTransformation: JSONPATH:$.properties.periods[6].endTime
  - id: Period_7_Daytime
    channelTypeUID: http:switch
    label: Period 7 Is Daytime
    description: null
    configuration:
      onValue: "true"
      offValue: "false"
      stateTransformation: JSONPATH:$.properties.periods[6].isDaytime
  - id: Period_7_Temperature
    channelTypeUID: http:number
    label: Period 7 Temperature
    description: null
    configuration:
      stateTransformation: JS:| JSON.parse(input).properties.periods[6].temperature +
        ' °' + JSON.parse(input).properties.periods[6].temperatureUnit
  - id: Period_7_Temperature_Trend
    channelTypeUID: http:string
    label: Period 7 Temperature Trend
    description: null
    configuration:
      stateTransformation: JSONPATH:$.properties.periods[6].temperatureTrend
  - id: Period_7_ProbPrecip
    channelTypeUID: http:number
    label: Period 7 Probability of Precipitation
    description: null
    configuration:
      stateTransformation: "JS:|
        (JSON.parse(input).properties.periods[6].probabilityOfPrecipitation.val\
        ue === null) ? 0 :
        JSON.parse(input).properties.periods[6].probabilityOfPrecipitation.valu\
        e"
      unit: "%"
  - id: Period_7_Dewpoint
    channelTypeUID: http:number
    label: Period 7 Dewpoint
    description: null
    configuration:
      stateTransformation: "JS:|
        JSON.parse(input).properties.periods[6].dewpoint.value + ' °' +
        JSON.parse(input).properties.periods[6].dewpoint. unitCode.slice(-1) "
  - id: Period_7_RelativeHumidity
    channelTypeUID: http:number
    label: Period 7 Relative Humidity
    description: null
    configuration:
      stateTransformation: JSONPATH:$.properties.periods[6].relativeHumidity.value
      unit: "%"
  - id: Period_7_WindSpeed
    channelTypeUID: http:number
    label: Period 7 Wind Speed
    description: null
    configuration:
      stateTransformation: JSONPATH:$.properties.periods[6].windSpeed
  - id: Period_7_Wind_Direction
    channelTypeUID: http:string
    label: Period 7 Wind Direction
    description: null
    configuration:
      stateTransformation: JSONPATH:$.properties.periods[6].windDirection
  - id: Period_7_Icon_URL
    channelTypeUID: http:string
    label: Period 7 Icon URL
    description: null
    configuration:
      stateTransformation: JSONPATH:$.properties.periods[6].icon
  - id: Period_7_Short_Forecast
    channelTypeUID: http:string
    label: Period 7 Short Forecast
    description: null
    configuration:
      stateTransformation: JSONPATH:$.properties.periods[6].shortForecast
  - id: Period_7_Detailed_Forecast
    channelTypeUID: http:string
    label: Period 7 Detailed Forecast
    description: null
    configuration:
      stateTransformation: JSONPATH:$.properties.periods[6].detailedForecast
  - id: Period_8_Name
    channelTypeUID: http:string
    label: Period 8 Name
    description: null
    configuration:
      stateTransformation: JSONPATH:$.properties.periods[7].name
  - id: Period_8_Start
    channelTypeUID: http:datetime
    label: Period 8 Start
    description: null
    configuration:
      stateTransformation: JSONPATH:$.properties.periods[7].startTime
  - id: Period_8_End
    channelTypeUID: http:datetime
    label: Period 8 End Time
    description: null
    configuration:
      stateTransformation: JSONPATH:$.properties.periods[7].endTime
  - id: Period_8_Daytime
    channelTypeUID: http:switch
    label: Period 8 Is Daytime
    description: null
    configuration:
      onValue: "true"
      offValue: "false"
      stateTransformation: JSONPATH:$.properties.periods[7].isDaytime
  - id: Period_8_Temperature
    channelTypeUID: http:number
    label: Period 8 Temperature
    description: null
    configuration:
      stateTransformation: JS:| JSON.parse(input).properties.periods[7].temperature +
        ' °' + JSON.parse(input).properties.periods[7].temperatureUnit
  - id: Period_8_Temperature_Trend
    channelTypeUID: http:string
    label: Period 8 Temperature Trend
    description: null
    configuration:
      stateTransformation: JSONPATH:$.properties.periods[7].temperatureTrend
  - id: Period_8_ProbPrecip
    channelTypeUID: http:number
    label: Period 8 Probability of Precipitation
    description: null
    configuration:
      stateTransformation: "JS:|
        (JSON.parse(input).properties.periods[7].probabilityOfPrecipitation.val\
        ue === null) ? 0 :
        JSON.parse(input).properties.periods[7].probabilityOfPrecipitation.valu\
        e"
      unit: "%"
  - id: Period_8_Dewpoint
    channelTypeUID: http:number
    label: Period 8 Dewpoint
    description: null
    configuration:
      stateTransformation: "JS:|
        JSON.parse(input).properties.periods[7].dewpoint.value + ' °' +
        JSON.parse(input).properties.periods[7].dewpoint. unitCode.slice(-1) "
  - id: Period_8_RelativeHumidity
    channelTypeUID: http:number
    label: Period 8 Relative Humidity
    description: null
    configuration:
      stateTransformation: JSONPATH:$.properties.periods[7].relativeHumidity.value
      unit: "%"
  - id: Period_8_WindSpeed
    channelTypeUID: http:number
    label: Period 8 Wind Speed
    description: null
    configuration:
      stateTransformation: JSONPATH:$.properties.periods[7].windSpeed
  - id: Period_8_Wind_Direction
    channelTypeUID: http:string
    label: Period 8 Wind Direction
    description: null
    configuration:
      stateTransformation: JSONPATH:$.properties.periods[7].windDirection
  - id: Period_8_Icon_URL
    channelTypeUID: http:string
    label: Period 8 Icon URL
    description: null
    configuration:
      stateTransformation: JSONPATH:$.properties.periods[7].icon
  - id: Period_8_Short_Forecast
    channelTypeUID: http:string
    label: Period 8 Short Forecast
    description: null
    configuration:
      stateTransformation: JSONPATH:$.properties.periods[7].shortForecast
  - id: Period_8_Detailed_Forecast
    channelTypeUID: http:string
    label: Period 8 Detailed Forecast
    description: null
    configuration:
      stateTransformation: JSONPATH:$.properties.periods[7].detailedForecast
  - id: Period_9_Name
    channelTypeUID: http:string
    label: Period 9 Name
    description: null
    configuration:
      stateTransformation: JSONPATH:$.properties.periods[8].name
  - id: Period_9_Start
    channelTypeUID: http:datetime
    label: Period 9 Start
    description: null
    configuration:
      stateTransformation: JSONPATH:$.properties.periods[8].startTime
  - id: Period_9_End
    channelTypeUID: http:datetime
    label: Period 9 End Time
    description: null
    configuration:
      stateTransformation: JSONPATH:$.properties.periods[8].endTime
  - id: Period_9_Daytime
    channelTypeUID: http:switch
    label: Period 9 Is Daytime
    description: null
    configuration:
      onValue: "true"
      offValue: "false"
      stateTransformation: JSONPATH:$.properties.periods[8].isDaytime
  - id: Period_9_Temperature
    channelTypeUID: http:number
    label: Period 9 Temperature
    description: null
    configuration:
      stateTransformation: JS:| JSON.parse(input).properties.periods[8].temperature +
        ' °' + JSON.parse(input).properties.periods[8].temperatureUnit
  - id: Period_9_Temperature_Trend
    channelTypeUID: http:string
    label: Period 9 Temperature Trend
    description: null
    configuration:
      stateTransformation: JSONPATH:$.properties.periods[8].temperatureTrend
  - id: Period_9_ProbPrecip
    channelTypeUID: http:number
    label: Period 9 Probability of Precipitation
    description: null
    configuration:
      stateTransformation: "JS:|
        (JSON.parse(input).properties.periods[8].probabilityOfPrecipitation.val\
        ue === null) ? 0 :
        JSON.parse(input).properties.periods[8].probabilityOfPrecipitation.valu\
        e"
      unit: "%"
  - id: Period_9_Dewpoint
    channelTypeUID: http:number
    label: Period 9 Dewpoint
    description: null
    configuration:
      stateTransformation: "JS:|
        JSON.parse(input).properties.periods[8].dewpoint.value + ' °' +
        JSON.parse(input).properties.periods[8].dewpoint. unitCode.slice(-1) "
  - id: Period_9_RelativeHumidity
    channelTypeUID: http:number
    label: Period 9 Relative Humidity
    description: null
    configuration:
      stateTransformation: JSONPATH:$.properties.periods[8].relativeHumidity.value
      unit: "%"
  - id: Period_9_WindSpeed
    channelTypeUID: http:number
    label: Period 9 Wind Speed
    description: null
    configuration:
      stateTransformation: JSONPATH:$.properties.periods[8].windSpeed
  - id: Period_9_Wind_Direction
    channelTypeUID: http:string
    label: Period 9 Wind Direction
    description: null
    configuration:
      stateTransformation: JSONPATH:$.properties.periods[8].windDirection
  - id: Period_9_Icon_URL
    channelTypeUID: http:string
    label: Period 9 Icon URL
    description: null
    configuration:
      stateTransformation: JSONPATH:$.properties.periods[8].icon
  - id: Period_9_Short_Forecast
    channelTypeUID: http:string
    label: Period 9 Short Forecast
    description: null
    configuration:
      stateTransformation: JSONPATH:$.properties.periods[8].shortForecast
  - id: Period_9_Detailed_Forecast
    channelTypeUID: http:string
    label: Period 9 Detailed Forecast
    description: null
    configuration:
      stateTransformation: JSONPATH:$.properties.periods[8].detailedForecast
  - id: Period_10_Name
    channelTypeUID: http:string
    label: Period 10 Name
    description: null
    configuration:
      stateTransformation: JSONPATH:$.properties.periods[9].name
  - id: Period_10_Start
    channelTypeUID: http:datetime
    label: Period 10 Start
    description: null
    configuration:
      stateTransformation: JSONPATH:$.properties.periods[9].startTime
  - id: Period_10_End
    channelTypeUID: http:datetime
    label: Period 10 End Time
    description: null
    configuration:
      stateTransformation: JSONPATH:$.properties.periods[9].endTime
  - id: Period_10_Daytime
    channelTypeUID: http:switch
    label: Period 10 Is Daytime
    description: null
    configuration:
      onValue: "true"
      offValue: "false"
      stateTransformation: JSONPATH:$.properties.periods[9].isDaytime
  - id: Period_10_Temperature
    channelTypeUID: http:number
    label: Period 10 Temperature
    description: null
    configuration:
      stateTransformation: JS:| JSON.parse(input).properties.periods[9].temperature +
        ' °' + JSON.parse(input).properties.periods[9].temperatureUnit
  - id: Period_10_Temperature_Trend
    channelTypeUID: http:string
    label: Period 10 Temperature Trend
    description: null
    configuration:
      stateTransformation: JSONPATH:$.properties.periods[9].temperatureTrend
  - id: Period_10_ProbPrecip
    channelTypeUID: http:number
    label: Period 10 Probability of Precipitation
    description: null
    configuration:
      stateTransformation: "JS:|
        (JSON.parse(input).properties.periods[9].probabilityOfPrecipitation.val\
        ue === null) ? 0 :
        JSON.parse(input).properties.periods[9].probabilityOfPrecipitation.valu\
        e"
      unit: "%"
  - id: Period_10_Dewpoint
    channelTypeUID: http:number
    label: Period 10 Dewpoint
    description: null
    configuration:
      stateTransformation: "JS:|
        JSON.parse(input).properties.periods[9].dewpoint.value + ' °' +
        JSON.parse(input).properties.periods[9].dewpoint. unitCode.slice(-1) "
  - id: Period_10_RelativeHumidity
    channelTypeUID: http:number
    label: Period 10 Relative Humidity
    description: null
    configuration:
      stateTransformation: JSONPATH:$.properties.periods[9].relativeHumidity.value
      unit: "%"
  - id: Period_10_WindSpeed
    channelTypeUID: http:number
    label: Period 10 Wind Speed
    description: null
    configuration:
      stateTransformation: JSONPATH:$.properties.periods[9].windSpeed
  - id: Period_10_Wind_Direction
    channelTypeUID: http:string
    label: Period 10 Wind Direction
    description: null
    configuration:
      stateTransformation: JSONPATH:$.properties.periods[9].windDirection
  - id: Period_10_Icon_URL
    channelTypeUID: http:string
    label: Period 10 Icon URL
    description: null
    configuration:
      stateTransformation: JSONPATH:$.properties.periods[9].icon
  - id: Period_10_Short_Forecast
    channelTypeUID: http:string
    label: Period 10 Short Forecast
    description: null
    configuration:
      stateTransformation: JSONPATH:$.properties.periods[9].shortForecast
  - id: Period_10_Detailed_Forecast
    channelTypeUID: http:string
    label: Period 10 Detailed Forecast
    description: null
    configuration:
      stateTransformation: JSONPATH:$.properties.periods[9].detailedForecast
  - id: Period_11_Name
    channelTypeUID: http:string
    label: Period 11 Name
    description: null
    configuration:
      stateTransformation: JSONPATH:$.properties.periods[10].name
  - id: Period_11_Start
    channelTypeUID: http:datetime
    label: Period 11 Start
    description: null
    configuration:
      stateTransformation: JSONPATH:$.properties.periods[10].startTime
  - id: Period_11_End
    channelTypeUID: http:datetime
    label: Period 11 End Time
    description: null
    configuration:
      stateTransformation: JSONPATH:$.properties.periods[10].endTime
  - id: Period_11_Daytime
    channelTypeUID: http:switch
    label: Period 11 Is Daytime
    description: null
    configuration:
      onValue: "true"
      offValue: "false"
      stateTransformation: JSONPATH:$.properties.periods[10].isDaytime
  - id: Period_11_Temperature
    channelTypeUID: http:number
    label: Period 11 Temperature
    description: null
    configuration:
      stateTransformation: JS:| JSON.parse(input).properties.periods[10].temperature +
        ' °' + JSON.parse(input).properties.periods[10].temperatureUnit
  - id: Period_11_Temperature_Trend
    channelTypeUID: http:string
    label: Period 11 Temperature Trend
    description: null
    configuration:
      stateTransformation: JSONPATH:$.properties.periods[10].temperatureTrend
  - id: Period_11_ProbPrecip
    channelTypeUID: http:number
    label: Period 11 Probability of Precipitation
    description: null
    configuration:
      stateTransformation: "JS:|
        (JSON.parse(input).properties.periods[10].probabilityOfPrecipitation.va\
        lue === null) ? 0 :
        JSON.parse(input).properties.periods[10].probabilityOfPrecipitation.val\
        ue"
      unit: "%"
  - id: Period_11_Dewpoint
    channelTypeUID: http:number
    label: Period 11 Dewpoint
    description: null
    configuration:
      stateTransformation: "JS:|
        JSON.parse(input).properties.periods[10].dewpoint.value + ' °' +
        JSON.parse(input).properties.periods[10].dewpoint. unitCode.slice(-1) "
  - id: Period_11_RelativeHumidity
    channelTypeUID: http:number
    label: Period 11 Relative Humidity
    description: null
    configuration:
      stateTransformation: JSONPATH:$.properties.periods[10].relativeHumidity.value
      unit: "%"
  - id: Period_11_WindSpeed
    channelTypeUID: http:number
    label: Period 11 Wind Speed
    description: null
    configuration:
      stateTransformation: JSONPATH:$.properties.periods[10].windSpeed
  - id: Period_11_Wind_Direction
    channelTypeUID: http:string
    label: Period 11 Wind Direction
    description: null
    configuration:
      stateTransformation: JSONPATH:$.properties.periods[10].windDirection
  - id: Period_11_Icon_URL
    channelTypeUID: http:string
    label: Period 11 Icon URL
    description: null
    configuration:
      stateTransformation: JSONPATH:$.properties.periods[10].icon
  - id: Period_11_Short_Forecast
    channelTypeUID: http:string
    label: Period 11 Short Forecast
    description: null
    configuration:
      stateTransformation: JSONPATH:$.properties.periods[10].shortForecast
  - id: Period_11_Detailed_Forecast
    channelTypeUID: http:string
    label: Period 11 Detailed Forecast
    description: null
    configuration:
      stateTransformation: JSONPATH:$.properties.periods[10].detailedForecast
  - id: Period_12_Name
    channelTypeUID: http:string
    label: Period 12 Name
    description: null
    configuration:
      stateTransformation: JSONPATH:$.properties.periods[11].name
  - id: Period_12_Start
    channelTypeUID: http:datetime
    label: Period 12 Start
    description: null
    configuration:
      stateTransformation: JSONPATH:$.properties.periods[11].startTime
  - id: Period_12_End
    channelTypeUID: http:datetime
    label: Period 12 End Time
    description: null
    configuration:
      stateTransformation: JSONPATH:$.properties.periods[11].endTime
  - id: Period_12_Daytime
    channelTypeUID: http:switch
    label: Period 12 Is Daytime
    description: null
    configuration:
      onValue: "true"
      offValue: "false"
      stateTransformation: JSONPATH:$.properties.periods[11].isDaytime
  - id: Period_12_Temperature
    channelTypeUID: http:number
    label: Period 12 Temperature
    description: null
    configuration:
      stateTransformation: JS:| JSON.parse(input).properties.periods[11].temperature +
        ' °' + JSON.parse(input).properties.periods[11].temperatureUnit
  - id: Period_12_Temperature_Trend
    channelTypeUID: http:string
    label: Period 12 Temperature Trend
    description: null
    configuration:
      stateTransformation: JSONPATH:$.properties.periods[11].temperatureTrend
  - id: Period_12_ProbPrecip
    channelTypeUID: http:number
    label: Period 12 Probability of Precipitation
    description: null
    configuration:
      stateTransformation: "JS:|
        (JSON.parse(input).properties.periods[11].probabilityOfPrecipitation.va\
        lue === null) ? 0 :
        JSON.parse(input).properties.periods[11].probabilityOfPrecipitation.val\
        ue"
      unit: "%"
  - id: Period_12_Dewpoint
    channelTypeUID: http:number
    label: Period 12 Dewpoint
    description: null
    configuration:
      stateTransformation: "JS:|
        JSON.parse(input).properties.periods[11].dewpoint.value + ' °' +
        JSON.parse(input).properties.periods[11].dewpoint. unitCode.slice(-1) "
  - id: Period_12_RelativeHumidity
    channelTypeUID: http:number
    label: Period 12 Relative Humidity
    description: null
    configuration:
      stateTransformation: JSONPATH:$.properties.periods[11].relativeHumidity.value
      unit: "%"
  - id: Period_12_WindSpeed
    channelTypeUID: http:number
    label: Period 12 Wind Speed
    description: null
    configuration:
      stateTransformation: JSONPATH:$.properties.periods[11].windSpeed
  - id: Period_12_Wind_Direction
    channelTypeUID: http:string
    label: Period 12 Wind Direction
    description: null
    configuration:
      stateTransformation: JSONPATH:$.properties.periods[11].windDirection
  - id: Period_12_Icon_URL
    channelTypeUID: http:string
    label: Period 12 Icon URL
    description: null
    configuration:
      stateTransformation: JSONPATH:$.properties.periods[11].icon
  - id: Period_12_Short_Forecast
    channelTypeUID: http:string
    label: Period 12 Short Forecast
    description: null
    configuration:
      stateTransformation: JSONPATH:$.properties.periods[11].shortForecast
  - id: Period_12_Detailed_Forecast
    channelTypeUID: http:string
    label: Period 12 Detailed Forecast
    description: null
    configuration:
      stateTransformation: JSONPATH:$.properties.periods[11].detailedForecast
  - id: Period_13_Name
    channelTypeUID: http:string
    label: Period 13 Name
    description: null
    configuration:
      stateTransformation: JSONPATH:$.properties.periods[12].name
  - id: Period_13_Start
    channelTypeUID: http:datetime
    label: Period 13 Start
    description: null
    configuration:
      stateTransformation: JSONPATH:$.properties.periods[12].startTime
  - id: Period_13_End
    channelTypeUID: http:datetime
    label: Period 13 End Time
    description: null
    configuration:
      stateTransformation: JSONPATH:$.properties.periods[12].endTime
  - id: Period_13_Daytime
    channelTypeUID: http:switch
    label: Period 13 Is Daytime
    description: null
    configuration:
      onValue: "true"
      offValue: "false"
      stateTransformation: JSONPATH:$.properties.periods[12].isDaytime
  - id: Period_13_Temperature
    channelTypeUID: http:number
    label: Period 13 Temperature
    description: null
    configuration:
      stateTransformation: JS:| JSON.parse(input).properties.periods[12].temperature +
        ' °' + JSON.parse(input).properties.periods[12].temperatureUnit
  - id: Period_13_Temperature_Trend
    channelTypeUID: http:string
    label: Period 13 Temperature Trend
    description: null
    configuration:
      stateTransformation: JSONPATH:$.properties.periods[12].temperatureTrend
  - id: Period_13_ProbPrecip
    channelTypeUID: http:number
    label: Period 13 Probability of Precipitation
    description: null
    configuration:
      stateTransformation: "JS:|
        (JSON.parse(input).properties.periods[12].probabilityOfPrecipitation.va\
        lue === null) ? 0 :
        JSON.parse(input).properties.periods[12].probabilityOfPrecipitation.val\
        ue"
      unit: "%"
  - id: Period_13_Dewpoint
    channelTypeUID: http:number
    label: Period 13 Dewpoint
    description: null
    configuration:
      stateTransformation: "JS:|
        JSON.parse(input).properties.periods[12].dewpoint.value + ' °' +
        JSON.parse(input).properties.periods[12].dewpoint. unitCode.slice(-1) "
  - id: Period_13_RelativeHumidity
    channelTypeUID: http:number
    label: Period 13 Relative Humidity
    description: null
    configuration:
      stateTransformation: JSONPATH:$.properties.periods[12].relativeHumidity.value
      unit: "%"
  - id: Period_13_WindSpeed
    channelTypeUID: http:number
    label: Period 13 Wind Speed
    description: null
    configuration:
      stateTransformation: JSONPATH:$.properties.periods[12].windSpeed
  - id: Period_13_Wind_Direction
    channelTypeUID: http:string
    label: Period 13 Wind Direction
    description: null
    configuration:
      stateTransformation: JSONPATH:$.properties.periods[12].windDirection
  - id: Period_13_Icon_URL
    channelTypeUID: http:string
    label: Period 13 Icon URL
    description: null
    configuration:
      stateTransformation: JSONPATH:$.properties.periods[12].icon
  - id: Period_13_Short_Forecast
    channelTypeUID: http:string
    label: Period 13 Short Forecast
    description: null
    configuration:
      stateTransformation: JSONPATH:$.properties.periods[12].shortForecast
  - id: Period_13_Detailed_Forecast
    channelTypeUID: http:string
    label: Period 13 Detailed Forecast
    description: null
    configuration:
      stateTransformation: JSONPATH:$.properties.periods[12].detailedForecast
  - id: Period_14_Name
    channelTypeUID: http:string
    label: Period 14 Name
    description: null
    configuration:
      stateTransformation: JSONPATH:$.properties.periods[13].name
  - id: Period_14_Start
    channelTypeUID: http:datetime
    label: Period 14 Start
    description: null
    configuration:
      stateTransformation: JSONPATH:$.properties.periods[13].startTime
  - id: Period_14_End
    channelTypeUID: http:datetime
    label: Period 14 End Time
    description: null
    configuration:
      stateTransformation: JSONPATH:$.properties.periods[13].endTime
  - id: Period_14_Daytime
    channelTypeUID: http:switch
    label: Period 14 Is Daytime
    description: null
    configuration:
      onValue: "true"
      offValue: "false"
      stateTransformation: JSONPATH:$.properties.periods[13].isDaytime
  - id: Period_14_Temperature
    channelTypeUID: http:number
    label: Period 14 Temperature
    description: null
    configuration:
      stateTransformation: JS:| JSON.parse(input).properties.periods[13].temperature +
        ' °' + JSON.parse(input).properties.periods[13].temperatureUnit
  - id: Period_14_Temperature_Trend
    channelTypeUID: http:string
    label: Period 14 Temperature Trend
    description: null
    configuration:
      stateTransformation: JSONPATH:$.properties.periods[13].temperatureTrend
  - id: Period_14_ProbPrecip
    channelTypeUID: http:number
    label: Period 14 Probability of Precipitation
    description: null
    configuration:
      stateTransformation: "JS:|
        (JSON.parse(input).properties.periods[13].probabilityOfPrecipitation.va\
        lue === null) ? 0 :
        JSON.parse(input).properties.periods[13].probabilityOfPrecipitation.val\
        ue"
      unit: "%"
  - id: Period_14_Dewpoint
    channelTypeUID: http:number
    label: Period 14 Dewpoint
    description: null
    configuration:
      stateTransformation: "JS:|
        JSON.parse(input).properties.periods[13].dewpoint.value + ' °' +
        JSON.parse(input).properties.periods[13].dewpoint. unitCode.slice(-1) "
  - id: Period_14_RelativeHumidity
    channelTypeUID: http:number
    label: Period 14 Relative Humidity
    description: null
    configuration:
      stateTransformation: JSONPATH:$.properties.periods[13].relativeHumidity.value
      unit: "%"
  - id: Period_14_WindSpeed
    channelTypeUID: http:number
    label: Period 14 Wind Speed
    description: null
    configuration:
      stateTransformation: JSONPATH:$.properties.periods[13].windSpeed
  - id: Period_14_Wind_Direction
    channelTypeUID: http:string
    label: Period 14 Wind Direction
    description: null
    configuration:
      stateTransformation: JSONPATH:$.properties.periods[13].windDirection
  - id: Period_14_Icon_URL
    channelTypeUID: http:string
    label: Period 14 Icon URL
    description: null
    configuration:
      stateTransformation: JSONPATH:$.properties.periods[13].icon
  - id: Period_14_Short_Forecast
    channelTypeUID: http:string
    label: Period 14 Short Forecast
    description: null
    configuration:
      stateTransformation: JSONPATH:$.properties.periods[13].shortForecast
  - id: Period_14_Detailed_Forecast
    channelTypeUID: http:string
    label: Period 14 Detailed Forecast
    description: null
    configuration:
      stateTransformation: JSONPATH:$.properties.periods[13].detailedForecast

  • In the rule, use newState.toString instead of (HTTP_URL_Thing_Weather.state as StringType).toString. It’s unlikely to be a problem in this case, but you cannot always guarantee that the Item hasn’t changed state in the mean time.

  • I assume it always has 14 entries. Given that a loop could be used to greatly reduce the length of the rule. Furthermore it can allow people to choose how many forecast days they want to process by changing the length of the loop.

val json = newState.toString
val rh = transform("JSONPATH", "$.properties.periods[0].relativeHumidity.value", json)
val wind = transform("JSONPATH", "$.properties.periods[0].windSpeed", json)
val forecast = transform("JSONPATH", "$.properties.generatedAt", json)
weather0rh.postUpdate(rh)
weather0wind.postUpdate(wind)
weather0forecast.postUpdate(forecast)
for(var i = 0; i < 14; i++) {
  val period = "$.properties.periods[" + i + "]"
  val icon = transform("JSONPATH", period+".icon", json)
  val name = transform("JSONPATH", period+".name", json)
  val sf = transform("JSONPATH", period+".shortForecast", json)
  val temp = transform("JSONPATH", period+".temperature", json)
  val tempUnit = transform("JSONPATH", period+".temperatureUnit", json)
  val day = transform("JSONPATH", period+".isDaytime", json);
  val wdf = transform("JSONPATH", period+".detailedForecast", json)

  logInfo('NWS', 'name'+i+": " + name)
  logInfo('NWS', 'short'+i+": " + sf)
  logInfo('NWS', 'icon'+i+": " + icon)

  val itemPrefix = 'weather'+i
  postUpdate(itemPrefix+'icon', icon)
  postUpdate(itemPrefix+'sf', sf)
  postUpdate(itemPrefix+'name', name)
  postUpdate(itemPrefix+'temp', temp+' ' + tempUnit) // assumes a Number:Temperature Item
  postUpdate(itemPrefix+'day', day)
  postUpdate('df'+1, wdf)
}

It can be even more effecient in JS Scripting because it has native support for JSON

var parsed = JSON.parse(event.newState.toString());
items.weather0rh.postUpdate(parsed.properties.period[0].relativeHumidity.value);
item.weather0wind.postUpdate(parsed.properties.period[0].windSpeed);
item.weather0forecast.postUpdate(parsed.properties.generatedAt);
for(period in parsed.properties.periods) {
  const num = period.number - 1;

  console.log('name' + num + ': ' + period.name);
  console.log('sf' + num + ': ' + period.shortForecast);
  console.log('icon'+ num +': ' + period.icon);

  const itemPrefix = 'weather'+num;
  items[itemPrefix+'icon'].postUpdate(period.icon);
  items[itemPrefix+'name'].postUpdate(period.name);
  items[itemPrefix+'sf'].postUpdate(period.shortForecast);
  items[itemPrefix+'temp'].postUpdate(period.temperature + ' ' + period.temperatureUnit)
  items[itemPrefix+'day'].postUpdate(period.isDaytime);
  items[itemPrefix+'wdf'].postUpdate(period.detailedForecast);
}
  • Have you tested this code? There is no such thing as logger in Rule DSL and one doesn’t typically add a ; to the end of lines in Rules DSL. Maybe this code was generated by an AI ChatBot? They often get the various rules languages OH supports mixed up. You can see examples of logging statements in Rules DSL above.

Thanks for the suggestions :slight_smile: I will check them out sometime soon, I am super excited that you put so much effort into helping me out here and simplifying things, making them more streamlined for sharing, and more efficient for kB’s sake!

Interesting about the logger not existing… I have indeed tested this code, and I am able to see these values get logged in frontail in a stream of events as updates come through. I don’t recall if I had an AI touch that stuff but it’s totally possible. I wasn’t sure if the console interactions required the semicolon, and found it odd that they weren’t needed for each line! I’ll post an update when I make any changes :grin:

That’s very curious indeed. Maybe there is a difference between file based rules and managed rules. When I try to use that I get

2024-02-21 08:52:50.712 [ERROR] [internal.handler.ScriptActionHandler] - Script execution of rule with UID 'rulesdsl-scratchpad' failed:  ___ logger.info("hello world" )
The field logger is not visible; line 1, column 0, length 6  

I’ve been running with the Thing configuration and it appears to be working quite nicely. I looked into the alerting end point too but that is going to require a rule I think.

I’m very pleased that you’re getting good results from it!!

Next, I have a Steam API linter that looks for the title of which game you are currently playing, its appID, and a link to a banner image representing the game. I have a lot of cleaning up to do with that one before it can even resemble the inelegance of this one, but at some point in the near future I intend to share that as well!

As for the alerts, https://api.weather.gov/alerts/active?point={{your coordinates from the forecast}}
That should produce what you need :grin:

Oh, I know about the end point. And in fact, using the county code produces better results. See https://www.weather.gov/media/documentation/docs/NWS_Geolocation.pdf. When you hit the first URL you posted above will give you the “county” URL. If you use the county ID to pull the alerts you’ll get them all. If you use point or forecast zone you might miss some alerts. https://api.weather.gov/alerts/active?zone={{county id}}

The problem with the end point is you don’t know ahead of time how many alerts there may be. There might be none, there might be five. That’s challenging to handle in a Thing and in Items. Handling that well will require a rule I think. We’ll see.

And it used to be the case that there was a separate end point with predicted precipitation totals (e.g. 5 in of snow) but I can’t find that end point right now. The problem with that end point though was that it was variable length and each entry in the array covered an arbitrary amount of time. I eventually gave up trying to calculate a daily precipitation total from it. It looks like the API has changed quite a bit since I last looked at it though. Maybe it’s better now.

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.