Announcement

Collapse
No announcement yet.

Is there a list of hs plug-in API calls?

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

    #16
    Originally posted by enigmatheatre View Post

    Me To!
    I can get the sample plugin to run without problems but whenever I try and add any calls to HS the plugin crashes. In HS3 I had a public member that I would call
    Code:
    Public hs As HomeSeerAPI.IHSApplication
    If I add:
    Code:
    Public HS4 As HomeSeer.PluginSdk.IHsController
    In to the Sample Plugin and call:
    Code:
     HS4.WriteLog(Logging.ELogType.Info, "Test Message", "Test Name")
    The plugin will not start?

    I am probably doing something dumb but I just can't work it out.

    Greig.
    Hi Greig,

    what you are showing is the definition of a variable, on one hand it is HS for HS3 and on the other your code to define HS4.

    What is missing is the code to give this variable the right value. In HS3 that was done in the "main" procedure that was also part of the example PI code

    ' connect to HS so it can register a callback to us
    host.Connect(sIFACE_NAME, Maininstance)
    ' create the user object that is the real plugin, accessed from the pluginAPI wrapper
    callback = callback
    hs = host

    In HS4, you can use variable HomeSeerSystem which is given meaning in the parent class "AbstractPlugIn". Use that variable but note that methods for IHsController will be different from IHSApplication!

    Hope that helps,

    Dirk

    Comment


      #17
      Originally posted by enigmatheatre View Post

      Me To!
      I can get the sample plugin to run without problems but whenever I try and add any calls to HS the plugin crashes. In HS3 I had a public member that I would call
      Code:
      Public hs As HomeSeerAPI.IHSApplication
      If I add:
      Code:
      Public HS4 As HomeSeer.PluginSdk.IHsController
      In to the Sample Plugin and call:
      Code:
       HS4.WriteLog(Logging.ELogType.Info, "Test Message", "Test Name")
      The plugin will not start?

      I am probably doing something dumb but I just can't work it out.

      Greig.
      You can use the declaration in a Friend module for your plugin like
      Code:
        Friend HS4 As HomeSeer.PluginSdk.IHsController

      But then during Initialize() of the HSPI use this statement inside the same sub:
      Code:
      Sub Initialize
        HS4=HomeseerSystem
        ....
      End sub
      From then on you can use HS4.Writelog and lots of other calls anywhere
      -- Wim

      Plugins:RFXCOM, HSTouch Server, Squeezebox, BLGData, Restart, Jon00's Perfmon and Network monitor, WeatherXML, BLBackup, TenScripting, BC4, Pushover, PHLocation, JowiHue, Zwave, Sonos
      650 devices ---- 336 events ----- 40 scripts

      Comment


        #18
        OK now I am getting somewhere. Thank you all for your support and understanding.

        Greig.
        Zwave = Z-Stick, 3xHSM100� 7xACT ZDM230, 1xEverspring SM103, 2xACT HomePro ZRP210.
        X10 = CM12U, 2xAM12, 1xAW10, 1 x TM13U, 1xMS13, 2xHR10, 2xSS13
        Other Hardware = ADI Ocelot + secu16, Global Cache GC100, RFXtrx433, 3 x Foscams.
        Plugings = RFXcom, ActiveBackup, Applied Digital Ocelot, BLDeviceMatrix, BLGarbage, BLLAN, Current Cost, Global Cache GC100,HSTouch Android, HSTouch Server, HSTouch Server Unlimited, NetCAM, PowerTrigger, SageWebcamXP, SqueezeBox, X10 CM11A/CM12U.
        Scripts =
        Various

        Comment


          #19
          I think I need a little help again!

          How do I get the Plugin Extra Data that my plugin added in HS3 in HS4? I have the device loaded and logging using:
          Code:
           dev = hs4.GetDeviceByRef(Ref)
           If dev IsNot Nothing Then
           Console.WriteLine("Device no " & Ref & ", Address = " & dev.Address & ", Name = " & dev.Name)
          This displays all the info I would expect but when I use the following I get an error Exception: The given key was not present in the dictionary.

          Code:
          dev.PlugExtraData.Item("Index")
          I have also tried the following but it always returns false.
          Code:
          dev.PlugExtraData.ContainsNamed("Index")
          Any thoughts or help is much appreciated.

          Greig.
          Zwave = Z-Stick, 3xHSM100� 7xACT ZDM230, 1xEverspring SM103, 2xACT HomePro ZRP210.
          X10 = CM12U, 2xAM12, 1xAW10, 1 x TM13U, 1xMS13, 2xHR10, 2xSS13
          Other Hardware = ADI Ocelot + secu16, Global Cache GC100, RFXtrx433, 3 x Foscams.
          Plugings = RFXcom, ActiveBackup, Applied Digital Ocelot, BLDeviceMatrix, BLGarbage, BLLAN, Current Cost, Global Cache GC100,HSTouch Android, HSTouch Server, HSTouch Server Unlimited, NetCAM, PowerTrigger, SageWebcamXP, SqueezeBox, X10 CM11A/CM12U.
          Scripts =
          Various

          Comment


            #20
            Originally posted by enigmatheatre View Post
            I think I need a little help again!

            How do I get the Plugin Extra Data that my plugin added in HS3 in HS4? I have the device loaded and logging using:
            Code:
             dev = hs4.GetDeviceByRef(Ref)
            If dev IsNot Nothing Then
            Console.WriteLine("Device no " & Ref & ", Address = " & dev.Address & ", Name = " & dev.Name)
            This displays all the info I would expect but when I use the following I get an error Exception: The given key was not present in the dictionary.

            Code:
            dev.PlugExtraData.Item("Index")
            I have also tried the following but it always returns false.
            Code:
            dev.PlugExtraData.ContainsNamed("Index")
            Any thoughts or help is much appreciated.

            Greig.
            Try making the item name all lower case. I found that even though I was adding named items using all uppercase, I could only read them back using all lower case. Of course this was for a HS4 plug-in that was creating the devices initially, not trying to read back devices created with HS3 so it may not help.
            --
            Bob Paauwe
            ISYInsteon Plug-in
            http://www.bobsplace.com/ISYInsteon/

            Comment


              #21
              Originally posted by bpwwer View Post

              Try making the item name all lower case. I found that even though I was adding named items using all uppercase, I could only read them back using all lower case. Of course this was for a HS4 plug-in that was creating the devices initially, not trying to read back devices created with HS3 so it may not help.
              Yep, that was the problem. Thank you for your time.
              Zwave = Z-Stick, 3xHSM100� 7xACT ZDM230, 1xEverspring SM103, 2xACT HomePro ZRP210.
              X10 = CM12U, 2xAM12, 1xAW10, 1 x TM13U, 1xMS13, 2xHR10, 2xSS13
              Other Hardware = ADI Ocelot + secu16, Global Cache GC100, RFXtrx433, 3 x Foscams.
              Plugings = RFXcom, ActiveBackup, Applied Digital Ocelot, BLDeviceMatrix, BLGarbage, BLLAN, Current Cost, Global Cache GC100,HSTouch Android, HSTouch Server, HSTouch Server Unlimited, NetCAM, PowerTrigger, SageWebcamXP, SqueezeBox, X10 CM11A/CM12U.
              Scripts =
              Various

              Comment

              Working...
              X