Announcement

Collapse
No announcement yet.

HSPI_MoskusSample - An easier plugin sample [VB.NET]

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

  • Moskus
    replied
    I'm guessing you already had it running in the background when you started debugging. I've done that more times than I want to admit...

    Leave a comment:


  • ottob
    replied
    Web config and status not working with new plugin name.
    I have modified MoskusSample with a new plugin name. In MoskusSample HS calls GetPagePlugin to populate the web pages with content, my renamed plugin does not.
    Hs.RegisterPage is called as it should be with same parameters as in MoskusSample, but with new Link and Plugin_name.
    The web pages open with correct URL when pushing the status or config button, but is not populated as ​GetPagePlugin is not called.
    Any suggestion on where to look is appreciated.

    EDIT
    The fun about programming: One day later it works without me changing any code. Just leave the ghosts for some time and the will get bored...

    Leave a comment:


  • ottob
    replied
    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.

    Leave a comment:


  • Moskus
    replied
    Well, if it's a child device then are you certain that the Device_Type_String contains "Basic"?

    Leave a comment:


  • ottob
    replied
    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?

    Leave a comment:


  • Moskus
    replied
    Yes, that is something I should have changed years ago... sorry!

    Leave a comment:


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

    Leave a comment:


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

    Leave a comment:


  • XboxMeister
    replied
    Very much so! Saved me a lot of frustrating hours of trying to figure out what was broken.

    Leave a comment:


  • simplextech
    replied
    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!

    Leave a comment:


  • XboxMeister
    replied
    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



    Leave a comment:


  • simplextech
    replied
    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

    Leave a comment:


  • simplextech
    replied
    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:	360
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.

    Leave a comment:


  • XboxMeister
    replied
    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:	360
Size:	211.6 KB
ID:	1300580

    Leave a comment:


  • ITguyHS
    replied
    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.

    Leave a comment:

Working...
X