I'm writing a script to save the high and low temerature swings of a temp device. I read the old values right out of a virtual device campare it to the new temperature make any changes then write the whole string back to the virtual device. the high temp seems to be working but the low temp is allways equal to nowtemp and I dont know why. Anybody see something wrong?
sub Main()
dim nowtemp, recenthigh, recentlow, high, low
dim mystring, myarray
nowtemp = hs.devicevalue ("#21")
mystring = hs.devicestring ("s10")
myarray = Split(mystring)
recenthigh = myarray(6)
recentlow = myarray(11)
high = myarray(13)
low = myarray(15)
if recenthigh < nowtemp then recenthigh = nowtemp
if recentlow > nowtemp then recentlow = nowtemp
if high < nowtemp then high = nowtemp
if low > nowtemp then low = nowtemp
hs.SetDeviceString "s10","Current "& nowtemp &" " & "<br> Since Midnight High " & recenthigh &" " &"<br> Since Midnight Low "& recentlow &" " &"<br>High " & high &" " & "<br>Low " & low ,True
end sub
sub Main()
dim nowtemp, recenthigh, recentlow, high, low
dim mystring, myarray
nowtemp = hs.devicevalue ("#21")
mystring = hs.devicestring ("s10")
myarray = Split(mystring)
recenthigh = myarray(6)
recentlow = myarray(11)
high = myarray(13)
low = myarray(15)
if recenthigh < nowtemp then recenthigh = nowtemp
if recentlow > nowtemp then recentlow = nowtemp
if high < nowtemp then high = nowtemp
if low > nowtemp then low = nowtemp
hs.SetDeviceString "s10","Current "& nowtemp &" " & "<br> Since Midnight High " & recenthigh &" " &"<br> Since Midnight Low "& recentlow &" " &"<br>High " & high &" " & "<br>Low " & low ,True
end sub
Comment