Announcement

Collapse
No announcement yet.

Feature UI with Slider and Buttons - how to do it programmatically?

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

    Feature UI with Slider and Buttons - how to do it programmatically?

    From a Plugin, I created a Feature with FeatureFactory.AddNumberInputField() .. This provided me with a UI where I could enter a number and click submit. Then I realized that when creating an Event, I wasn't able to enter a value The Event UI presented a dropdown with nothing but the Feature Name.

    I changed the code to FeatureFactory.AddSlider() .. Not a great UI experience, but the Event now allowed me to select a value within the Slider Range.

    So then, from the HomeSeer Web interface, I was able to manually add Buttons as well .. which seemed like the best of both worlds

    Click image for larger version

Name:	2022-04-23 HS Set Point UI.png
Views:	231
Size:	18.5 KB
ID:	1539054

    However, back to the Plugin Code, when I attempted to add the Slider and Buttons I got an Exception :

    A status control covering all or a portion of the value range 70 already exists

    There was also a strange side effect that though the Feature appeared in the Web UI, HomeSeer was not able to find it when calling GetFeatureByRef() even though GetAllFeatureRefs() returned the referenceId .. that's for another day

    Q: Can you have a Feature with both a Slider and Buttons created programmatically from the Plugin?
    Q: If not, what is the appropriate way to create a Text Input which works both from the Web UI and Event selection?


    Thanks /keith
    Attached Files

    #2
    you can't have multiple controls pushing the same "value"

    here is what i did but it may cause downstream issues with alexa, the hs mobile app, etc. in the short term. the current hs version doesn't like what i did, but it should be fixed in the next release based on my testing of a pre-beta

    So for my dimmers, i created a slider from 0 to 100 (0 - off, 100 - On)

    then i added an On button with a value of 101, and Off button with a value of 102

    when the user clicks either the On or Off, i translate the 101 and 102 to the correct command to control my device (ie a dimmer)

    if the user uses the slider, i just take the value as-is and set the device.

    hope this helps
    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


      #3
      I see - thanks. I'll play around with that and see if there's a good balance between the Web UI and Event value selection.

      What's interesting too - both from manually creating these Buttons, and programmatically, they do show up in the Web UI; it was just leading me on 😜

      /keith

      Comment


        #4
        yes, this can be a problem as it allows the users to change your programmatic controls.
        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


          #5
          Oh yeah - so if I wanted a Feature with a Numeric value such that you can enter it in the Web UI and click [Submit] .. AND .. be able to set it in an event, how is that accomplished? Because when I used AddNumberInputField() the Event UI provided no way to enter a value.

          Comment

          Working...
          X