No announcement yet.

Script not displaying decimals for temperatures

  • Filter
  • Time
  • Show
Clear All
new posts

    Script not displaying decimals for temperatures

    I am running a script to display TRV temperatures in a virtual device. I have similar devices to display temperatures and setpoints, they all work fine.
    With this script although the device shows the temperature with a decimal, my script only shows integer numbers and I dont get why. On my other temperature display the script is pulling the values from RFXCoM devices, this here is from TRV zwave devices, maybe that makes a difference, I dont know. I did try defining trvsetoint (my variable for the temperature as decimal or string, but its still only showing an integer number.

    This is my script:

    dim array_trvs() as string = {"Guest Bed TRV Temp ","Study TRV Temp","Lounge TRV Temp","Kitchen TRV Temp","Gym TRV Temp"}
    dim trvsetpoint as double
    dim trvs_name as string = ""
    dim trvstr as string = ""
    sub Main(ByVal Parms as Object)
    trvs_name = ""
    trvstr = ""
    for each devw as string in array_trvs
                trvs_name = devw
               trvsetpoint = hs.DeviceValueByName(devw)
              If trvsetpoint >20
              trvstr = trvstr & trvs_name & " <span style='color:red'>" & trvsetpoint & " C" & "</span>" & "<br>"
              trvstr = trvstr & trvs_name & " <span style='color:blue'>" & trvsetpoint & " C" & "</span>" & "<br>"
              End If
          hs.SetDeviceString(1650, trvstr,true)
     Catch ex As Exception
    hs.WriteLog ("Array", "Error: " & ex.Message)
    End Try
    End Sub
    This is the display virtual device and one of the TRV devices:

    Attached Files
    Last edited by mikee123; March 23, 2018, 08:34 AM.

    Using the device management page, look at the device.

    Click on it get details.

    Look at the Status Graphics tab.

    Is there a setting for number of decimal places?

    If this is set, than the device management page uses it to display the value



      Use DeviceValueByNameEx

      Returns Double Not Integer......

      This function is the same as the DeviceValueEx function, except that you pass this function the text name of the device.

      Parameter: device_name
      Type: string
      Description: This is the name of the device and must contain both the location and name. If the device was named lamp and its location was living room, then the device_name parameter would be living room lamp.

      Return value: device value
      Type: Double Integer
      Description: This returns the value associated with the device


        Yes it working now. Great. Thanks