After some further work on this issue since last week, I have found a way to get the NWS XML data using an OpenHAB rule without having to bring it in from an external Powershell script (although I have that working, as well). Here are the basic commands that allow me to capture, parse the XML data with XPath expressions, and update the OpenHAB items.
var String xmlkslc = executeCommandLine("curl -s -H accept:application/json -X GET 'https://www.wrh.noaa.gov/mesowest/getobextXml.php?sid=KSLC&num=2'", 3000) //Executes the curl string
// logInfo("ResponseNWSDataXML", xmlkslc) // Displays full output of URL
logInfo("ResponseNWSDataXML", "NWS Data Received")
var String testStationID = transform("XPATH", "string(//station/@id)", xmlkslc)
var String testTime = transform("XPATH", "string(//ob[1]/@time)", xmlkslc)
var String testUTime = transform("XPATH", "string(//ob[1]/@utime)", xmlkslc)
var DateTimeType testCurTime = new DateTimeType(testUTime)
var Number testTempF = Float::parseFloat(transform("XPATH", "number(//ob[1]/variable[@var='T']/@value)", xmlkslc))
var Number testRH = Float::parseFloat(transform("XPATH", "number(//ob[1]/variable[@var='RH']/@value)", xmlkslc))
var String testWindDir = transform("XPATH", "string(//ob[1]/variable[@var='DDCARD']/@value)", xmlkslc)
var Number testWindSpeedMPH = Float::parseFloat(transform("XPATH", "number(//ob[1]/variable[@var='FF']/@value)", xmlkslc))
var Number testWindGustMPH = Float::parseFloat(transform("XPATH", "number(//ob/variable[@var='FFGUST']/@value)", xmlkslc))
var Number testVisibility = Float::parseFloat(transform("XPATH", "number(//ob[1]/variable[@var='VV']/@value)", xmlkslc))
var String testWeatherCond = transform("XPATH", "string(//ob/variable[@var='WEA']/@value)", xmlkslc)
logInfo("testStationID", testStationID)
logInfo("testTime", testTime)
logInfo("testUTime", testUTime)
logInfo("testCurTime", testCurTime.toString)
logInfo("testTempF", testTempF.toString)
logInfo("testRH", testRH.toString)
logInfo("testWindDir", testWindDir)
logInfo("testWindSpeedMPH", testWindSpeedMPH.toString)
logInfo("testWindGustMPH", testWindGustMPH.toString)
logInfo("testVisibility", testVisibility.toString)
logInfo("testWeatherCond", testWeatherCond)
NWSCurrentTemperature.postUpdate(testTempF)
NWSCurrentWindDirection.postUpdate(testWindDir)
NWSCurrentWindSpeed.postUpdate(testWindSpeedMPH)
NWSCurrentRelativeHumidity.postUpdate(testRH)
NWSCurrentWeatherCondition.postUpdate(testWeatherCond)
NWSTimestamp.postUpdate(testCurTime.toString)
The log file output looks like this:
==> /var/log/openhab2/openhab.log <==
2020-04-13 19:16:01.185 [INFO ] [home.model.script.ResponseNWSDataXML] - NWS Data Received
2020-04-13 19:16:01.499 [INFO ] [smarthome.model.script.testStationID] - KSLC
2020-04-13 19:16:01.503 [INFO ] [ipse.smarthome.model.script.testTime] - 13 Apr 6:55 pm
2020-04-13 19:16:01.506 [INFO ] [pse.smarthome.model.script.testUTime] - 1586825700
2020-04-13 19:16:01.510 [INFO ] [e.smarthome.model.script.testCurTime] - 2020-04-14T00:55:00.000+0000
2020-04-13 19:16:01.513 [INFO ] [pse.smarthome.model.script.testTempF] - 45.0
2020-04-13 19:16:01.516 [INFO ] [clipse.smarthome.model.script.testRH] - 14.0
2020-04-13 19:16:01.519 [INFO ] [e.smarthome.model.script.testWindDir] - NNW
2020-04-13 19:16:01.523 [INFO ] [rthome.model.script.testWindSpeedMPH] - 16.0
2020-04-13 19:16:01.526 [INFO ] [arthome.model.script.testWindGustMPH] - 26.0
2020-04-13 19:16:01.530 [INFO ] [marthome.model.script.testVisibility] - 10.0
2020-04-13 19:16:01.533 [INFO ] [arthome.model.script.testWeatherCond] - Clear