I had a small script working for me under HS2 that extracted the Windspeed integer from an Environment Canada device string and created a device with the DeviceValue equal to Windspeed. I used this to power down inflatable decorations when the wind was too strong. Here is the HS2 script:
sub main()
Dim WindArr() as String
Dim WindSpeed As Integer
WindArr = Split(hs.DeviceValue("W89")
WindSpeed = WindArr(1)
hs.SetDeviceString("W99",WindAarr(1))
hs.SetDeviceValue("W99",WindSpeed)
end sub
It would act on the Device below and set another Device Value to windspeed (14 in this example). I suppose ideally, if there is a 2nd number (ie. gust), then it should pull that number instead --- there is not always a gust speed though. I'd be happy just to get the first number. The script above does not work in HS3. Any help with this would be appreciated --- I didn't write the original script, it was provided by a helpful forum member.
Thanks.
Dim WindArr() as String
Dim WindSpeed As Integer
WindArr = Split(hs.DeviceValue("W89")
WindSpeed = WindArr(1)
hs.SetDeviceString("W99",WindAarr(1))
hs.SetDeviceValue("W99",WindSpeed)
end sub
It would act on the Device below and set another Device Value to windspeed (14 in this example). I suppose ideally, if there is a 2nd number (ie. gust), then it should pull that number instead --- there is not always a gust speed though. I'd be happy just to get the first number. The script above does not work in HS3. Any help with this would be appreciated --- I didn't write the original script, it was provided by a helpful forum member.
Thanks.
WSW 14 km/h gust 32 km/h | Weather | Environment Canada | Wind Speed/Direction | Today 3:27:21 PM |