Announcement

Collapse
No announcement yet.

Rounding down a value

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

    Rounding down a value

    a= hs.DeviceValue(2395)

    a returns a value ​of say 19.8 is there a way to round it down to 19, ie. remove the decimal places.

    Thanks.
    sigpic
    A founder member of "The HA Pioneer Group" otherwise known as the "Old farts club!"

    #2
    Not sure how you would be getting decimals from that code.

    hs.DeviceValue returns an Integer whereas hs.DeviceValueEx returns a double which would include the decimal.
    Jon

    Comment


      #3
      assuming you're using VB:
      a = Math.Floor(hs.DeviceValueEx(2395))

      Comment


        #4
        Thanks Jon00,

        DeviceValue was returning 19.8 as 20, have changed the script to DeviceValueEx so hopefully HS will now realise that 19.8 is less than 20!
        sigpic
        A founder member of "The HA Pioneer Group" otherwise known as the "Old farts club!"

        Comment

        Working...
        X