Announcement

Collapse
No announcement yet.

Simple Scripting Help

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Simple Scripting Help

    Hi All,

    Can I get someone to help me figure out why my temperature variables are not showing as 1 decimal place.

    Not a scripter - just a copy, change, hunt and peck person trying to scrape by.

    I wanted to create a temperature rate change per hour. I use UltraWeatherWU3 but WU does not provide a rate per hour variable. S1 refers to the Station 1 temperature (which does show to 1 decimal). I created two variables by copying that device. They immediately show 1 decimal just like the original. But then when I run the script these variables come back as integer values.


    Sub Main(ByVal Parms As Object)
    ' Set the value of S1 Rate to 4x the change between the just changed S1 Temp and the stored prior S1 Temp
    ' Delta is the Difference between S1 (431) and prior S1 (635)
    ' Multiply by 4 since I am using 15 minute refresh in UltraWeatherWU
    ' After Rate is calculated then store the new S1 into Prior S1
    Dim Delta
    Dim Rate
    Delta = hs.Devicevalue(431) - hs.Devicevalue(635)
    Rate = 4 * Delta
    hs.SetDeviceValueByRef(636, Rate, True)
    hs.SetDeviceValueByRef(635, hs.devicevalue(431), True)
    hs.WriteLog("WHF", "S1 Rate" & hs.devicevalue(636))
    hs.WriteLog("WHF", "New S1 Prior " & hs.devicevalue(635))
    end sub

    Thanks in advance for any help. No laughing

    Regards,
    Vector

    #2
    See https://help.homeseer.com/help/HS3/s...es_devicevalue

    Note: This return is an INTEGER value and values are DOUBLE INTEGER, which means that decimal values are truncated. See DeviceValueEx for Double Integer returns.

    Try changing all 'Devicevalue' to 'DevicevalueEx'.

    Comment


      #3
      Thank you!

      That does it. I guess I need to spend more time in the "hunting" part in the help file.

      Regards,
      Vector

      Comment

      Working...
      X