Hi.
I am trying to split a string (from a Oregon wind sensor via RFXcom) into:
"2,3" and "m/Sec: 1Bft" instead of "2,3 m/Sec: 1Bft" and place 2,3 as a value in a virtual device.
I have managed to split the string by this script
But I can´t get it to set the virtual devices value (137). I have tried
hs.setDeviceValue("137", splitVal(0)):confused:
but that gives me an error in the log.
I guess a trained eye can see right away what I am missing, but I am very new to scripting so please forgive me.
I am trying to split a string (from a Oregon wind sensor via RFXcom) into:
"2,3" and "m/Sec: 1Bft" instead of "2,3 m/Sec: 1Bft" and place 2,3 as a value in a virtual device.
I have managed to split the string by this script
Code:
Sub Main(parm as object)
dim sVal as string = hs.deviceString("45")
dim splitVal() as string
splitVal = sVal.split("m")
hs.writelog("data",splitVal(0))
hs.writelog("data",splitVal(1))
End Sub
hs.setDeviceValue("137", splitVal(0)):confused:
but that gives me an error in the log.
I guess a trained eye can see right away what I am missing, but I am very new to scripting so please forgive me.