Announcement

Collapse
No announcement yet.

HSPI_MoskusSample - An easier plugin sample [VB.NET]

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

    #91
    Originally posted by Guahtdim View Post
    Have you tried the delegates as non static? I don't understand why you need them to be static.
    Real simple reason - the Way2Call driver requires the handlers to be static! Why they did that, I don't know. But I know from testing that a handler that works fines as a static method, doesn't work if you change it to non-static method. Oh, and it isn't just my conclusion - it's actually noted in the Way2Call sample program they provide that event handlers must be static.
    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


      #92
      Ok, so the delegates must point to static methods, but you can always make the static methods do a push of a message to a static queue and have nonstatic handling of the queue (just juse proper locking when queing and dequeing). This should give you the possibillity to create something in a HomeSeer plugin. Or you could create a subpub (https://kudchikarsk.com/publish-subs...ern-in-csharp/)
      Don't give up! There is always a solution given enough time ;-)

      Comment


        #93
        Originally posted by Guahtdim View Post
        Ok, so the delegates must point to static methods, but you can always make the static methods do a push of a message to a static queue and have nonstatic handling of the queue (just juse proper locking when queing and dequeing). This should give you the possibillity to create something in a HomeSeer plugin. Or you could create a subpub (https://kudchikarsk.com/publish-subs...ern-in-csharp/)
        Don't give up! There is always a solution given enough time ;-)
        Thanks for the tips and words of encouragement! I'll check both of those out. Time I have - it's knowledge I lack.
        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


          #94
          I found what seems like odd behavior using the Moskus template when it comes to device creation. I've built a couple plug-ins so far with the template and what I am noticing is that when one of them is running, any device I create manually (totally outside the plugin code, just hitting the + sign button the main HS3 web page), creates a device that is associated to one of my plug-ins that's based on the sample. If I disable the plug-ins based on the sample, devices are then created normally, not associated to any plug-in. I thought maybe I had screwed something up using the sample so I went back to the original sample without modifications and ran it. Sure enough, when I manually created a device, it was associated to the plug-in. Screenshot attached showing the device I created is magically associated to the sample plug-in even though it was created entirely outside of it. This is on HS 3.0.0.531 but I am pretty sure I saw this on previous builds and just assumed HS was confused with my development work but it seems very repeatable.

          I can't imagine this is normal behavior but I don't know what the plugin could be doing to leave HS in a state like this. It just creates devices but perhaps there is some additional cleanup that has to happen? Having HS create devices tied to a plug-in that doesn't know about them can't be right.

          Click image for larger version

Name:	Capture.PNG
Views:	407
Size:	211.6 KB
ID:	1300580

          Comment


            #95
            Originally posted by XboxMeister View Post
            I found what seems like odd behavior using the Moskus template when it comes to device creation. I've built a couple plug-ins so far with the template and what I am noticing is that when one of them is running, any device I create manually (totally outside the plugin code, just hitting the + sign button the main HS3 web page), creates a device that is associated to one of my plug-ins that's based on the sample. If I disable the plug-ins based on the sample, devices are then created normally, not associated to any plug-in. I thought maybe I had screwed something up using the sample so I went back to the original sample without modifications and ran it. Sure enough, when I manually created a device, it was associated to the plug-in. Screenshot attached showing the device I created is magically associated to the sample plug-in even though it was created entirely outside of it. This is on HS 3.0.0.531 but I am pretty sure I saw this on previous builds and just assumed HS was confused with my development work but it seems very repeatable.

            I can't imagine this is normal behavior but I don't know what the plugin could be doing to leave HS in a state like this. It just creates devices but perhaps there is some additional cleanup that has to happen? Having HS create devices tied to a plug-in that doesn't know about them can't be right.

            Click image for larger version

Name:	Capture.PNG
Views:	407
Size:	211.6 KB
ID:	1300580
            I don't remember exactly where in the VB sample this is at but find the method SupportsAddDevice() and set that to False. I'm curious though as to why this effect HS3 at a global level outside of the plugin itself. I ran into this with the VB sample AND with the newer C# Sample as well.

            Comment


              #96
              Also I think I remember this being set to 'true' in the VB Example which it should not be. AS this lets the plugin override HS3 as if it owns all devices.

              SupportsConfigDeviceAll()

              Find that method in HSPI and set it to FALSE

              Comment


                #97
                Thank you, thank you, thank you!!!

                SupportsAddDevice() was the culprit. It was returning True. When I set it to False and retried it, manual devices were no longer owned by the plug-in. At least for me in the sample SupportsConfigDeviceAll() was already returning False.

                Originally posted by Simplex Technology View Post
                Also I think I remember this being set to 'true' in the VB Example which it should not be. AS this lets the plugin override HS3 as if it owns all devices.

                SupportsConfigDeviceAll()

                Find that method in HSPI and set it to FALSE



                Comment


                  #98
                  Originally posted by XboxMeister View Post
                  Thank you, thank you, thank you!!!

                  SupportsAddDevice() was the culprit. It was returning True. When I set it to False and retried it, manual devices were no longer owned by the plug-in. At least for me in the sample SupportsConfigDeviceAll() was already returning False.





                  Yay I was useful today!

                  Comment


                    #99
                    Very much so! Saved me a lot of frustrating hours of trying to figure out what was broken.

                    Comment


                      Thank you . I will update the C# version as soon as possible.

                      Comment


                        Originally posted by Guahtdim View Post
                        Thank you . I will update the C# version as soon as possible.
                        Welcome

                        Comment


                          Yes, that is something I should have changed years ago... sorry!
                          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


                            I'm new to plugins and using Moskussample as a way in to my first project. Thanks for the code, helps a lot. I am playing around with Devices and updating. A strange thing I have noticed is when updating devices is:

                            This code works fine and updates the device and will also trig events associated with the device:
                            For Each dev In (From d In devs
                            Where d.Device_Type_String(hs).Contains("Basic"))
                            hs.SetDeviceValueByRef(dev.Ref(hs), randomValue, True)
                            hs.SetDeviceString(dev.Ref(hs), "Last random value: " & randomValue, False)
                            Next​

                            But, if the basic device is a Child device it do not update the Device and do not trigger events.
                            However, if you press F5- screen update after sending the update, the device will show the new value.

                            Any way to update the child device directly?

                            Comment


                              Well, if it's a child device then are you certain that the Device_Type_String contains "Basic"?
                              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


                                Originally posted by Moskus View Post
                                Well, if it's a child device then are you certain that the Device_Type_String contains "Basic"?
                                Yes, the Type contains Basic. And values are changed, but not updated on screen. But if I send an update to the root device after updating the child, child is also showing correct value. So that is a way around the issue.

                                Comment

                                Working...
                                X