Announcement

Collapse
No announcement yet.

Sample code for plugin to create/manage devices

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

    Sample code for plugin to create/manage devices

    Is there any sample code of a plugin that creates and manages devices? I'm trying to create a plugin to support my garage door (Garageio)

    I looked on GitHub and was able to create my plugin shell with configuration settings already. I see code for triggers but nothing on how a plugin creates and managed devices.

    #2
    I found some code that creates some devices using the features page from: https://github.com/HomeSeer/Sample-P...master/HSPI.cs

    Comment


      #3
      Now I'm running into an issue with reading settings from an INI file and can't figure it out:
      1. I have defined the SettingsFileName property
      2. I added all my fields using Settings.Add()
      3. I verified that all of my settings were being saved in the INI file on disk
      4. I have LoadSettingsFromIni() called from within Initialize()
      But when I call HomeSeerSystem.GetINISetting("Settings", key, defaultValue) to retrieve the value, it comes up blank. I have verified that everything is within the "[Settings]" section in the INI file and the key matches the name.

      Comment


        #4
        Originally posted by golfyankee View Post
        Is there any sample code of a plugin that creates and manages devices? I'm trying to create a plugin to support my garage door (Garageio)

        I looked on GitHub and was able to create my plugin shell with configuration settings already. I see code for triggers but nothing on how a plugin creates and managed devices.
        I found this thread, I'm still working my way through my first HS4 plugin so I've not used this code....

        https://forums.homeseer.com/forum/de...ion-in-c/page3
        HS3 Pro Edition 3.0.0.435 (Windows 10 vmware)
        BLOccupied:,UltraNetCam3:,weatherXML:,RFXCOM:,Current Cost 3P:,UltraGCIR3:
        DMMQTT:,Kodi:,Z-Wave:,BLRadar:,EasyTrigger:,MySensors:,BLBackup:

        Comment


          #5
          Ok I figured it out. Looks like two separate issues:
          1. Settings are not being loaded into the UI (previously set fields are blank)
            1. Looks like a known issue that has been reported at https://github.com/HomeSeer/Plugin-SDK/issues/111
            2. The workaround is to override the LoadSettingsFromIni() function
          2. GetINISetting doesn't seem to work
            1. I just wrote my own function that uses GetIniSection() and I manually find the values which seem to work
          It seems like the HS4 SDK has a bunch of bugs. Able to overcome a bunch thus far but I wish there was better list of "known issues" and workarounds.

          Comment


            #6
            Originally posted by dmurphy View Post

            I found this thread, I'm still working my way through my first HS4 plugin so I've not used this code....

            https://forums.homeseer.com/forum/de...ion-in-c/page3
            Thanks that is helpful. From looking at that code, I basically have to enumerate all of the devices in the system to find my by a unique ID that I set.

            I wish there was an architectural diagram or different plugin examples on how to implement different scenarios. I think the common one is a cloud end-point in which it's not only syncing status but also relaying commands back to the cloud.

            I've spent days reading other peoples code from HS3 and the HS4 SDK to onboard myself which I think I have a good handle on now but could have been easier. As they say, "the code is the manual"

            Comment

            Working...
            X