Announcement

Collapse
No announcement yet.

Remember a peak value?

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

    Remember a peak value?

    Hi all. I have a virtual device (A) which adds several values together. I want to create a new VD (B) that notes what the highest value of (A) was. So if A reached 10 yesterday, but 11 today - Device B should equal 11.

    Any ideas? Thanks!

    #2
    That would be easy with a script that is called from an event when VD(A) changes. It would check the value of VD(A) against the value of VD(B) and if the new value was higher, change it, and if it was lower or the same, do nothing.
    HS 4.2.8.0: 2134 Devices 1252 Events
    Z-Wave 3.0.10.0: 133 Nodes on one Z-Net

    Comment


      #3
      Also can be done with Easy Trigger “Set Device to Expression”. Set VD[B] to Max(VD[A], VD[B]). Use the replacement variables for VD A & B.
      HS4 Pro, 4.2.19.16 Windows 10 pro, Supermicro LP Xeon

      Comment


        #4
        Originally posted by rprade View Post
        Also can be done with Easy Trigger “Set Device to Expression”. Set VD[B] to Max(VD[A], VD[B]). Use the replacement variables for VD A & B.
        Thanks for that. I'm a novice with this sort of thing - my VD numbers are 192[A] and 495[B] respectively. Is this the right idea? Click image for larger version

Name:	hs1.jpg
Views:	31
Size:	57.0 KB
ID:	1276017
        Attached Files

        Comment


          #5
          readi343 - I think your expression needs to be something like ...

          Max( $$DVR:192: , $$DRV:495: )

          $$DVR:ref: is the replacement variable that you use in an expression to get the value of the device using the devices reference number (DVR = Device Value by Reference). Be sure that the reference number is between two colons as in the example. I think you also need a space after the trailing colon


          For reference, for a list of operators you can use in an Easy Trigger expression, see: https://forums.homeseer.com/forum/ul...in-easytrigger

          And instead of having your script trigger every 10 seconds, it may be better to have it trigger on any change of the underlying devices 192 or 495 so you don't miss a change and, thus, miss a peak reading.

          Comment


            #6
            Originally posted by jvm View Post
            readi343 - I think your expression needs to be something like ...

            Max( $$DVR:192: + $$DRV:495: )

            $$DVR:ref: is the replacement variable that you use in an expression to get the value of the device using the devices reference number (DVR = Device Value by Reference). Be sure that the reference number is between two colons as in the example. I think you also need a space after the trailing colon


            For reference, for a list of operators you can use in an Easy Trigger expression, see: https://forums.homeseer.com/forum/ul...in-easytrigger

            And instead of having your script trigger every 10 seconds, it may be better to have it trigger on any change of the underlying devices 192 or 495 so you don't miss a change and, thus, miss a peak reading.
            Thanks JVM,

            I was able to get that working - and for anyone following this thread in the future I had to make a couple small tweaks:

            Max($$DVR:192: , $$DVR:495: )

            Also thank you for the link. Scripting is very daunting when you have zero experience, but willpower prevails =)

            Comment


              #7
              Originally posted by readi343 View Post

              Scripting is very daunting when you have zero experience, but willpower prevails =)
              That is true, but there are many of examples of scripts on the board that can get you started. Once you get going, it becomes much simpler over time and you can find many code samples on the internet. In case you were wondering, here would be the equivalent script:

              Code:
              Sub Main(ByVal Parms As String)
                  If hs.deviceValueEx(192) > hs.deviceValueEx(495) Then hs.setDeviceValueByRef(495,hs.deviceValueEx(192),True)
              End Sub
              I do have EasyTrigger myself, but I have used HS for many years before it became available, so scripting is typically what I gravitate to.
              HS 4.2.8.0: 2134 Devices 1252 Events
              Z-Wave 3.0.10.0: 133 Nodes on one Z-Net

              Comment


                #8
                My bad! I should have pointed to replacement variables, something I usually do. It sounds like you found them, but just in case

                https://help.homeseer.com/help/HS3/s...ment_variables
                HS4 Pro, 4.2.19.16 Windows 10 pro, Supermicro LP Xeon

                Comment

                Working...
                X