Announcement

Collapse
No announcement yet.

HSPI_MoskusSample - An easier plugin sample [VB.NET]

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

    #61
    Originally posted by jeubanks View Post
    I have a C# tool that I would like to turn into a plugin. Do you have a sample framework for C#?
    No, not yet. But I am thinking of creating one, as I tend to use more C# than VB these days.
    HSPro 3.0.0.458, Z-NET with Z-wave plugin 3.0.1.190, RFXCOM + 2x RFXtrx433E, HSTouch, Squeezebox plugin, iTach IP/WF2IR & GC-100-6 with UltraGCIR, BLDenon, NetcamStudio, Jon00s Webpage builder, Harmony Hub plugin, SCSIP (with FreePBX), Arduino plugin, IFTTT, Pushalot plugin, Device History plugin.
    Running on Windows 10 (64) virtualized
    on ESXi (Fujitsu Primergy TX150 S8).
    WinSeer (for Win10) - TextSeer - FitbitSeer - HSPI_MoskusSample

    Are you Norwegian (or Scandinavian) and getting started with HomeSeer? Read the "HomeSeer School"!

    Comment


      #62
      Just wanted to add my thanks (and a donation to you) for sharing this with us. This took me from zero to having a working plug-in in just a day or so. I've written a lot of software but this helped get me over the hurdle of understanding the basics of how the plugin interfaces work. Thank you, thank you, thank you. And look for a contribution in your inbox soon.

      Comment


        #63
        Originally posted by XboxMeister View Post
        Just wanted to add my thanks (and a donation to you) for sharing this with us. This took me from zero to having a working plug-in in just a day or so. I've written a lot of software but this helped get me over the hurdle of understanding the basics of how the plugin interfaces work. Thank you, thank you, thank you. And look for a contribution in your inbox soon.
        Got it! Highly appreciated!
        HSPro 3.0.0.458, Z-NET with Z-wave plugin 3.0.1.190, RFXCOM + 2x RFXtrx433E, HSTouch, Squeezebox plugin, iTach IP/WF2IR & GC-100-6 with UltraGCIR, BLDenon, NetcamStudio, Jon00s Webpage builder, Harmony Hub plugin, SCSIP (with FreePBX), Arduino plugin, IFTTT, Pushalot plugin, Device History plugin.
        Running on Windows 10 (64) virtualized
        on ESXi (Fujitsu Primergy TX150 S8).
        WinSeer (for Win10) - TextSeer - FitbitSeer - HSPI_MoskusSample

        Are you Norwegian (or Scandinavian) and getting started with HomeSeer? Read the "HomeSeer School"!

        Comment


          #64
          One suggestion I have for this sample is in the example devices it creates. Right now it creates a root device and associates child devices to it. All good so far. The plug-in I am building needed multiple roots with their own set of child devices under them (each root has the same set of child devices but they are separate objects in the end to support multiple instances of root objects).

          One thing I needed to do was figure out if the root tied to a given child was the one I was looking for. But when I call GetParentRefByRef() on a child, it kept returning 0 rather than a value RefID. I just figured out last night that the association has to be done in both directions (parent associated to child, child associated to parent). Right now the sample just does the first part with a line like the following after creating a child object:

          If childDeviceReference > 0 Then root.AssociatedDevice_Add(hs, childDeviceReference)

          This only adds the child to the parent's list of associated devices but for whatever reason HS doesn't add the parent to the child device's associated device list when you do this. So I added a second AssociatedDevice_Add() line that basically made the reverse connection and now all works as I need it to.

          Maybe there is a reason why the sample shouldn't do this as a standard practice? I'm still learning about all this stuff so perhaps the parent->child association is far more typical but it took me a while to figure out why GetParentRefByRef() kept failing. Is it better to have plugins handle this sort of thing in a separate instance of the plug-in vs. having the plug-in handle multiple root devices? It would probably make my code a lot simpler if I had separate plug-in instances but I haven't figured out how to do that yet and I don't think I've seen a plug-in actually run multiple instances yet in my HS3 plug-in page.

          Feedback on this?

          Still love this sample. It has really gotten me going. I have several plug-ins under development using it already. :-)

          Comment


            #65
            Originally posted by XboxMeister View Post
            Feedback on this?
            Yes, I'm guessing you are using a beta version of HS3 higher than .435. Am I right?

            HomeSeer Tech has changed something in the way it handles the parent/child-relationship. Now you need to add both, and also after a call to hs.SaveDevicesEvents().


            There are a couple of other bugs in the sample I need to update. It is overdue for an update, as I also have learned alot after creating this sample.

            Originally posted by XboxMeister View Post
            Still love this sample. It has really gotten me going. I have several plug-ins under development using it already. :-)
            Thanks! The intention was to make plugin creation much simpler. I hope I have achieved that.
            HSPro 3.0.0.458, Z-NET with Z-wave plugin 3.0.1.190, RFXCOM + 2x RFXtrx433E, HSTouch, Squeezebox plugin, iTach IP/WF2IR & GC-100-6 with UltraGCIR, BLDenon, NetcamStudio, Jon00s Webpage builder, Harmony Hub plugin, SCSIP (with FreePBX), Arduino plugin, IFTTT, Pushalot plugin, Device History plugin.
            Running on Windows 10 (64) virtualized
            on ESXi (Fujitsu Primergy TX150 S8).
            WinSeer (for Win10) - TextSeer - FitbitSeer - HSPI_MoskusSample

            Are you Norwegian (or Scandinavian) and getting started with HomeSeer? Read the "HomeSeer School"!

            Comment


              #66
              Originally posted by Moskus View Post
              Yes, I'm guessing you are using a beta version of HS3 higher than .435. Am I right?

              HomeSeer Tech has changed something in the way it handles the parent/child-relationship. Now you need to add both, and also after a call to hs.SaveDevicesEvents().


              There are a couple of other bugs in the sample I need to update. It is overdue for an update, as I also have learned alot after creating this sample.


              Thanks! The intention was to make plugin creation much simpler. I hope I have achieved that.
              No, I am using version .435 on Linux, no beta. Totally makes sense if they changed the model on how that behavior works. It had me mystified for a while as to why the parent knew the child but the child didn't know its parent. I had assumed associating the two automatically created a bidirectional relationship.

              You definitely achieved your goal. As I said, I have a few PIs underway right now thanks to your sample. Many thanks!

              Comment


                #67
                Problem with utility "log" in Moskus Sample. When attempting to use LogType.Debug, it errors out with the message below. All other LogTypes work fine. My code is:

                Log("Plugin.vb -> InitIO", LogType.Debug) Any ideas as to how to fix?
                Initializing plug-in(2): MoskusSample Instance::Object reference not set to an instance of an object.STACK: Server stack trace: Exception rethrown at [0]: at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessag e(IMessage reqMsg, IMessage retMsg) at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(Mess ageData& msgData, Int32 type) at HomeSeerAPI.IPlugInAPI.InitIO(String port) at Scheduler.clsHSPI.CheckInterfaces()
                Thanks!
                Fred

                HomeSeer Pro 3.0.0.548, HS3Touch, Zwave 3.0.1.252, Envisalink DSC 3.0.0.40, WeatherXML, Z-stick, HS phone, Way2Call

                Comment


                  #68
                  Re: problem in logging utility - never mind! The problem was me. Tried to use debug logging before settings were loaded - duh!
                  Fred

                  HomeSeer Pro 3.0.0.548, HS3Touch, Zwave 3.0.1.252, Envisalink DSC 3.0.0.40, WeatherXML, Z-stick, HS phone, Way2Call

                  Comment


                    #69
                    Moskus,

                    Is there a chance that you might be creating a C# version of your sample using the HSPI framework? That would be a great way for us newbies to compare developing on the two languages!
                    Fred

                    HomeSeer Pro 3.0.0.548, HS3Touch, Zwave 3.0.1.252, Envisalink DSC 3.0.0.40, WeatherXML, Z-stick, HS phone, Way2Call

                    Comment


                      #70
                      Originally posted by ITguyHS View Post
                      Moskus,

                      Is there a chance that you might be creating a C# version of your sample using the HSPI framework? That would be a great way for us newbies to compare developing on the two languages!
                      https://github.com/Moskus/hspi_CsharpSample
                      HSPro 3.0.0.458, Z-NET with Z-wave plugin 3.0.1.190, RFXCOM + 2x RFXtrx433E, HSTouch, Squeezebox plugin, iTach IP/WF2IR & GC-100-6 with UltraGCIR, BLDenon, NetcamStudio, Jon00s Webpage builder, Harmony Hub plugin, SCSIP (with FreePBX), Arduino plugin, IFTTT, Pushalot plugin, Device History plugin.
                      Running on Windows 10 (64) virtualized
                      on ESXi (Fujitsu Primergy TX150 S8).
                      WinSeer (for Win10) - TextSeer - FitbitSeer - HSPI_MoskusSample

                      Are you Norwegian (or Scandinavian) and getting started with HomeSeer? Read the "HomeSeer School"!

                      Comment


                        #71
                        How in the world did I miss that? Thank you!!!
                        Fred

                        HomeSeer Pro 3.0.0.548, HS3Touch, Zwave 3.0.1.252, Envisalink DSC 3.0.0.40, WeatherXML, Z-stick, HS phone, Way2Call

                        Comment


                          #72
                          Originally posted by ITguyHS View Post

                          How in the world did I miss that? Thank you!!!
                          Easy, it was just released.

                          I'm actually not the one who as translated it, but Guahtdim has done 99.98% of it so he should be the one to thank. I've just verified that it does what the VB.net version does, and my next plugin will be in C#.
                          HSPro 3.0.0.458, Z-NET with Z-wave plugin 3.0.1.190, RFXCOM + 2x RFXtrx433E, HSTouch, Squeezebox plugin, iTach IP/WF2IR & GC-100-6 with UltraGCIR, BLDenon, NetcamStudio, Jon00s Webpage builder, Harmony Hub plugin, SCSIP (with FreePBX), Arduino plugin, IFTTT, Pushalot plugin, Device History plugin.
                          Running on Windows 10 (64) virtualized
                          on ESXi (Fujitsu Primergy TX150 S8).
                          WinSeer (for Win10) - TextSeer - FitbitSeer - HSPI_MoskusSample

                          Are you Norwegian (or Scandinavian) and getting started with HomeSeer? Read the "HomeSeer School"!

                          Comment


                            #73
                            Originally posted by Moskus View Post

                            Easy, it was just released.

                            I'm actually not the one who as translated it, but Guahtdim has done 99.98% of it so he should be the one to thank. I've just verified that it does what the VB.net version does, and my next plugin will be in C#.
                            Is there an existing thread for questions and bugs for HSPI_CsharpSample? The github download won't build.
                            Fred

                            HomeSeer Pro 3.0.0.548, HS3Touch, Zwave 3.0.1.252, Envisalink DSC 3.0.0.40, WeatherXML, Z-stick, HS phone, Way2Call

                            Comment


                              #74
                              Originally posted by ITguyHS View Post

                              Is there an existing thread for questions and bugs for HSPI_CsharpSample? The github download won't build.
                              No, no existing thread. But it is on Github...

                              I had no problems building it myself....? Visual Studio 2017.
                              HSPro 3.0.0.458, Z-NET with Z-wave plugin 3.0.1.190, RFXCOM + 2x RFXtrx433E, HSTouch, Squeezebox plugin, iTach IP/WF2IR & GC-100-6 with UltraGCIR, BLDenon, NetcamStudio, Jon00s Webpage builder, Harmony Hub plugin, SCSIP (with FreePBX), Arduino plugin, IFTTT, Pushalot plugin, Device History plugin.
                              Running on Windows 10 (64) virtualized
                              on ESXi (Fujitsu Primergy TX150 S8).
                              WinSeer (for Win10) - TextSeer - FitbitSeer - HSPI_MoskusSample

                              Are you Norwegian (or Scandinavian) and getting started with HomeSeer? Read the "HomeSeer School"!

                              Comment


                                #75
                                Originally posted by Moskus View Post

                                No, no existing thread. But it is on Github...

                                I had no problems building it myself....? Visual Studio 2017.
                                I'm new to Github. I didn't see the "issues" tab. Will post my results there. Thanks!
                                Fred

                                HomeSeer Pro 3.0.0.548, HS3Touch, Zwave 3.0.1.252, Envisalink DSC 3.0.0.40, WeatherXML, Z-stick, HS phone, Way2Call

                                Comment

                                Working...
                                X