Announcement

Collapse
No announcement yet.

What is the syntax for running a plugin Function?

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

    What is the syntax for running a plugin Function?

    What is the syntax for running a plugin Function ?

    I created an event and set it to execute a command &hs.plugin("myplugin").myfunction, but it appears that new syntax is required.
    -Larry

    A member of "The HA Pioneer Group", MyWebSite

    Plugins:
    VWS, AB8SS, lrpSpeak, Calendar, Arduino, Harmony, BlueIris, Sprinklers, ZipBackup...

    Hardware:
    Intel NUC8i7BEH1 running Windows 10 Pro headless, HS3 Pro, Plex running on Synology dual High Availability DS-1815+ NAS (24Tb each), Synology Surveillance Station running on DS-416 Slim (8Tb), Samsung SmartThings, Google Home, Alexa, Hubitat Elevation, ZNET, Ubiquiti UniFi Network, Davis Vantage Pro II Weather Station. Whole house speaker system using a couple of AB8SS switches. Vantage Pro II Weather Station, Rain8Net Sprinklers, Hubitat Elevation, Google Home, Alexa, DSC Security System, Ubiquiti UniFi Network.

    #2
    Bump!
    -Larry

    A member of "The HA Pioneer Group", MyWebSite

    Plugins:
    VWS, AB8SS, lrpSpeak, Calendar, Arduino, Harmony, BlueIris, Sprinklers, ZipBackup...

    Hardware:
    Intel NUC8i7BEH1 running Windows 10 Pro headless, HS3 Pro, Plex running on Synology dual High Availability DS-1815+ NAS (24Tb each), Synology Surveillance Station running on DS-416 Slim (8Tb), Samsung SmartThings, Google Home, Alexa, Hubitat Elevation, ZNET, Ubiquiti UniFi Network, Davis Vantage Pro II Weather Station. Whole house speaker system using a couple of AB8SS switches. Vantage Pro II Weather Station, Rain8Net Sprinklers, Hubitat Elevation, Google Home, Alexa, DSC Security System, Ubiquiti UniFi Network.

    Comment


      #3
      You need to check out the PluginFunction call.

      Something like this:

      Code:
      Dim myPlugin As New PluginAccess(hs, "PluginName")
      Dim pluginVersion As String = myPlugin.PluginFunction("Version", Nothing)
      myPlugin = Nothing
      Cheers,
      Bob
      Web site | Help Desk | Feature Requests | Message Board

      Comment


        #4
        Originally posted by Blade View Post
        You need to check out the PluginFunction call.

        Something like this:

        Code:
        Dim myPlugin As New PluginAccess(hs, "PluginName")
        Dim pluginVersion As String = myPlugin.PluginFunction("Version", Nothing)
        myPlugin = Nothing
        Still errors with

        11:40:02.772 AM Error Compiling script C:\Program Files (x86)\HomeSeer HS3\scripts\Test.vb: Type 'HomeSeerAPI.PluginAccess' is not defined.
        and a variation:

        11:46:09.991 AM Error Compiling script C:\Program Files (x86)\HomeSeer HS3\scripts\Test.vb: Type 'PluginAccess' is not defined.
        My script looks like this:

        Code:
        'Imports HomeSeerAPI
        
        Public Sub Main()
        
            ' get a reference to the plugin
            Dim plugin = New HomeSeerAPI.PluginAccess(hs, "myPlugin")
        
            ' call the function and get the value
            Dim RetVal As Integer = plugin.PluginFunction("mySub", Nothing)
        
        End Sub
        -Larry

        A member of "The HA Pioneer Group", MyWebSite

        Plugins:
        VWS, AB8SS, lrpSpeak, Calendar, Arduino, Harmony, BlueIris, Sprinklers, ZipBackup...

        Hardware:
        Intel NUC8i7BEH1 running Windows 10 Pro headless, HS3 Pro, Plex running on Synology dual High Availability DS-1815+ NAS (24Tb each), Synology Surveillance Station running on DS-416 Slim (8Tb), Samsung SmartThings, Google Home, Alexa, Hubitat Elevation, ZNET, Ubiquiti UniFi Network, Davis Vantage Pro II Weather Station. Whole house speaker system using a couple of AB8SS switches. Vantage Pro II Weather Station, Rain8Net Sprinklers, Hubitat Elevation, Google Home, Alexa, DSC Security System, Ubiquiti UniFi Network.

        Comment


          #5
          Please note that the function being called must be in the HSPI.vb file.

          In Test.vb:

          Sub Main(ByVal parm As Object)
          Dim ReturnValue As Object 'Or Integer, Or String, ect....
          'ReturnValue = hs.PluginFunction("PluginName", "PluginInstance", "FunctionName", "Parameters")
          ReturnValue = hs.PluginFunction("Z-Wave", "", "AccessLevel", Nothing)
          hs.writelog("script", "Value=" & ReturnValue.ToString)
          End Sub
          Wade

          "I know nothing... nothing!"

          Comment


            #6
            Okay that seems works...thanks a bunch.
            -Larry

            A member of "The HA Pioneer Group", MyWebSite

            Plugins:
            VWS, AB8SS, lrpSpeak, Calendar, Arduino, Harmony, BlueIris, Sprinklers, ZipBackup...

            Hardware:
            Intel NUC8i7BEH1 running Windows 10 Pro headless, HS3 Pro, Plex running on Synology dual High Availability DS-1815+ NAS (24Tb each), Synology Surveillance Station running on DS-416 Slim (8Tb), Samsung SmartThings, Google Home, Alexa, Hubitat Elevation, ZNET, Ubiquiti UniFi Network, Davis Vantage Pro II Weather Station. Whole house speaker system using a couple of AB8SS switches. Vantage Pro II Weather Station, Rain8Net Sprinklers, Hubitat Elevation, Google Home, Alexa, DSC Security System, Ubiquiti UniFi Network.

            Comment


              #7
              Originally posted by Sgt. Shultz View Post
              Please note that the function being called must be in the HSPI.vb file.

              In Test.vb:

              Sub Main(ByVal parm As Object)
              Dim ReturnValue As Object 'Or Integer, Or String, ect....
              'ReturnValue = hs.PluginFunction("PluginName", "PluginInstance", "FunctionName", "Parameters")
              ReturnValue = hs.PluginFunction("Z-Wave", "", "AccessLevel", Nothing)
              hs.writelog("script", "Value=" & ReturnValue.ToString)
              End Sub
              Where is the HSPI.vb file?

              and what is the format to pass multiple variables?

              Thanks

              Comment


                #8
                Originally posted by skarragallagher View Post
                Where is the HSPI.vb file?

                and what is the format to pass multiple variables?

                Thanks
                For which plugin?
                💁‍♂️ Support & Customer Service 🙋‍♂️ Sales Questions 🛒 Shop HomeSeer Products

                Comment


                  #9
                  Originally posted by Rupp View Post
                  For which plugin?
                  This is the Vista Alarm Plugin. I am testing the beta and trying to use the SendToAlarm function to send keys (I have a virtual alarm panel with HSTouch)

                  Comment


                    #10
                    Originally posted by skarragallagher View Post
                    This is the Vista Alarm Plugin. I am testing the beta and trying to use the SendToAlarm function to send keys (I have a virtual alarm panel with HSTouch)
                    The plugin author has to implement this within the plugin so you need to ask the plugin author if this was implemented and if so the syntax for the plugin call.
                    💁‍♂️ Support & Customer Service 🙋‍♂️ Sales Questions 🛒 Shop HomeSeer Products

                    Comment


                      #11
                      That was my first move
                      http://forums.homeseer.com/showthread.php?t=165642

                      His last post states that the "SendToAlarm" sub has three formats

                      1. Public Sub SendToAlarm(ByVal CmdStr As String, Optional ByVal CmdName As String = "", Optional ByVal PrefixWithCode As Boolean = True)

                      2. Public Sub SendToAlarm(ByVal CmdStr As String, ByVal CmdName As String, ByVal PartitionNum As Short)

                      3. Public Sub SendToAlarm(ByVal CmdStr As String, ByVal CmdName As String, ByVal SecurityCode As String)

                      I am running this
                      hs.PluginFunction("Vista Alarm","","SendToAlarm",{parm(0),"",FALSE})

                      I have tried many variations and can't get anything to respond so I am hitting this at two angles. One with the plugin maker and two I have been trying to validate my syntax of the hs.pluginfunction command

                      Comment


                        #12
                        Didn't think you could have three sub routines called the same thing personally, I may be wrong though. I don't see much obviously wrong with what you are doing I guess you might need to wait for an example from the author to copy and verify it works.

                        Comment


                          #13
                          Yeah, three sub routines with the same name sounds problematic to me however I am no expert. I will work with the plugin maker to get to the bottom of things if the syntax looks ok

                          Thanks

                          Comment

                          Working...
                          X