Announcement

Collapse
No announcement yet.

Help with AdditionalDisplayData

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

    Help with AdditionalDisplayData

    Hello,

    I was wondering if anyone could help with a problem I am having with the AdditionalDisplayData. Maybe I don't understand the 'actual' intent. I would like to change the status display of one of the VSPairs based on additional information.. Here is the relevant code and the results.

    Creating the device:
    Code:
    Pair = new VSVGPairs.VSPair(HomeSeerAPI.ePairStatusControl.Status);
    Pair.PairType = VSVGPairs.VSVGPairType.SingleValue;
    Pair.Value = (double)SceneDeviceValues_e.SCENE_DEVICE_VALUE__STATUS_ACTIVE;
    Pair.Status = "On (" + VSVGPairs.VSPair.AddDataReplace(0) + ")";
    GlobalData.hs.DeviceVSP_AddPair(NewDevRef, Pair);
    GPair = new VSVGPairs.VGPair();
    GPair.PairType = VSVGPairs.VSVGPairType.SingleValue;
    GPair.Set_Value = 1;
    GPair.Graphic = "/images/HomeSeer/status/on.gif";
    GlobalData.hs.DeviceVGP_AddPair(NewDevRef, GPair);
    Setting it active:
    Code:
    DeviceClass Device = default(DeviceClass);
    Device = (DeviceClass)GlobalData.hs.GetDeviceByRef(this._DevRef);
    string [] Str = new string[2];
    Str[0] = "Hello";
    Str[1] = "Blah";
    Device.set_AdditionalDisplayData(GlobalData.hs, Str);
    GlobalData.hs.SetDeviceValueByRef(
      this.DevRef, (double)Util.SceneDeviceValues_e.SCENE_DEVICE_VALUE__STATUS_ACTIVE, true);
    The result shows the @%0@ in the display. The AdditionalDisplayData *does* show up in the device "advanced" tab.

    Does anyone have any clues what could be wrong?

    Thanks,
    Mike
    Attached Files

    #2
    I just ran into this myself. The VSPair documentation lists a property HasAdditionalData, but setting this has no effect. BUT if you try adding values using the web UI, you will find that this property only appears for range values. So it seems that you cannot use additional data with a single value.

    Here is an example that works for me:

    Code:
    var valueStatePair = new VSVGPairs.VSPair(ePairStatusControl.Status)
    {
        PairType = VSVGPairs.VSVGPairType.Range,
        RangeStart = 42,
        RangeEnd = 42,
        // You can use the prefix, suffix and inclusion of values as you like.
        RangeStatusPrefix = "Answer to the Ultimate Question of Life, the Universe, and Everything: @%0@",
        IncludeValues = false,
        HasAdditionalData = true
    };
    Last edited by jstuyts; March 8, 2019, 02:31 PM. Reason: Added an example.

    Comment

    Working...
    X