Announcement

Collapse
No announcement yet.

How do you set the value on a Sliderbar?

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

    How do you set the value on a Sliderbar?

    I added a jsSlider object to one of my config screens. When it gets created you can set min/max value, current value, orientation etc but once created, I can't find the property to set the slider position to another value.
    Wade any idea?
    Dirk

    #2
    For jqSlider, when the slider is moved, it will postback to your postbackproc *unless* you have it as part of a form. By having the autopostback, it will remember the slider's position.

    I've used it both ways. If you do use a form, you'll need to get a little fancy and store the value in a hidden element and reposition the slider when the page refreshes.

    Let me know which method you are using...
    HS4Pro on a Raspberry Pi4
    54 Z-Wave Nodes / 21 Zigbee Devices / 108 Events / 767 Devices
    Plugins: Z-Wave / Zigbee Plus / EasyTrigger / AK Weather / OMNI

    HSTouch Clients: 1 Android

    Comment


      #3
      Hi Rob, thanks for your response!

      In absence of a property to set, I began doing to the same, recreate the object each time you create the page and store values in other more persisted variables.

      However, what I really wanted to do, is have an autopostback (Ajax) every second or so, so I can dynamically update what's happening on the page.

      The slider for example, is actually showing the track position progress so it needs to move each second and of course can be used to reposition the part you want to play.

      Anybody having any luck dropping an Ajaxhandler and figuring out how it works and how you can refresh only parts of your webpage?

      Dirk

      Comment


        #4
        Hmmmm.... That would be very useful for many things.
        I might have to play around with that - dynamically checking for changes.
        I'll try to post back if I come up with anything...
        HS4Pro on a Raspberry Pi4
        54 Z-Wave Nodes / 21 Zigbee Devices / 108 Events / 767 Devices
        Plugins: Z-Wave / Zigbee Plus / EasyTrigger / AK Weather / OMNI

        HSTouch Clients: 1 Android

        Comment


          #5
          I am not sure I added it to the docs, but you can call any javascript function from a postback like, to call the click function on an elelment for example:

          Me.pageCommands.Add("executefunction", "$('#" & "EventGroupNameText_" & e.EvRef.ToString & clsJQuery.ID_IDENT & "').click();")

          So for the slider, just find the jquery call to set the values and you can set them with this function.

          There are property set and reset functions too like:

          To disable an element:

          Me.propertySet.Add("SETRESET_gSMTPServer" & clsJQuery.ID_IDENT, "addattr=disabled=disabled")

          To enable an element:

          Me.propertySet.Add("SETRESET_gGmailUser" & clsJQuery.ID_IDENT, "removeattr=disabled")
          💁‍♂️ Support & Customer Service 🙋‍♂️ Sales Questions 🛒 Shop HomeSeer Products

          Comment


            #6
            what about the status value on the status page? How can i change Dim 0% to Off and Dim 100% to On?

            using the following definition

            Pair.PairType = VSVGPairType.Range
            Pair.RangeStart = 0
            Pair.RangeEnd = 100
            Pair.RangeStatusPrefix = "Dim "
            Pair.RangeStatusSuffix = "%"
            Pair.Render = Enums.CAPIControlType.ValuesRangeSlider
            Mark

            HS3 Pro 4.2.19.5
            Hardware: Insteon Serial PLM | AD2USB for Vista Alarm | HAI Omnistat2 | 1-Wire HA7E | RFXrec433 | Dahua Cameras | LiftMaster Internet Gateway | Tuya Smart Plugs
            Plugins: Insteon (mine) | Vista Alarm (mine) | Omnistat 3 | Ultra1Wire3 | RFXCOM | HS MyQ | BLRadar | BLDenon | Tuya | Jon00 Charting | Jon00 Links
            Platform: Windows Server 2022 Standard, i5-12600K/3.7GHz/10 core, 16GB RAM, 500GB SSD

            Comment


              #7
              You could change the range, use 1 to 99, then have 2 other pairs for 0 and 100 which would be Off and On.

              Originally posted by mnsandler View Post
              what about the status value on the status page? How can i change Dim 0% to Off and Dim 100% to On?

              using the following definition

              Pair.PairType = VSVGPairType.Range
              Pair.RangeStart = 0
              Pair.RangeEnd = 100
              Pair.RangeStatusPrefix = "Dim "
              Pair.RangeStatusSuffix = "%"
              Pair.Render = Enums.CAPIControlType.ValuesRangeSlider
              💁‍♂️ Support & Customer Service 🙋‍♂️ Sales Questions 🛒 Shop HomeSeer Products

              Comment


                #8
                what's the order to add the on & off pairs, the following doesn't work

                Pair = New VSPair(ePairStatusControl.Both)
                Pair.PairType = VSVGPairType.SingleValue
                Pair.Value = 0
                Pair.Status = "Off"
                hs.DeviceVSP_AddPair(Ref, Pair)

                Pair = New VSPair(ePairStatusControl.Both)
                Pair.PairType = VSVGPairType.Range
                Pair.RangeStart = 1
                Pair.RangeEnd = 99
                Pair.RangeStatusPrefix = "Dim "
                Pair.RangeStatusSuffix = "%"
                Pair.Render = Enums.CAPIControlType.ValuesRangeSlider
                hs.DeviceVSP_AddPair(Ref, Pair)

                Pair = New VSPair(ePairStatusControl.Both)
                Pair.PairType = VSVGPairType.SingleValue
                Pair.Value = 100
                Pair.Status = "On"
                hs.DeviceVSP_AddPair(Ref, Pair)
                Mark

                HS3 Pro 4.2.19.5
                Hardware: Insteon Serial PLM | AD2USB for Vista Alarm | HAI Omnistat2 | 1-Wire HA7E | RFXrec433 | Dahua Cameras | LiftMaster Internet Gateway | Tuya Smart Plugs
                Plugins: Insteon (mine) | Vista Alarm (mine) | Omnistat 3 | Ultra1Wire3 | RFXCOM | HS MyQ | BLRadar | BLDenon | Tuya | Jon00 Charting | Jon00 Links
                Platform: Windows Server 2022 Standard, i5-12600K/3.7GHz/10 core, 16GB RAM, 500GB SSD

                Comment


                  #9
                  What doesn't work? Are you trying to make a slider control appear? Or are the name/value pairs not getting applied?

                  Originally posted by mnsandler View Post
                  what's the order to add the on & off pairs, the following doesn't work

                  Pair = New VSPair(ePairStatusControl.Both)
                  Pair.PairType = VSVGPairType.SingleValue
                  Pair.Value = 0
                  Pair.Status = "Off"
                  hs.DeviceVSP_AddPair(Ref, Pair)

                  Pair = New VSPair(ePairStatusControl.Both)
                  Pair.PairType = VSVGPairType.Range
                  Pair.RangeStart = 1
                  Pair.RangeEnd = 99
                  Pair.RangeStatusPrefix = "Dim "
                  Pair.RangeStatusSuffix = "%"
                  Pair.Render = Enums.CAPIControlType.ValuesRangeSlider
                  hs.DeviceVSP_AddPair(Ref, Pair)

                  Pair = New VSPair(ePairStatusControl.Both)
                  Pair.PairType = VSVGPairType.SingleValue
                  Pair.Value = 100
                  Pair.Status = "On"
                  hs.DeviceVSP_AddPair(Ref, Pair)
                  💁‍♂️ Support & Customer Service 🙋‍♂️ Sales Questions 🛒 Shop HomeSeer Products

                  Comment


                    #10
                    Originally posted by rjh View Post
                    What doesn't work? Are you trying to make a slider control appear? Or are the name/value pairs not getting applied?
                    i would like a slider where the right end equates to On (100) and the left end equates to Off (0).

                    i thought i had the On working but i can't replicate it.

                    Yes, the name/value pairs are not getting appplied or added to the slider.

                    i guess the question is, can i add custom value/status pairs to an existing slider control? doesn't seem to work
                    Mark

                    HS3 Pro 4.2.19.5
                    Hardware: Insteon Serial PLM | AD2USB for Vista Alarm | HAI Omnistat2 | 1-Wire HA7E | RFXrec433 | Dahua Cameras | LiftMaster Internet Gateway | Tuya Smart Plugs
                    Plugins: Insteon (mine) | Vista Alarm (mine) | Omnistat 3 | Ultra1Wire3 | RFXCOM | HS MyQ | BLRadar | BLDenon | Tuya | Jon00 Charting | Jon00 Links
                    Platform: Windows Server 2022 Standard, i5-12600K/3.7GHz/10 core, 16GB RAM, 500GB SSD

                    Comment


                      #11
                      Ok, I see, I will check, I don't think you can do that.

                      Originally posted by mnsandler View Post
                      i would like a slider where the right end equates to On (100) and the left end equates to Off (0).

                      i thought i had the On working but i can't replicate it.

                      Yes, the name/value pairs are not getting appplied or added to the slider.

                      i guess the question is, can i add custom value/status pairs to an existing slider control? doesn't seem to work
                      💁‍♂️ Support & Customer Service 🙋‍♂️ Sales Questions 🛒 Shop HomeSeer Products

                      Comment


                        #12
                        Originally posted by rjh View Post
                        Ok, I see, I will check, I don't think you can do that.
                        Rich,

                        this sequence seems to do what i was asking for which is only display a slider but instead of Dim 0% you get Off status, and instead of Dim 100% you get On status. otherwise you get Dim x%.

                        Can you please confirm this and let me know if this is a supported use of the slider?


                        Pair = New VSPair(ePairStatusControl.Status)
                        Pair.PairType = VSVGPairType.SingleValue
                        Pair.Value = 0
                        Pair.Status = "Off"
                        hs.DeviceVSP_AddPair(Ref, Pair)

                        Pair = New VSPair(ePairStatusControl.Both)
                        Pair.PairType = VSVGPairType.Range
                        Pair.RangeStart = 0
                        Pair.RangeEnd = 100
                        Pair.RangeStatusPrefix = "Dim "
                        Pair.RangeStatusSuffix = "%"
                        Pair.Render = Enums.CAPIControlType.ValuesRangeSlider
                        hs.DeviceVSP_AddPair(Ref, Pair)

                        Pair = New VSPair(ePairStatusControl.Status)
                        Pair.PairType = VSVGPairType.SingleValue
                        Pair.Value = 100
                        Pair.Status = "On"
                        hs.DeviceVSP_AddPair(Ref, Pair)
                        Mark

                        HS3 Pro 4.2.19.5
                        Hardware: Insteon Serial PLM | AD2USB for Vista Alarm | HAI Omnistat2 | 1-Wire HA7E | RFXrec433 | Dahua Cameras | LiftMaster Internet Gateway | Tuya Smart Plugs
                        Plugins: Insteon (mine) | Vista Alarm (mine) | Omnistat 3 | Ultra1Wire3 | RFXCOM | HS MyQ | BLRadar | BLDenon | Tuya | Jon00 Charting | Jon00 Links
                        Platform: Windows Server 2022 Standard, i5-12600K/3.7GHz/10 core, 16GB RAM, 500GB SSD

                        Comment


                          #13
                          Originally posted by mnsandler View Post
                          i would like a slider where the right end equates to On (100) and the left end equates to Off (0).

                          i thought i had the On working but i can't replicate it.

                          Yes, the name/value pairs are not getting appplied or added to the slider.

                          i guess the question is, can i add custom value/status pairs to an existing slider control? doesn't seem to work
                          There is no slider control per say - the slider control that you see is generated by the information you put in the value/status pairs.

                          To do what you want, there are two ways:
                          1. Create a range (0 to 1) and in your SetIOMulti, when HomeSeer calls it on a change of the slider, convert the 1 to 100 and send that to the device. When the device changes and is "On", you set the device value to 1 instead of 100.
                          2. Create three value/status pair entries - the first one is a CONTROL ONLY range that has the value from 0 to 100. That will generate a slider with a big long range of 0 to 100. When you get the SetIOMulti call from HomeSeer on a change, convert 1 through 49 to 0 and convert 50-99 to 100. Next, add two STATUS ONLY values, one being 0 (label "Off") and one being 100 (label "On") - now the user can move the slider, but with you converting the value to 0 or 100, the displayed status will still show as On or Off. If you use this method, remember that the user is going to slide the slider to let's say 75, so SetIOMulti is going to be called. You will know that 75 is really 100, but you only have status pairs for 0 and 100, so you need to remember to call SetDeviceValueEx setting the value to 100 (or 0) and tell it NOT to trigger events. If you call SetDeviceValue instead, you will get a looping effect because SetIOMulti will get called by HomeSeer again.
                          So to summarize:
                          • User moves the slider to a value in the range of 0 to 100.
                          • HomeSeer calls SetIOMulti and passes your plug-in the value that the user left the slider at.
                          • If the value is not 0 or 100, then you change it to 0 or 100 and then call SetDeviceValueEx to set the device to the proper value without triggering events (thus making the display show On or Off).

                          Regards,

                          Rick Tinker (a.k.a. "Tink")

                          Comment

                          Working...
                          X