Announcement

Collapse
No announcement yet.

HS4 GetJuiDeviceConfigPage vs. HS3 ConfigDevice

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

    HS4 GetJuiDeviceConfigPage vs. HS3 ConfigDevice

    I am doing my first attempt at converting a plugin that uses the ConfigDevice capability of HS3 which I think has been replaced by GetJuiDeviceConfigPage. The HS4 method gets called then I go to the Devices Tab for the plugin. return the same HTML text that was returned in HS3 but HS4 does not render anything on the page.

    Has anybody had success with this and willing to share some pointers?

    #2
    Michael, here is the code I am using.
    The 'GetJuiDeviceConfigViews' is a routine that sets the (JUI) views needed for the device configuration, same like settings etc.

    Code:
      Public Overrides Function GetJuiDeviceConfigPage(deviceRef As Integer) As String
            'this is called because we set a boolean flag for it (SupportsConfigDevice)
            'This builds a tab on the device specific to the plugin
            Dim hsdevice As HsDevice = HS.GetDeviceWithFeaturesByRef(deviceRef)
            Dim JUIPage As Page
            Dim pageID As String = "deviceconfig-page1"
    
            'Log("configpage is called")
            JUIPage = PageFactory.CreateDeviceConfigPage(pageID, "Device Settings").Page
            'create your page canvas
            JUIPage.AddViews(GetJuiDeviceConfigViews(pageID, deviceRef))
            Return JUIPage.ToJsonString
        End Function
    It seems you are not supposed to return HTML, but JSON? I copied this code originally from the PluginSDK I believe... do not remember all the searching I did
    -- Wim

    Plugins: JowiHue, RFXCOM, Sonos4, Jon00's Perfmon and Network monitor, EasyTrigger, Pushover 3P, rnbWeather, BLBackup, AK SmartDevice, Pushover, PHLocation, Zwave, GCalseer, SDJ-Health, Device History, BLGData

    1210 devices/features ---- 392 events ----- 40 scripts

    Comment


      #3
      Thanks Vim, I will admit I did not look at the Sample Plugin as I thought it would not have been covered there.

      Comment


        #4
        I have created my JUI page and displays pretty much what I want. Is there any feedback on text, checkbox, etc before save button is clicked such is done with triggers and actions? When save is clicked what plugin method is called so the user entries can be processed?

        Comment


          #5
          When save is clicked you need

          Code:
           Protected Overrides Function OnDeviceConfigChange(deviceConfigPage As Page, deviceRef As Integer) As Boolean
          to catch it. I checked the documentation on it, it is completely missing in the new documentation on github, but you can still find it at https://docs.homeseer.com/display/HS...gChange+Method, but you have only 10 seconds to read id before being send away... How weird can this be?
          As far I know you cannot catch the feedback before save is hit. I really miss that as in HS3 we did not really need the save button on any page. With the Jui structure a save button is needed, which is a step backward I think.
          -- Wim

          Plugins: JowiHue, RFXCOM, Sonos4, Jon00's Perfmon and Network monitor, EasyTrigger, Pushover 3P, rnbWeather, BLBackup, AK SmartDevice, Pushover, PHLocation, Zwave, GCalseer, SDJ-Health, Device History, BLGData

          1210 devices/features ---- 392 events ----- 40 scripts

          Comment


            #6
            Originally posted by w.vuyk View Post
            When save is clicked you need

            Code:
             Protected Overrides Function OnDeviceConfigChange(deviceConfigPage As Page, deviceRef As Integer) As Boolean
            to catch it. I checked the documentation on it, it is completely missing in the new documentation on github, but you can still find it at https://docs.homeseer.com/display/HS...gChange+Method, but you have only 10 seconds to read id before being send away... How weird can this be?
            It is in the new documentation:
            https://homeseer.github.io/Plugin-SD..._System_Int32_
            but there is a problem with the list of methods on the right of the page, it looks like it is impossible to see the bottom of the list.

            Comment


              #7
              Spud,

              Thanks, but have no clue how to get there not knowing the needed routine if I would start from scratch, browsing the github does not find this routine easy- like you experienced
              I tried to find it doing a search on 'OnDeviceConfigChange' it was not found either, that is why I thought it was missing... Guess this is not really easy usable documentation either?
              -- Wim

              Plugins: JowiHue, RFXCOM, Sonos4, Jon00's Perfmon and Network monitor, EasyTrigger, Pushover 3P, rnbWeather, BLBackup, AK SmartDevice, Pushover, PHLocation, Zwave, GCalseer, SDJ-Health, Device History, BLGData

              1210 devices/features ---- 392 events ----- 40 scripts

              Comment


                #8
                I have been trying to upgrade my plugin but I am struggling with the DeviceConfig. It seems extremely limited. I can't create buttons, add my own css or html. At least not in any normal way. What I've been doing as a workaround is putting all my html, css, and jquery code in a label but that approach is not sustainable. As a developer, I am tempted to just improve my HS3 plugin since it seems that I can do so much more with it. Of course, I am very new to the process so maybe there is a way that I don't know about.
                James

                Running HS 3 on Win10 .

                Comment


                  #9
                  I believe the new concept with settings and configpage replacement is to use a multi-step interview-like sequence. The only time the plugin gets visibility into what controls/views the user has changed is after the HS-provided save button is clicked.

                  in one of my plugins I moved some settings functionality into device buttons of features of the plugin’s root device. In another I changed the button to a toggle and then acted upon the toggle state after save was clicked.

                  Comment


                    #10
                    Michael,
                    Thank your for the reply.
                    I did successfully set up the plugin setup page using a stepper page and I am happy with the approach/result.

                    My hope was to be able to configure specific devices via the config page for things like bulb color, device priority, details from the corresponding wifi plug/switch/bulb such as energy usage. All things I did in the HS3 plugin.

                    I think the approach I will take is create my own device list on a feature page allow those devices to be configured there.
                    I've been an HS fan since the pure X10 windows app days and I know that they will keep improving HS4 and it will be great.

                    I think I know the answer but to be 100% sure. Feature pages and device "features" have nothing to do with each other! Correct? Initially I had hoped that when you create a device feature you would be able to attach a feature page which has a ton of flexibility for custom code. If you could answer
                    James

                    Running HS 3 on Win10 .

                    Comment


                      #11
                      You are correct about the overloading of "Feature". The Feature page is a general purpose html file that does not have any restrictions on controls. You control the use of Ajax for interaction with the user. In HS3 it is the page you registered so it would appear on the HS menu for the plugin. A device feature is the same as the HS3 device with a association type of child. In HS4 only device features can contain controls and status and only devices will show as tiles on the HS devices page.

                      HS Devices page provides a tab for configuring a device if one was requested by the plugin. The plugin is restricted to use the JUI controls rather than HTML. The plugin is given the device reference number and the plugin can construct views for the device and any or all of its features. There is no direct capability to configure a single feature using this mechanism, but with a multi-step process one could assess which feature of the device the user is interested in configuring. In my case I just show all features and let the user configure any or all at one time.

                      Comment


                        #12
                        This is super helpful and tying the HS4 device features to the HS3 association types is now very clear for me. Thanks again for you help.
                        James

                        Running HS 3 on Win10 .

                        Comment


                          #13
                          Hi All, having similar issues with the new HS4 config page approach. I did not see it implemented in the sample plug in. Did I miss that or are there any other sample solutions showing that implemented. Thanks!

                          Comment


                            #14
                            The behavior is identical to the Config page with the addition of the parent device ref passed into the call. A view is setup as was done for the config page. Upon use of the save button the plugin gets access to assess what user inputs have occurred. I believe I posted the code of my KNX plugin for handling this in this forum recently. I can find it or post it again.

                            Comment


                              #15
                              Hello. Thanks for the help. Is anyone getting SupportsConfigDeviceAll to work and show a "GetJuiDeviceConfigPage"?

                              Was able to get SupportsConfigDevice to execute GetJuiDeviceConfigPage for devices owned by the plugin, but not able to get GetJuiDeviceConfigPage executed when other devices are selected (i.e. no Tab added when going into the device).

                              I used:

                              Public Overrides ReadOnly Property SupportsConfigDeviceAll As Boolean
                              Get
                              Return True
                              End Get
                              End Property

                              Thanks!

                              Comment

                              Working...
                              X