No announcement yet.

Multi Instance and Config Pages

  • Filter
  • Time
  • Show
Clear All
new posts

  • Multi Instance and Config Pages

    I'm writing a plug-in which runs as Instance = "" It then launches child instances ("1" through whatever).

    I'm trying to represent web_config pages for each main/child instances.

    If Instance = "" Then
                RegisterWebPage(sConfigPage, "Configure Plug-In", IFACE_NAME & " Configure Plug-In", True)
                RegisterWebPage(sConfigPage, "Instance ", IFACE_NAME & " Configure Instance ")
            End If
    The links register nicely under the plug-in. The "Configure Plug-In" page for the main plug-in works fine.

    However, I can't get the child pages to work. I notice they call the same link as the parent but with "?instance=n" (n being the instance number) addewd to the URL.

    GetPagePlugin does not appear to get called for the child instances.

    The other strange thing that happens is that when I shut down the main and child instances the "Configure Plug-In" is removed, but the "Configure Instance" links remains and I have to restart HomeSeer to get rid of them.

    Any idea where I'm going wrong?
    Nicolai L

  • #2
    RegisterWebPage is a function from the Sample Plugin. Look in there to see what's going on, and customize to your needs.

    For your second issue (not removing the link from the menu) I think that is a bug. There is a bugzilla ticket here:


    • #3
      I've been through the RegisterWebPage function a number of times now. I fixed the bit that appeared broken around using Instance, but I still can't get it to work.

      Probably something very simple, but I'm stumped. Do you have a it working? Do you have any more tips or a snippet you can share?
      Nicolai L


      • #4
        I depends on what is in your RegisterWebPage function. There are different versions of the sample plugins that also changed over time.

        Also, do I understand correctly that you spawn the instances from the main instance? I am not sure if that is supported, how should Homeseer be aware of those instances?


        • #5
          Originally posted by stefxx View Post
          I depends on what is in your RegisterWebPage function. There are different versions of the sample plugins that also changed over time.?
          Hmm, perhaps I need to take a look at the version of the SDK I'm using. Sounds like it might be outdated!

          Yes, I do spawn, by using hs.launch with the instance= parameter, it works fine for everything else I'm doing although I've had to write code to make sure the parent kept track of the children and vice versa.
          Nicolai L


          • #6
            Just because I didn't know it is possible doesn't make it unsupported :-)

            The version of RegisterWebPage I use is declared like this:

            Public Sub RegisterWebPage(ByVal link As String, Optional linktext As String = "", Optional page_title As String = "", Optional Instance As String = "")

            I noticed you call RegisterWebPage with True (Boolean) as fourth parameter...?


            • #7
              So, I've checked and I'm definitely on an older version of the SDK. I'm busy migrating this particular PI across to the new SDK now. I see all these new wonderful "new" Instance management calls which will be helpful.

              Yeah, my fourth parameter was one I added to allow me to ensure the Config link registered with the plug-in name on the Manage plug-in page.
              Nicolai L


              • #8
                OK, so I've gone to the newer SDK now.

                One question though: as part of starting the parent instance I want to start up the children as well. Obviously the AddInstance function can take care of this, but I'm not sure where/how best to call this.

                If I call it from the InitIO function it would appear to be called before the main instance is fully initialised and as such causes the whole PI to hang (and requires a restart of HS to get it to sort itself out).

                Where/How do you automatically initiate additional instances?
                Nicolai L