Announcement

Collapse
No announcement yet.

Functions Called by HS3 & Enabling Plug-in

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

  • Functions Called by HS3 & Enabling Plug-in

    I am trying to implement a plugin. I am able to install it. However, when I try to enable it after installation I get the following "plug-in status" "WARNING: Failed getting InterfaceStatus from ... - the interface was not found in the list of active interfaces, the list may need to be refreshed.". In the log I see that the property "Name" was called. After that it says:

    "
    ...
    Exiting Connect on line ...(Note: this is my message I log)
    Plugin has connected. IP:127.0.0.1:[port]
    Starting plugin:: Object reference not set to an instance of an object."

    What would really help me is know what functions HS3 is calling in my plugin after clicking on the "turn on/enable" switch in HS3. As mentioned above, "Name" seems to be called first followed by "Connect" but I am missing some log entries so something else must be going on.

  • #2
    It calls into a load of functions, status, capabilities, name, access level and quite a few more - the error that you see can sometimes be as a result of being in the InitIO routine too long. The guidance some years ago was to start a thread from InitIO rather than sit in there doing database checking or whatever as that can cause HS to think that the plugin has crashed on startup. However sometimes that error can go when you just reload the page and as such don't read too much into it sometimes.
    My Plugins:

    Pushover 3P | DoorBird 3P | Current Cost 3P | Velleman K8055 3P | LAMetric 3P | Garadget 3P | Hive 3P |
    Yeelight 3P | Nanoleaf 3P

    Comment


    • #3
      Thanks for the reply. I got this solved but I am not sure what exactly solved it as I had to change several things to get this working. One problem I had is that InitIO failed but I returned an empty string which indicates success (or at least that there is still a chance to make it a success later from a thread you spawn off). In my case I had an unrecoverable error so I should have returned an error message instead.

      Also what was confusing is that the plugin is an exe so you would think that everything starts from main(...) being called. However, that doesn't seem to be the case. You also have to create a class that implements HSPI and it appears that HS3 is instantiating that class first, calls some functions (like checking if you need a COM port) and only then calls main(...). I guess that's done this way because if the plugin needs a COM port then the COM port is passed in as an argument to main(...) as well as the instance name and IP, I think. So HS3 calls the corresponding functions first before calling main(...). At least that is how it appears to me.

      Comment

      Working...
      X