Announcement

Collapse
No announcement yet.

How to combine device status's into virtual device

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

    How to combine device status's into virtual device

    OK, I'm stumped. I've tried figuring this out for a couple days but I give up. This will be easy for you guys, I'm sure. So I have the main panel energy monitor, and it only shows watts for each leg separately. Though...there is one child device called "Power" that sure looks like the combined power but it never updates.

    I found the post by rmasonjr where he wrote a script to do this but it isn't working for me. Here is my script:

    And the error.


    Thanks!
    Chris

    #2
    I'm not an expert on this, and hopefully Rob will chime in. I don't know if you or I have the latest version. Mine does work.
    This is what I have.
    Code:
    Sub Main(Parms as Object)
        hs.setDeviceString(166,"",True)
        hs.setDeviceString(166,(hs.deviceValue(145) +hs.deviceValue(148)) & "kWh",True)
    
    End Sub
    Tom
    baby steps...starting again with HS3
    HS3Pro: Z-NET & 80 Z wave Devices,
    HSTouch: 4 Joggler (Android Kitkat), 2 iPhone, 3 iPads
    Whole House Audio: 5 SqueezePlay Jogglers w Bose Speakers
    In The Works: 10 Cameras Geovision, new Adecmo/Envisalink Alarm, Arduinos
    System: XP on Fanless Mini-ITX w/ SSD

    Comment


      #3
      Hi Chris - Tom has it right. Your script has a lot of extra spaces between the script command and the parens. If you will edit your script to look like Tom's and replace with your device id's you should be good to go.

      Let us know if that doesnt get it.
      HS4Pro Running on a Raspberry Pi4
      68 Z-Wave Nodes, 175 Events, 359 Devices
      UPB modules via OMNI plugin/panel
      Plugins: Z-Wave, OMNI, HSTouch, weatherXML, EasyTrigger
      HSTouch Clients: 3 Android, 1 Joggler

      Comment


        #4
        Originally posted by TomTom View Post
        I'm not an expert on this, and hopefully Rob will chime in. I don't know if you or I have the latest version. Mine does work.
        This is what I have.
        Code:
        Sub Main(Parms as Object)
            hs.setDeviceString(166,"",True)
            hs.setDeviceString(166,(hs.deviceValue(145) +hs.deviceValue(148)) & "kWh",True)
        
        End Sub
        Thanks so much! Working perfect now.

        Comment


          #5
          Originally posted by rmasonjr View Post
          Hi Chris - Tom has it right. Your script has a lot of extra spaces between the script command and the parens. If you will edit your script to look like Tom's and replace with your device id's you should be good to go.

          Let us know if that doesnt get it.
          And thank you for the initial script. Unfortunately (for me) you posted a picture of your script so I couldn't just copy/paste like I normally do. I need to take some time and learn some basics of scripting. I find myself getting intimidated whenever I start trying to type one out.

          Comment


            #6
            This script works great for me, however, I only get a rounded number as a string. Is there any way to:

            1) Send to the DeviceValue variable instead of a DeviceString?
            2) Show the entire decimal number from the addition of the two values, not just the rounded number?

            Comment


              #7
              Originally posted by Just5 View Post
              This script works great for me, however, I only get a rounded number as a string. Is there any way to:

              1) Send to the DeviceValue variable instead of a DeviceString?
              2) Show the entire decimal number from the addition of the two values, not just the rounded number?
              You will need to make sure that the device is setup correctly to accept values with value ranges wide enough for this. But it will probably be something like;

              Sub Main(Parms as Object)
              hs.setDeviceValuebyref(166,(hs.deviceValueex(145) +hs.deviceValueex(148)),True)

              End Sub

              And in the value range you can specify the suffix as kWh

              Comment


                #8
                Originally posted by mrhappy View Post
                You will need to make sure that the device is setup correctly to accept values with value ranges wide enough for this. But it will probably be something like;

                Sub Main(Parms as Object)
                hs.setDeviceValuebyref(166,(hs.deviceValueex(145) +hs.deviceValueex(148)),True)

                End Sub

                And in the value range you can specify the suffix as kWh
                Thanks!

                Comment

                Working...
                X