Announcement

Collapse
No announcement yet.

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

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

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

    I was wondering if there is a list of hs plug-in calls, for use in our plugins? Would be nice if the calls were documented with namespace and sintax, ie. hs.WriteLog, etc..
    -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
    Originally posted by lpitman View Post
    I was wondering if there is a list of hs plug-in calls, for use in our plugins? Would be nice if the calls were documented with namespace and sintax, ie. hs.WriteLog, etc..
    Hello Larry,

    Are you referring to the plugin SDK docs located here: https://docs.homeseer.com/display/HSPI

    Comment


      #3
      I am trying to determine for example: hs.WriteLog call. What is the equivalent call in the new API?
      -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


        #4
        Originally posted by lpitman View Post
        I am trying to determine for example: hs.WriteLog call. What is the equivalent call in the new API?
        Those are all still there from what I’ve seen.

        Comment


          #5
          But only inside the hspi class, not outside. I am having the same issue. It feels like you have to do all inside the hspi, which would create a very large hspi vlass.
          how does one call hs.writelog from another part of the plugin? Would have expected something in PluginSDK.logging? But that is only holding a single value?
          -- Wim

          Plugins: JowiHue, RFXCOM, Sonos4, Jon00's Perfmon and Network monitor, EasyTrigger, Pushover 3P, rnbWeather, BLBackup, AK SmartDevice, Pushover, PHLocation, Zwave, GCalseer, SDJ-Health, Device History, BLGData

          1210 devices/features ---- 392 events ----- 40 scripts

          Comment


            #6
            Originally posted by lpitman View Post
            I am trying to determine for example: hs.WriteLog call. What is the equivalent call in the new API?
            I to am struggling with this.

            Greig.

            Sent from my SM-G973F using Tapatalk

            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


              #7
              In HS3 we had :
              Code:
              IHSApplication.WriteLog(string mtype, string message)
              In HS4 it's :
              Code:
              IHsController.WriteLog(ELogType logType, string message, string pluginName, string color = "")
              In your HSPI class an IHsController object named HomeSeerSystem is initialized as soon as the plugin connects to HS4, you can then call the WriteLog method from anywhere in your plugin by passing the HomeSeerSystem object to any other class.

              Comment


                #8
                Originally posted by spud View Post
                In HS3 we had :
                Code:
                IHSApplication.WriteLog(string mtype, string message)
                In HS4 it's :
                Code:
                IHsController.WriteLog(ELogType logType, string message, string pluginName, string color = "")
                In your HSPI class an IHsController object named HomeSeerSystem is initialized as soon as the plugin connects to HS4, you can then call the WriteLog method from anywhere in your plugin by passing the HomeSeerSystem object to any other class.
                Spud,

                Thanks for your reply. I am self-taught and am not quite getting passing the HomeSeerSystem object to any other class to work can you give me an example of this?

                Greig.

                Sent from my SM-G973F using Tapatalk
                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


                  #9
                  Originally posted by enigmatheatre View Post
                  Spud,

                  Thanks for your reply. I am self-taught and am not quite getting passing the HomeSeerSystem object to any other class to work can you give me an example of this?

                  Greig.

                  Sent from my SM-G973F using Tapatalk
                  How did you do it in HS3? Somehow you had to access the IHSApplication object from your other classes to be able to call WriteLog and other API. This is exactly the same in HS4 except that it's now a IHsController object, so I'm not sure why you are confused?

                  You can pass it as a parameter of the constructor of all your other classes: MyClass a = new MyClass(HomeSeerSystem), or you could define a singleton design pattern to be able to access it from anywhere, or any other method you used in HS3.

                  Comment


                    #10
                    Thanks for the responses, This isn't that intuitive for a lot of us self taught programmers. More examples would certainly help. I think probably since this is alpha, the sample program source was very sparse, compared to maybe later when beta is available.
                    -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


                      #11
                      Originally posted by spud View Post
                      How did you do it in HS3?
                      I think it was mostly static variable (AKA global)

                      Comment


                        #12
                        Originally posted by spud View Post

                        How did you do it in HS3?
                        In MBPlugins it passed the bare bones "plugin" (HSPI) around and had a public member that I would call (That is how I did it; Just stating it in case it helps).

                        So My plugin would spin up controllers/services and pass in the hspi class to reference for calling back to HS. Allowed me to have a nice separation of business logic and HSPI logic.

                        Comment


                          #13
                          Originally posted by enigmatheatre View Post
                          Spud,

                          Thanks for your reply. I am self-taught and am not quite getting passing the HomeSeerSystem object to any other class to work can you give me an example of this?

                          Greig.

                          Sent from my SM-G973F using Tapatalk
                          I give up, none of the suggestions above work for me. We need a complete example of a plugin, that includes creating devices, writing to log, and interfacing HS calls into our modules, class files!!!
                          -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


                            #14
                            Originally posted by lpitman View Post

                            I give up, none of the suggestions above work for me. We need a complete example of a plugin, that includes creating devices, writing to log, and interfacing HS calls into our modules, class files!!!
                            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.
                            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


                              #15
                              Here is an example that I could understand...

                              Code:
                              Public Class ClsComm
                              
                                  ' Serial port specific constants and globals
                                  Public Shared RS232Port As New System.IO.Ports.SerialPort
                              
                              #Region "    My CommPort Functions    "
                              
                                  '****************************************************************************
                                  ' CloseComPort is used to close the communications port.
                                  Friend Shared Sub CloseComPort()
                              
                                      ClsHelper.OutputHSLog("Entering CloseComPort()....", DEBUG_LOGGING, "Debug", COLOR_ORANGE)
                              
                                      With RS232Port
                              
                                          Try
                                              If .IsOpen = True Then
                                                  .Close()
                                                  ClsHelper.OutputHSLog(gComPort & " Closed.", NORMAL_LOGGING, "Info", COLOR_BLACK)
                                              End If
                              
                                          Catch ex As Exception
                                              ClsHelper.OutputHSLog("Exception error in CloseComPort(): " & ex.Message, MANDATORY_LOGGING, "Error", COLOR_RED)
                                              ' Handle exception error
                              
                                          End Try
                                      End With
                                  End Sub
                              I can go to Microsoft and lookup functions, methods, subs and get namespace that needs to be Imported and example use of the commands etc...
                              -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

                              Working...
                              X