Announcement

Collapse
No announcement yet.

Sample Plugin

Collapse
This is a sticky topic.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Sample Plugin

    [UPDATED 11/12/18]

    Here are 3 sample HS3 plug-ins that can be used as a starting point for new plugins or for modifying existing plugins.

    Version 1.0.0.2:

    http://homeseer.com/updates3/sample_plugins.zip

    Changes in 1.0.0.2:
    * changes to match new deviceAPI changes

    Changes in 1.0.0.1:

    * Fixed compile errors due to API changes
    Last edited by rjh; November 12, 2018, 10:32 AM.
    💁‍♂️ Support & Customer Service 🙋‍♂️ Sales Questions 🛒 Shop HomeSeer Products

    #2
    Rich
    I think the sample plugin still has issues related to device subtype. In the first version, you assigned 69 to the device subtype other.
    In the new version you are assigning a Plugin as the device type, but overwriting that value with 69.

    Should the new version be: DT.Device_SubType_Other = 69

    See new/old screenshots:
    Attached Files
    HS4Pro on a Raspberry Pi4
    54 Z-Wave Nodes / 21 Zigbee Devices / 108 Events / 767 Devices
    Plugins: Z-Wave / Zigbee Plus / EasyTrigger / AK Weather / OMNI

    HSTouch Clients: 1 Android

    Comment


      #3
      I think the issue is not with the 69 assignment but rather that Plug_in (part of eDeviceAPI) should really be assigned to Device_API instead of Device_Type. Clarity on the 69 (versus other numbers) would be welcome, but I believe is what you choose as the device type in your custom plugin.

      Comment


        #4
        Is there a reason that DT.Device_Type is assigned twice, or is that as buggy as it looks? In the previous version of the plugin the second assignment was DT.Device_SubType_Other.

        Should the second assignment really be DT.Device_SubType = 69?
        HS Pro 3.0 | Linux Ubuntu 16.04 x64 virtualized under Proxmox (KVM)
        Hardware: Z-NET - W800 Serial - Digi PortServer TS/8 and TS/16 serial to Ethernet - Insteon PLM - RFXCOM - X10 Wireless
        Plugins: HSTouch iOS and Android, RFXCOM, BlueIris, BLLock, BLDSC, BLRF, Insteon PLM (MNSandler), Device History, Ecobee, BLRing, Kodi, UltraWeatherWU3
        Second home: Zee S2 with Z-Wave, CT101 Z-Wave Thermostat, Aeotec Z-Wave microswitches, HSM200 occupancy sensor, Ecolink Z-Wave door sensors, STI Driveway Monitor interfaced to Zee S2 GPIO pins.

        Comment


          #5
          Rich will be posting an updated sample with this corrected.
          Wade

          "I know nothing... nothing!"

          Comment


            #6
            jsquery code for the test page as part of the sample plugin

            At the webinar, it was stated that you would release the code that goes behind the "test" webpage showing how the JSQuery examples work.
            I've been struggling with the slidertab, when I open it up, the content of the slidertab shows up briefly but then disappears or my webpage content shows up twice. I'm doing something wrong somewhere, but don't know where yet.
            Dirk

            Comment


              #7
              I have the test page added to the sample plugin, will post it tomorrow.

              Originally posted by dcorsus View Post
              At the webinar, it was stated that you would release the code that goes behind the "test" webpage showing how the JSQuery examples work.
              I've been struggling with the slidertab, when I open it up, the content of the slidertab shows up briefly but then disappears or my webpage content shows up twice. I'm doing something wrong somewhere, but don't know where yet.
              Dirk
              💁‍♂️ Support & Customer Service 🙋‍♂️ Sales Questions 🛒 Shop HomeSeer Products

              Comment


                #8
                Trigger / action collections

                I noticed that the sample plug-in creates thread safe wrappers around the trigger and action SortedLists but then it is also SyncLocking only when removing an element, not adding, enumerating etc.

                Code:
                Public Sub New()
                        MyBase.New()
                
                        ' Create a thread-safe collection by using the .Synchronized wrapper.
                        colTrigs_Sync = New System.Collections.SortedList
                        colTrigs = System.Collections.SortedList.Synchronized(colTrigs_Sync)
                
                        colActs_Sync = New System.Collections.SortedList
                        colActs = System.Collections.SortedList.Synchronized(colActs_Sync)
                End Sub
                From Add_Update_Trigger():
                Code:
                            If Trig1 IsNot Nothing Then
                                If Trig1.TriggerUID < 1 Then Exit Sub
                                sKey = "K" & Trig1.TriggerUID.ToString
                                If colTrigs.ContainsKey(sKey) Then
                                    [B]SyncLock colTrigs.SyncRoot[/B]
                                        colTrigs.Remove(sKey)
                                    [B]End SyncLock[/B]
                                End If
                                colTrigs.Add(sKey, Trig1)
                            End If
                Why is the SyncLock needed for removal but no other operation?

                Cheers,
                Don

                Comment


                  #9
                  Originally posted by rjh View Post
                  I have the test page added to the sample plugin, will post it tomorrow.
                  Hi Rich, will you be able to post this soon? The jquery samples would be very helpful to look at.
                  HS Pro 3.0 | Linux Ubuntu 16.04 x64 virtualized under Proxmox (KVM)
                  Hardware: Z-NET - W800 Serial - Digi PortServer TS/8 and TS/16 serial to Ethernet - Insteon PLM - RFXCOM - X10 Wireless
                  Plugins: HSTouch iOS and Android, RFXCOM, BlueIris, BLLock, BLDSC, BLRF, Insteon PLM (MNSandler), Device History, Ecobee, BLRing, Kodi, UltraWeatherWU3
                  Second home: Zee S2 with Z-Wave, CT101 Z-Wave Thermostat, Aeotec Z-Wave microswitches, HSM200 occupancy sensor, Ecolink Z-Wave door sensors, STI Driveway Monitor interfaced to Zee S2 GPIO pins.

                  Comment


                    #10
                    +1 the test page looks great - would just love to see the clsPageBuilder code-behind...
                    HS4Pro on a Raspberry Pi4
                    54 Z-Wave Nodes / 21 Zigbee Devices / 108 Events / 767 Devices
                    Plugins: Z-Wave / Zigbee Plus / EasyTrigger / AK Weather / OMNI

                    HSTouch Clients: 1 Android

                    Comment


                      #11
                      errors in util.vb

                      Looking at hspi_sample 1.0.0.2 in VS2010

                      i have scheduler.dll, homeseerapi.dll and hscf.dll referenced in the project

                      Where is ePairProtection defined from the following line in Find_Create_Devices

                      Code:
                      Pair.ProtectionSet = ePairProtection.Do_Not_Delete
                      Also, the following is causing an error. DeviceVSP_AddRange doesn't exist

                      Code:
                      hs.DeviceVSP_AddRange(ref, "Dim ", 1, 99, ePairStatusControl.Both, True, 0, "", "%", True, 0)
                      can someone shed some light on these issues
                      Mark

                      HS3 Pro 4.2.19.5
                      Hardware: Insteon Serial PLM | AD2USB for Vista Alarm | HAI Omnistat2 | 1-Wire HA7E | RFXrec433 | Dahua Cameras | LiftMaster Internet Gateway | Tuya Smart Plugs
                      Plugins: Insteon (mine) | Vista Alarm (mine) | Omnistat 3 | Ultra1Wire3 | RFXCOM | HS MyQ | BLRadar | BLDenon | Tuya | Jon00 Charting | Jon00 Links
                      Platform: Windows Server 2022 Standard, i5-12600K/3.7GHz/10 core, 16GB RAM, 500GB SSD

                      Comment


                        #12
                        epairprotection is deleted in the latest build of hs3. so delete the lines, see the new devicecreation example posted here to add range.


                        http://forums.homeseer.com/showthread.php?t=157791
                        Last edited by wetlip; January 20, 2013, 04:56 PM.

                        Comment


                          #13
                          I tried to follow the sample plugin link and it asks for a login to the HS FTP site. How do I get the login information or is there another location where the sample is posted?

                          The reason I am looking for the sample is associated with the use of the sUnique parameter of TriggerBuildUI. I have become aware that this parameter appears to be important for the case where an event was created by copy of another event. The event ID remains the same between the original and copied event triggers, but apparently the sUnique parameter distinguishes them. It seems this parameter need to be retained by the plugin with the other user-entered data that defines the event, but before I go down that path I want to see what HS does for this or what the best practice is.

                          Comment


                            #14
                            That link was bad, I fixed the link so you can download the file now.

                            Originally posted by Michael McSharry View Post
                            I tried to follow the sample plugin link and it asks for a login to the HS FTP site. How do I get the login information or is there another location where the sample is posted?

                            The reason I am looking for the sample is associated with the use of the sUnique parameter of TriggerBuildUI. I have become aware that this parameter appears to be important for the case where an event was created by copy of another event. The event ID remains the same between the original and copied event triggers, but apparently the sUnique parameter distinguishes them. It seems this parameter need to be retained by the plugin with the other user-entered data that defines the event, but before I go down that path I want to see what HS does for this or what the best practice is.
                            💁‍♂️ Support & Customer Service 🙋‍♂️ Sales Questions 🛒 Shop HomeSeer Products

                            Comment


                              #15
                              Thanks Rich, but this link seems to include only the executable and not the source. I did find a very early version on the sample source on my computer and it seemed to only use the sUnique trigger parameter as part of the control on the web page and not retained. This leaves open the question of how to distinguish between two triggers where the second was created by use of the copy event option and they both share the same UID.

                              Comment

                              Working...
                              X