Announcement

Collapse
No announcement yet.

ScaleText / HasScale Help!!!!

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

  • ScaleText / HasScale Help!!!!

    I am trying to use the ScaleText / HasScale function in one of my plugins but am having no luck getting it to work. Could I ask if someone can show me a working example of how to set this up.

    I am setting up the VSPair like this
    PHP Code:
                        Dim Pair As VSPair
                        Pair 
    = New VSPair(HomeSeerAPI.ePairStatusControl.Status)
                        
    Pair.PairType VSVGPairType.Range
                        Pair
    .RangeStart = -2147483648
                        Pair
    .RangeEnd 2147483647
                        Pair
    .RangeStatusPrefix ""
                        
    Pair.RangeStatusSuffix " " VSPair.ScaleReplace
                        Pair
    .HasScale True
                        Pair
    .IncludeValues True
                        Pair
    .ValueOffset 0
                        Pair
    .RangeStatusDecimals 1

                        Default_VS_Pairs_AddUpdateUtil
    (refPair
    Which in the device view gives me the Suffix "@S@" which I beleve is correct but then what do I do?
    In the manual it says:

    ' Set the ScaleText to our scale so that @S@ in the value/status pair will
    ' get replaced with our scale read from the temperature reading.
    dv.ScaleText(hs) = TemperatureReading.TempScale
    hs.SetDeviceValueByRef(dv.Ref(hs), TemperatureReading.Temperature, True)

    I guess that the last line is saying to set the device value and I have also tried to set dv.ScaleText(hs) = hs.GetINISetting("Settings", "gGlobalTempScaleF", "True")

    Do I have to store this or what? I just cant get it to work.

    Thanks for any help.

    Greig.

    Here is what the manual says:


    ScaleText / HasScale

    The ScaleText (See the scripting reference for the prototype.) allows you to set a scale or other indicator upon a device's value/status pairs so that information not available at design time when the pairs are created can still be displayed.

    Consider this scenario... A Z-Wave temperature sensor on a thermostat displays the temperature in Fahrenheit, but then the user changes the thermostat to use Celsius scale instead. One way to address this is to remove and re-add the value/status pair for the temperature to change F to C, or another way - especially if you are unaware of when the user might change the scale - is to use the ScaleText replacement in the value/status pair.

    The ScaleText is always used to replace any occurrence of the string @S@ in the device status.

    To use this feature, HasScale in the value/status pair must also be set to True.

    Example:

    Set up a pair for the range of values a temperature can be and to use the ScaleText feature...

    Pair = New VSPair(HomeSeerAPI.ePairStatusControl.Status)
    Pair.PairType = VSVGPairType.Range
    Pair.RangeStart = -2147483648
    Pair.RangeEnd = 2147483647
    Pair.IncludeValues = True
    Pair.ValueOffset = 0
    Pair.RangeStatusDecimals = 1
    Pair.RangeStatusPrefix = ""
    Pair.RangeStatusSuffix = " " & VSPair.ScaleReplace <------
    Pair.HasScale = True <------
    Default_VS_Pairs_AddUpdateUtil(dv.Ref(hs), Pair)


    When the temperature changes and you know the scale, update the device as follows:

    ' Set the ScaleText to our scale so that @S@ in the value/status pair will
    ' get replaced with our scale read from the temperature reading.
    dv.ScaleText(hs) = TemperatureReading.TempScale
    hs.SetDeviceValueByRef(dv.Ref(hs), TemperatureReading.Temperature, True)



    The Value/Status pairs contain a constant which will provide you with the replacement variable string for you. After creating a new VSPair object, reference it and in the status use:
    Public Const ScaleReplace As String = "@S@"
    Using ScaleReplace is not required, the replacement string may be typed out as well.

    To indicate to HomeSeer that a ScaleText exists, remember to also set HasScale to True in the value/status pair.
    Zwave = Z-Stick, 3xHSM100 7xACT ZDM230, 1xEverspring SM103, 2xACT HomePro ZRP210.
    X10 = CM12U, 2xAM12, 1xAW10, 1 x TM13U, 1xMS13, 2xHR10, 2xSS13
    Other Hardware = ADI Ocelot + secu16, Global Cache GC100, RFXtrx433, 3 x Foscams.
    Plugings = RFXcom, ActiveBackup, Applied Digital Ocelot, BLDeviceMatrix, BLGarbage, BLLAN, Current Cost, Global Cache GC100,HSTouch Android, HSTouch Server, HSTouch Server Unlimited, NetCAM, PowerTrigger, SageWebcamXP, SqueezeBox, X10 CM11A/CM12U.
    Scripts =
    Various

  • #2
    bump!
    Zwave = Z-Stick, 3xHSM100 7xACT ZDM230, 1xEverspring SM103, 2xACT HomePro ZRP210.
    X10 = CM12U, 2xAM12, 1xAW10, 1 x TM13U, 1xMS13, 2xHR10, 2xSS13
    Other Hardware = ADI Ocelot + secu16, Global Cache GC100, RFXtrx433, 3 x Foscams.
    Plugings = RFXcom, ActiveBackup, Applied Digital Ocelot, BLDeviceMatrix, BLGarbage, BLLAN, Current Cost, Global Cache GC100,HSTouch Android, HSTouch Server, HSTouch Server Unlimited, NetCAM, PowerTrigger, SageWebcamXP, SqueezeBox, X10 CM11A/CM12U.
    Scripts =
    Various

    Comment


    • #3
      Did you ever figure out how to make this work? I've just run into the exact same thing!

      -David

      Comment


      • #4
        Originally posted by drule View Post
        Did you ever figure out how to make this work? I've just run into the exact same thing!

        -David
        No not realy I just read hs.GetINISetting("Settings", "gGlobalTempScaleF", "True") and act on that.

        Greig.
        Zwave = Z-Stick, 3xHSM100 7xACT ZDM230, 1xEverspring SM103, 2xACT HomePro ZRP210.
        X10 = CM12U, 2xAM12, 1xAW10, 1 x TM13U, 1xMS13, 2xHR10, 2xSS13
        Other Hardware = ADI Ocelot + secu16, Global Cache GC100, RFXtrx433, 3 x Foscams.
        Plugings = RFXcom, ActiveBackup, Applied Digital Ocelot, BLDeviceMatrix, BLGarbage, BLLAN, Current Cost, Global Cache GC100,HSTouch Android, HSTouch Server, HSTouch Server Unlimited, NetCAM, PowerTrigger, SageWebcamXP, SqueezeBox, X10 CM11A/CM12U.
        Scripts =
        Various

        Comment


        • #5
          Bump!

          I'm running into this as well. Anybody get this to actually work? If so can you help us with proper device setup.

          Comment

          Working...
          X