Announcement

Collapse
No announcement yet.

ConfigDevice & ConfigDevicePost

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

  • ConfigDevice & ConfigDevicePost

    Does anyone have any advice on using the clsPageBuilder class for the DeviceUtility page? I want to be able to update div's use pagecommands, etc. to provide better feedback to device configuration settings (like the Zwave config page, but not quite as intricate).

    Any suggestions as to how to achieve this other than putting a load of settings into PED in ConfigDevicePost and then extracting them again and taking action in ConfigDevice?
    Author of Highpeak Plugins | SMS-Gateway Plugin | Blue Iris Plugin | Paradox (Beta) Plugin | Modbus Plugin | Yamaha Plugin

  • #2
    Not quite sure what you're trying to achieve. If the settings are device related then I personally think it's cleaner to integrate with ConfigDevice and ConfigDevicePost and regardless of where you store those settings you are always going to have to read and/or write them as required.

    Paul..

    Comment


    • #3
      Paul, that's just what I want to do, but I'd like ConfigDevicePost to be able to update a "div" on the page.

      If you look at a plugin webconfig page, it inherits from clsPageBuilder and the PostBackProc there can call Me.DivToUpdate and Me.PageCommands.

      Let's say I wanted to capture and IP address on a the device config page and add a button to ping that address then show the result on the page. Clicking the button would call ConfigDevicePost, which could execute the ping - how would I publish the result to the page when it refreshes?

      As far as I can see, I'd need to build a complex state engine in my plugin with flags and results to be later represented on the device config page.
      Author of Highpeak Plugins | SMS-Gateway Plugin | Blue Iris Plugin | Paradox (Beta) Plugin | Modbus Plugin | Yamaha Plugin

      Comment


      • #4
        You can add a div in ConfigDevice then catch the button click in ConfigDevicePost and update the div.

        This is what I do to display error messages to the user if they have entered an invalid value in the device config and then click the save button.

        Is this the sort of thing you're after?

        Paul..
        Attached Files

        Comment


        • #5
          Exactly what I'm after, just not sure of the code to update the div in ConfigDevicePost

          Have a code snippet perchance?
          Author of Highpeak Plugins | SMS-Gateway Plugin | Blue Iris Plugin | Paradox (Beta) Plugin | Modbus Plugin | Yamaha Plugin

          Comment


          • #6
            Define your callback somewhere

            PHP Code:
            Public callback As HomeSeerAPI.IAppCallbackAPI 
            Add your div in ConfigDevicePost

            PHP Code:
            stb.Append(clsPageBuilder.DivStart("divID""divAttribute"))
            stb.Append(clsPageBuilder.DivEnd
            I assume you know how to catch the button press in ConfigDevcePost?

            Update the div. In my case I also set an error flag
            PHP Code:
            callback.ConfigDivToUpdateAdd("divID""your div message")
            PageError True 
            And if there is an error
            PHP Code:
            If PageError Then
               
            Return Enums.ConfigDevicePostReturn.DoneAndCancelAndStay
            Else
               Return 
            Enums.ConfigDevicePostReturn.DoneAndSave
            End 
            If 
            Paul..

            Comment


            • #7
              Paul, thanks, implemented this as suggested and it's working like a charm, it was the
              PHP Code:
              callback.ConfigDivToUpdateAdd("divID""your div message"
              portion that I was missing, thanks again for taking the time to post the code snippets.
              Author of Highpeak Plugins | SMS-Gateway Plugin | Blue Iris Plugin | Paradox (Beta) Plugin | Modbus Plugin | Yamaha Plugin

              Comment

              Working...
              X