Announcement

Collapse
No announcement yet.

TPLink Smarthome Plugin

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

  • TPLink Smarthome Plugin

    I am using this forum for the TPLink Smarthome Plugin until I remember/get permission to add a forum for this plugin.
    Please note:
    I've attached a beta version of the plugin.

    Features
    • Use a tplink device like any other Hs device
    • Turn on/off the led for SmartPlugs via an event action
    • Change colors of a color Smartbulb via an event action
    • Chart out the energy usage for HS110 devices


    Install instructions:
    1. Copy HSPI_TPLInkSmartHome.exe and HSPI_TPLinkSmartHome.exe.config to the HS3 main directory (with all other plugins)
    2. Create new directory TPLinkSmartHome under you HS3 Bin directory. Usually c:\Program Files(x86)\Homeseeer HS3\Bin\TPLinkSmartHome
    3. Copy Newtonsoft.Json.dll to the new directory you just created.


    Setup:
    1. Discover the tplink devices using the setup page.
    2. The discover uses a broadcast message which the tplink devices sometimes fail to respond so use the individual IP text box for those.
    3. Create the devices.
    4. Go to the config for those devices and select their polling priority
    .

    Version 19.4.4 Added support for devices with multiple outlets such as HS107(tested) and HS300(tested). Also re-wrote polling to speed it up and make it more stable.
    Version 19.4.9 Added support for HS300 energy monitoring. Added ability to turn on/off extra devices for watts/amps when those devices are available. Fixed an issue where energy usage charts were not displaying on device config.
    Version 19.4.18 added devices for voltage and totals. Allow individual selection of which devices to create. Devices will be automatically added/deleted upon next auto discovery which runs approximately every 5 minutes (no need to restart plugin or manually delete devices).
    Attached Files
    Last edited by jasv; July 29th, 2018, 10:39 AM.
    James

    Running HS 3 on Win10 .

  • #2
    Getting several of these errors during "discovery"

    Posting back to plugin web page TPLinkSetup: Could not load file or assembly 'Newtonsoft.Json, Version=8.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies. The system cannot find the file specified.-> Server stack trace: Exception rethrown at [0]: at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessag e(IMessage reqMsg, IMessage retMsg) at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(Mess ageData& msgData, Int32 type) at HomeSeerAPI.IPlugInAPI.PostBackProc(String page, String data, String user, Int32 userRights) at Scheduler.proxyPage.postBackProc(StateObject& state, String Data)
    Also this is in the log:

    TPLinkSmartHome Error Exception in Find_Create_Devices/Find: Could not load file or assembly 'Newtonsoft.Json, Version=8.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies. The system cannot find the file specified.

    Comment


    • #3
      Did you copy the config as well?
      If you did, there is a dll that needs to be in the directory.
      Let me get those instructions and I will post them shortly.
      James

      Running HS 3 on Win10 .

      Comment


      • #4
        Originally posted by jasv View Post
        Did you copy the config as well?
        If you did, there is a dll that needs to be in the directory.
        Let me get those instructions and I will post them shortly.
        Copied both files in the Zip file into the HS3 root directory (per instructions). There's other posts about the Newtonsoft json parser and loading issues and it breaking plugins if it's in the root directory as well.

        Comment


        • #5
          You are exactly correct.
          Please look at the instructions and download the new zip file.
          Thanks for your feedback.
          James

          Running HS 3 on Win10 .

          Comment


          • #6
            Originally posted by jasv View Post
            You are exactly correct.
            Please look at the instructions and download the new zip file.
            Thanks for your feedback.
            I'm still getting the error about the Newtonsoft.Json.dll

            I have the two files in my bin/homeseer directory (already) and they are the same file.

            Comment


            • #7
              I've noticed the following:

              In the PI xml file the directory doesn't exist (might be created on discover)

              HTML Code:
              <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
                    <probing privatePath="bin/TPLinkSmartHome"/>
              Also as like other PI's there's no dependentAssembly stanza. Example from Chromecast PI using Newtonsoft.json as well

              HTML Code:
              <dependentAssembly>
                        <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
                        <bindingRedirect oldVersion="0.0.0.0-9.0.0.0" newVersion="9.0.0.0"/>
                        <codeBase version="9.0.0.0" href="bin/Chromecast/Newtonsoft.Json.dll"/>
                      </dependentAssembly>
              My guess is the version or KeyToken aren't matching from the one already in bin/homeseer

              Comment


              • #8
                My apologies.
                As you already gathered, you need to create a new directory Bin\TPLinkSmartHome and put the newtown dll there.
                I will update the instructions.
                James

                Running HS 3 on Win10 .

                Comment


                • #9
                  I need to step out for a bit.
                  In the 2 installations I've tried, the config worked fine as long as the files and directories existed. Let me know if you find out otherwise.
                  James

                  Running HS 3 on Win10 .

                  Comment


                  • #10
                    No worries. I'm terrible about packaging for distribution of things I write.

                    Anyways, fixed the directory and plugin loaded no errors.

                    On discovery I notice it discovered a couple of my plugs. Then I hit discover again and it found 1 more, then I hit it again and one of the plugs vanished from the list. FYI

                    So I then try to "add to HS3" and I get the following error in the log

                    Apr-29 13:52:33 TPLinkSmartHome Error Error in 2nd creation extradata object - jav, ip was not saved
                    Apr-29 13:52:33 TPLinkSmartHome Error Error in creating extradata object - jav, trying again
                    Apr-29 13:52:33 TPLinkSmartHome Error Error in 2nd creation extradata object - jav, ip was not saved
                    Apr-29 13:52:33 TPLinkSmartHome Error Error in creating extradata object - jav, trying again
                    A HS3 device was created, but when trying to control and from the polling I have this in my log

                    Apr-29 13:56:20 TPLinkSmartHome Error error 'string' does not contain a definition for 'feature'
                    Apr-29 13:56:16 TPLinkSmartHome Error error 'string' does not contain a definition for 'feature'
                    Apr-29 13:56:12 TPLinkSmartHome Error error 'string' does not contain a definition for 'feature'
                    Apr-29 13:56:04 TPLinkSmartHome Error error 'string' does not contain a definition for 'feature'
                    Apr-29 13:56:00 TPLinkSmartHome Error error 'string' does not contain a definition for 'feature'
                    Apr-29 13:55:56 TPLinkSmartHome Error error 'string' does not contain a definition for 'feature'
                    Apr-29 13:55:46 TPLinkSmartHome Error Exception in timer_check_for_device_changes(): Object reference not set to an instance of an object.
                    Apr-29 13:55:41 TPLinkSmartHome Error TPLinkSmartDevice.Refresh() error:Protocol error could not connect to (No connection could be made because the target machine actively refused it [2001:0:9d38:90d7:1064:87ef:5955:e1d2]:9999)
                    Apr-29 13:55:07 TPLinkSmartHome Error error 'string' does not contain a definition for 'feature'
                    Apr-29 13:54:59 TPLinkSmartHome Error error 'string' does not contain a definition for 'feature'
                    Apr-29 13:52:55 TPLinkSmartHome Error error 'string' does not contain a definition for 'feature'
                    Apr-29 13:52:51 TPLinkSmartHome Error error 'string' does not contain a definition for 'feature'
                    Apr-29 13:52:33 TPLinkSmartHome Error Error in creating extradata object - jav, trying again
                    Apr-29 13:52:33 TPLinkSmartHome Error Error in 2nd creation extradata object - jav, ip was not saved
                    Apr-29 13:52:33 TPLinkSmartHome Error Error in 2nd creation extradata object - jav, ip was not saved
                    Apr-29 13:52:33 TPLinkSmartHome Error Error in creating extradata object - jav, trying again

                    Comment


                    • #11
                      Some of those errors can be ignored. (Chatty!). But some may be an issue.
                      Try looking at the status page and also see if any of the devices have been created. And if so, see if they work.
                      The "discover" is really hit and miss. I've sniffed the traffic and the devices sometimes just don't respond to a broadcast but respond to the direct ip textbox.
                      James

                      Running HS 3 on Win10 .

                      Comment


                      • #12
                        Originally posted by jasv View Post
                        Some of those errors can be ignored. (Chatty!). But some may be an issue.
                        Try looking at the status page and also see if any of the devices have been created. And if so, see if they work.
                        The "discover" is really hit and miss. I've sniffed the traffic and the devices sometimes just don't respond to a broadcast but respond to the direct ip textbox.
                        1. The devices are created (good)
                        2. They are not controllable (bad)

                        Comment


                        • #13
                          Can you send me a picture your status page? Also,
                          Can you go into one of the devices and send me a picture of the TPSmartHome tab?

                          I am leaving for a couple of hours but will check when I return.
                          James

                          Running HS 3 on Win10 .

                          Comment


                          • #14
                            Originally posted by jasv View Post
                            Can you send me a picture your status page? Also,
                            Can you go into one of the devices and send me a picture of the TPSmartHome tab?

                            I am leaving for a couple of hours but will check when I return.





                            So for the Plug 1 (screenshots above) I can control on/off. This is a HS100. However for my HS105 plugs I get nothing.

                            Also in the device there is no TPSmartHome for plug 1. But If I look at a couple other plugs some of them have that tab and some do not. Kinda hit or miss. Here's one that does have the tab



                            So in summary:

                            Control for some plugs works and for others it doesn't. Some have the tab and some don't.

                            Comment


                            • #15
                              One more tidbit. I reloaded the plugin and the tab is now showing on all of my devices.

                              I did another discovery to try and load in the rest of the plugs I have (plugged in) and I noticed this in the log.

                              Apr-29 14:30:49 Error Posting back to plugin web page TPLinkSetup: Object reference not set to an instance of an object.-> at System.Runtime.Remoting.Messaging.LogicalCallContext.Propaga teIncomingHeadersToCallContext(IMessage msg) at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(Mess ageData& msgData, Int32 type) at HomeSeerAPI.IPlugInAPI.PostBackProc(String page, String data, String user, Int32 userRights) at Scheduler.proxyPage.postBackProc(StateObject& state, String Data)
                              Apr-29 14:30:49 Error Calling HSEvent in plugin TPLinkSmartHome, Instance :Object reference not set to an instance of an object.

                              Comment

                              Working...
                              X