Announcement

Collapse
No announcement yet.

How to combine device status's into virtual device

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

  • Just5
    replied
    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!

    Leave a comment:


  • mrhappy
    replied
    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

    Leave a comment:


  • Just5
    replied
    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?

    Leave a comment:


  • bandook
    replied
    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.

    Leave a comment:


  • bandook
    replied
    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.

    Leave a comment:


  • rmasonjr
    replied
    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.

    Leave a comment:


  • TomTom
    replied
    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

    Leave a comment:


  • bandook
    started a topic How to combine device status's into virtual device

    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
Working...
X