Announcement

Collapse
No announcement yet.

Yet another HSPI plugin library

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

    #16
    Originally posted by Simplex Technology View Post
    I'm not disrepecting anyone by saying the HS documentation and SDK are lacking in documentation or direction. This is a long standing complaint by many.
    Yeah, exactly, I didn't mean . I mean HST should respect their paying customers a bit more.It was a painful process trying to work out all bits and pieces. Unnecessary long and painful. It could be more pleasant if SDK itself was more "user friendly", then you don't really need documentation....

    Comment


      #17
      Originally posted by alexbk66 View Post
      Yeah, exactly, I didn't mean . I mean HST should respect their paying customers a bit more.It was a painful process trying to work out all bits and pieces. Unnecessary long and painful. It could be more pleasant if SDK itself was more "user friendly", then you don't really need documentation....
      I think many of us completely agree.

      Comment


        #18
        I moved repository to Bitbucket, including a few improvements:

        https://bitbucket.org/_alexbk66/hspi...te/src/master/

        Comment


          #19
          Originally posted by alexbk66 View Post
          I moved repository to Bitbucket, including a few improvements:

          https://bitbucket.org/_alexbk66/hspi...te/src/master/
          Thanks. I actually prefer BitBucket myself as well for private code.

          I've been going through your example and it's nicely done. I only see in the Devicebase a method for a "basic" device with no further reference for a device with options "advanced" or for paraent/child devices. Was the current idea to provide the base and then it can be extended through the plugin? I'm still wrapping my head around C# so I'm being a little slow/dense.

          Comment


            #20
            Originally posted by Simplex Technology View Post
            I've been going through your example and it's nicely done. I only see in the Devicebase a method for a "basic" device with no further reference for a device with options "advanced" or for paraent/child devices. Was the current idea to provide the base and then it can be extended through the plugin? I'm still wrapping my head around C# so I'm being a little slow/dense.
            Not sure what you mean by "basic"/"advanced" device?
            And in this version I added functions for parent/child relations, and more methods for creating VSPairs.

            And more helpers in PageBuilder class, i.e. TableObjectProperties function for displaying object properties in a table
            Code:
            public string BuildTable(NeoHub hub)
            {
                var table = new TableBuilder($"NeoHub configuration dump",
                                    ncols: 2,
                                    page_name: PageName,
                                    tableID: "table_info",
                                    inSlider: false
                                    );
            
                TableObjectProperties(hub, table);
                if(hub!=null)
                    TableObjectProperties(hub.system, table);
            
                return table.Build();
            }
            Click image for larger version  Name:	Capture.PNG Views:	1 Size:	113.2 KB ID:	1293528

            Comment


              #21
              Example creating a device derived from DeviceBase:
              Code:
              public override bool Create()
              {
                  bool created = Create($"NeoStatFloorTemp-{zone}",
                              force: false,
                              type: "akHeatmiserNEO Floor Temp",
                              Device_API: DeviceTypeInfo_m.DeviceTypeInfo.eDeviceAPI.Thermostat,
                              Device_Type: (int)DeviceTypeInfo_m.DeviceTypeInfo.eDeviceType_Thermostat.Temperature,
                              Device_SubType: (int)DeviceSubtype.stat_floortemp,
                              Device_SubType_Description: "NeoStat Floor Temperature"
                              );
              
                  if (created)
                  {
                      AddVSPair((double)HubControlStates.NotConnected
                                  , "Not Connected"
                                  , ePairControlUse.Not_Specified
                                  , "/images/HomeSeer/status/unknown.png"
                                  , Status_Control: ePairStatusControl.Status
                                  );
              
                      AddVSTemperaturePair( hub.TempFormat == TempFormat.C,
                                              hub.MinTemp,
                                              hub.MaxTemp,
                                              RangeStatusDecimals: 1,
                                              Status_Control: ePairStatusControl.Status
                                              );
                  }
                  return created;
              }

              Comment


                #22
                And example of creating a child device from parent:
                Code:
                setTempDevice = new NeoStatSetTempDevice(controller as Controller, hub, zone, stat);
                setTempDevice.SetParent(this);
                Example of using PED to save device settings (inside derived device class):
                Code:
                public bool log_enable
                {
                    get
                    {
                        return GetPED<bool>(Utils.FuncName());
                    }
                    set
                    {
                        SavePED(Utils.FuncName(), value);
                    }
                }

                Comment


                  #23
                  alexbk66 and

                  OK, thanks to your efforts and these recent PI discussions, I'm convinced that writing a plugin is in my future. There are a couple of use cases related to solar power and EV charging that will make it worth the time.

                  Can someone tell me what is needed to set up a windows dev environment?

                  Thanks in advance.

                  Comment


                    #24
                    Originally posted by logbuilder View Post

                    Can someone tell me what is needed to set up a windows dev environment?
                    If you haven't seen it yet, jeanv has posted some great beginner tutorial videos.
                    -Wade

                    Comment


                      #25
                      Originally posted by cc4005 View Post

                      If you haven't seen it yet, jeanv has posted some great beginner tutorial videos.
                      Thanks for pointing me to these videos!

                      Comment


                        #26
                        Originally posted by cc4005 View Post
                        If you haven't seen it yet, jeanv has posted some great beginner tutorial videos.
                        My template was based on Alex Dresko work initially, but I removed all unnecessary (in my view) stuff, i.e. using PowerShell and the Visual Studio template itself, I reckon it's over complicating things unnecessary.

                        Using my template all you need is
                        1. VisualStudio 2017 (i.e. Express if you want free).
                        2. Download my code
                        3. You need set references to HS dlls (HomeSeerAPI.dll, HSCF.dll and Scheduler.dll) - either copy them from your HS installation to the project root, or set project references to point to the dll locations.
                        4. and it should compile and run.

                        Just need make changes related to your plugin (things that Alex Dresko automated in his template):
                        1. rename the project,
                        2. adjust AssemblyInfo.cs, i.e. AssemblyTitle, AssemblyProduct
                        3. change project settings, i.e. "Assembly name" and "Default namespace"
                        4. and finally change the plugin name in HSPI.cs GetName() function

                        Comment


                          #27
                          I updated a lot of stuff:

                          1. Added Triggers/Actions framework - created to simplify adding Triggers and Actions
                          2. Added examples for Triggers, Actions, Config Page, Device Config page
                          3. Hips of fixes

                          Comment


                            #28
                            Very nice :-)
                            Only i'm unable to get the page commands working (this.pageCommands.Add("refresh", "true" ) etc... Any clues?

                            Comment


                              #29
                              I made a few improvements including
                              Code:
                              this.pageCommands.Add("starttimer", "")
                              Need to find time to merge and submit the changes...

                              Comment


                                #30
                                Originally posted by alexbk66 View Post
                                I made a few improvements including
                                Code:
                                this.pageCommands.Add("starttimer", "")
                                Need to find time to merge and submit the changes...
                                At the moment none of the pageCommands and/or update commands seem to have any effect on the page. Can you maybe give me a little hint about what i could do to create a tmp workaround?

                                Comment

                                Working...
                                X