Announcement

Collapse
No announcement yet.

Update Feature Name and Trigger UI for an Refresh

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

    Update Feature Name and Trigger UI for an Refresh

    In my plugin I may need to update a Feature Name. Currently, I'm changing Values and Status by calling :
    • HomeSeerSystem
      • UpdateFeatureValueByRef( refId, value )
      • UpdateFeatureValueStringByRef( refId, value)
    This will Trigger the HomeSeer UI to refresh the values. HSTouch app will also be updated.

    I'd like the same refresh behaviour to occur when I update the Name :
    • HomeSeerSystem
      • UpdatePropertyByRef( refId, EProperty.Name, newName )
    No Joy. Is there another way to make the Name change, or an additional call to make for the UI to refresh?

    After the Name change occurs, I can manually refresh the Devices page and the Name has been updated

    Thanks /keith

    #2
    i believe you can set the name property directly on the hsfeature object

    not sure it will force an update to the ui however

    you might post this question to the github sdk issues

    https://github.com/HomeSeer/Plugin-SDK/issues

    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 believe the intent of the special case ValueByRef and ValueStringByRef is that this will generate event triggers when just updating the Value or Status property will not generate the triggers.

      I had tried to use the HSEvent callback for configuration change to detect things like this, but did not have success.

      Comment


        #4
        Just curious can you use
        • UpdateFeatureValueByRef( refId, value )
        and just use the existing value as the value? Would that trigger a refresh? If it's 100, set it to 100. etc.

        Comment


          #5
          Originally posted by George View Post
          Just curious can you use
          • UpdateFeatureValueByRef( refId, value )
          and just use the existing value as the value? Would that trigger a refresh? If it's 100, set it to 100. etc.
          I think should work...
          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


            #6
            Originally posted by George View Post
            Just curious can you use
            • UpdateFeatureValueByRef( refId, value )
            and just use the existing value as the value? Would that trigger a refresh? If it's 100, set it to 100. etc.
            I tried that actually - setting the value to the existing value (ie, no change because there wasn't any value change) but got no UI refresh. Manually refreshing the page worked, of course.

            But, I'll try this again because technically the timestamp should have changed and I didn't make note of that. I'll try setting the Status to current status as well.

            I have a "Status" feature, which every time I poll for data (Pentair ScreenLogic Plugin) I update Value/Status but the values are the same (100/{ipaddress} with the intent to see the timestamp change (ie last poll time) and that IS working. Could be though HS UI just doesn't repaint the Name.

            Onward and Upward!

            Comment


              #7
              You might need to toggle this setting before the date/time will change:

              Click image for larger version

Name:	screenshot1.png
Views:	149
Size:	17.0 KB
ID:	1551361
              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


                #8
                Thanks! That got me somewhere

                I wasn't seeing the "Status" feature timestamp updated when the value/status properties were set during polling. Unchecking "Last Change Time Updates on Status Only" fixed that

                But, unchecking for the Feature which was being renamed didn't change anything. The UI apparently just won't refresh if the Name is changed.

                Further - Programmatically, when the Misc Flags are set during Feature creation, they don't seem to stick. For example when I create a Feature which is a Light. After looking at the Feature in the UI, IsLight is not set

                Code:
                public override void ModifyFlags(HsFeature hsFeature)
                {
                  hsFeature.AddMiscFlag(EMiscFlag.IsLight);
                  hsFeature.AddMiscFlag(EMiscFlag.ShowValues);
                }
                Further Still - Forcefully removing the "SetDoesNotChangeLastChange" flag didn't work either - that Feature still had the checkbox

                Code:
                public override void ModifyFlags(HsFeature hsFeature)
                {
                  hsFeature.RemoveMiscFlag(EMiscFlag.SetDoesNotChangeLastChange);
                }
                It could be me, but the APIs seem quirky

                /keith

                Comment


                  #9
                  It was me {blush}

                  (1) Calling AddMiscFlag() and RemoveMiscFlag() worked fine. What I had missed was calling UpdateFeatureByRef( Ref, Changes ) at the right time.

                  (2) I never got the web UI to refresh when the Feature Name changes. I suspect that's simply not supported by the UI

                  Comment

                  Working...
                  X