Announcement

Collapse
No announcement yet.

Rounding a device value for display in HSTouch

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

    Rounding a device value for display in HSTouch

    I have added a new temp sensor that returns a value with tenths. In my HSTouch app, in status tracking I need to display the value without any decimal points. I've done some searches and can't seem to find a solution. Ideas?

    Thanks

    Robert

    ETA: the device is a Aeotec Multisensor 6. Expensive but nice. It has been in use for 6 months. I'm impressed with the device.

    #2
    Historically the way to do this was either by a $SCRIPT tag in the HSTouch screen or by creating an intermediate virtual device that contained the rounded down value (done via a script that updated on a value change) and you used that device in HSTouch. With HS3 however you might be able to change the device value pair properties in your device and set the number of decimal places to zero however sometimes plugins do reset that value and you would lose that from the main HS UI.

    You can try putting something like this in the label text field...although I don't think I've done this since HS2!

    [$SCRIPT=&hs.devicevalue(1234)]

    Comment


      #3
      I vote for creating a new device and storing the rounded value there, then using that device for status tracking.
      Mike____________________________________________________________ __________________
      HS3 Pro Edition 3.0.0.548, NUC i3

      HW: Stargate | NX8e | CAV6.6 | Squeezebox | PCS | WGL 800RF | RFXCOM | Vantage Pro | Green-Eye | Edgeport/8 | Way2Call | Ecobee3 | EtherRain | Ubiquiti

      Comment


        #4
        If you want you can set the decimal places in the status graphics. See Dec Places below. Setting to zero will give you an integer value. This is from an aoetec multisensor temperature device.

        Click image for larger version

Name:	Screenshot from 2020-05-10 10-44-11.png
Views:	180
Size:	52.8 KB
ID:	1384374

        Comment


          #5
          I have created a virtual device to hold the rounded value. The actual sensor device is ref# 893. The new virtual device is ref# 941. I do have EasyTrigger if needed.

          How do I get the rounded value into the virtual device?

          Comment


            #6
            Use the set device to another device in EasyTrigger actions. You can trigger based on when the temperature value changes.

            here is a dummy example

            Click image for larger version

Name:	Screenshot from 2020-05-10 11-11-57.png
Views:	177
Size:	39.3 KB
ID:	1384379

            Comment


              #7
              Thanks all. I think I'm on the right track.

              Stay safe.

              Comment


                #8
                I've addressed the same issue by just changing the decimal places in the device itself - as shown above by AllHailJ. Change it on the device and HSTouch changes. I use one decimal point for temps and zero decimal points for watts on larger draw devices, for example. No need for scripts or virtual devices - just complicates things.

                Comment


                  #9
                  Originally posted by gregoryx View Post
                  I've addressed the same issue by just changing the decimal places in the device itself - as shown above by AllHailJ. Change it on the device and HSTouch changes. . . No need for scripts or virtual devices - just complicates things.
                  If all the device is to be used for is HSTouch display, this is an easy solution.
                  I chose to have parallel virtual devices in a separate HSTouch device location to allow me to maintain the original devices' info while having the freedom to modify them as needed for appearance in HSTouch. (Even if there is no immediate need other than HSTouch, there may be other uses that arise where the extra precision will be of use.)

                  Mike____________________________________________________________ __________________
                  HS3 Pro Edition 3.0.0.548, NUC i3

                  HW: Stargate | NX8e | CAV6.6 | Squeezebox | PCS | WGL 800RF | RFXCOM | Vantage Pro | Green-Eye | Edgeport/8 | Way2Call | Ecobee3 | EtherRain | Ubiquiti

                  Comment


                    #10
                    Originally posted by Uncle Michael View Post
                    If all the device is to be used for is HSTouch display, this is an easy solution.
                    I chose to have parallel virtual devices in a separate HSTouch device location to allow me to maintain the original devices' info while having the freedom to modify them as needed for appearance in HSTouch. (Even if there is no immediate need other than HSTouch, there may be other uses that arise where the extra precision will be of use.)
                    I remember having similar thoughts. I made sure it would "go back" by changing it back... and saved more virtual devices. I have WAY too many virtual devices already.

                    I found a couple other similar short-cuts for summing power/watt values across multiple devices by putting the value into a device that didn't otherwise use value (parent device of an Aeon power strip as one example). Allowed me to go back and delete a bunch of virtual devices and scripts that were doing the summing stuff in favor of a single event.

                    Comment

                    Working...
                    X