Page 7 of 8

Re: TP-Link WiFi Switches

PostPosted: Sun Sep 22, 2019 9:48 am
by berkinet
CliveS wrote:
Due to the Alexa Hue being neutered (thanks Amazon!!) I decided to buy an HS110 and it works well but when I Send Status Request or Update I get the following error

Code: Select all
 TP-Link Device Error            Error in plugin execution ExecuteAction:

Traceback (most recent call last):
  File "plugin.py", line 333, in actionControlUniversal
TypeError: not enough arguments for format string
Thanks. Looks like a bug. I'll check it out.

Re: TP-Link WiFi Switches

PostPosted: Sun Sep 22, 2019 10:41 am
by jtburgess
New release 0.8.1 uploaded.
Thanks berkinet for the quick fix turnaround!

Re: TP-Link WiFi Switches

PostPosted: Sun Sep 22, 2019 10:53 am
by CliveS
jtburgess wrote:
New release 0.8.1 uploaded.
Thanks berkinet for the quick fix turnaround!


That fixed it, thanks Berkinet for that and great plugin from all 3 off you.

Re: TP-Link WiFi Switches

PostPosted: Sat Dec 21, 2019 4:34 am
by qcvictor
Hi Guys
He work with HS100 but get this error continuously on idle:
Code: Select all
TP-Link Device Error (tpl_polling.py:run:118): Basement Outlet Subwoofer connection failed with ([Errno 57] Socket is not connected)

this one when I toggle on or off :
Code: Select all
TP-Link Device Error            (tpl_polling.py:run:118): Basement Outlet Subwoofer connection failed with ([Errno 57] Socket is not connected)
   TP-Link Device Error            Error in plugin execution ExecuteAction:

Traceback (most recent call last):
  File "plugin.py", line 284, in actionControlDimmerRelay
  File "/Library/Application Support/Perceptive Automation/Indigo 7.4/Plugins/TP-Link-Device.indigoPlugin/Contents/Server Plugin/protocol.py", line 124, in send
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/socket.py", line 228, in meth
error: [Errno 57] Socket is not connected

   TP-Link Device Error            (tpl_polling.py:run:118): Basement Outlet Subwoofer connection failed with ([Errno 57] Socket is not connected)

Re: TP-Link WiFi Switches

PostPosted: Sat Dec 21, 2019 10:45 am
by berkinet
qcvictor wrote:
Hi Guys
He work with HS100 but get this error continuously on idle:
Code: Select all
TP-Link Device Error (tpl_polling.py:run:118): Basement Outlet Subwoofer connection failed with ([Errno 57] Socket is not connected)
...

It looks like your connection to the plug is not working. The error message Socket is not connected refers to an IP network socket rather than a wall plug.

Re: TP-Link WiFi Switches

PostPosted: Sat Dec 21, 2019 11:32 am
by qcvictor
humm not sure to understand, when I toggle On or Off the plug through indigo, she is well controlled !

Re: TP-Link WiFi Switches

PostPosted: Sun Dec 22, 2019 12:45 am
by berkinet
qcvictor wrote:
humm not sure to understand, when I toggle On or Off the plug through indigo, she is well controlled !

The retry algorithm on a send may be different than that used to check status. But, in any case, it appears the problem is in your network and not the plugin. You might try moving the plug closer to a Wi-Fi his as a test.

Re: TP-Link WiFi Switches

PostPosted: Mon Dec 30, 2019 3:42 pm
by noeau
Same here. I get the "socket not connected" error on 2 of 3 switches. The third one is in the same circuit and location as the other 2. I just updated to the newest plugin and re-added the 3 plugs. They work fine. I just get the error message every second or so.

Re: TP-Link WiFi Switches

PostPosted: Tue Dec 31, 2019 3:25 am
by berkinet
noeau wrote:
Same here. I get the "socket not connected" error on 2 of 3 switches. The third one is in the same circuit and location as the other 2. I just updated to the newest plugin and re-added the 3 plugs. They work fine. I just get the error message every second or so.

Please note, the physical electrical circuit to which the TP-Link plug is connected means nothing. All that matters is the quality of the Wi-Fi connection between the TP-Link device and the Wi-Fi network. The error you and @qcvictor are reporting is occurring in the section of the code where the plugin polls the device for its current state. If you are interested, here is the actual code involved.
Code: Select all
            try:
               result = tplink_dev_states.send('info')
               self.logger.debug("%s connection received (%s)" % (self.name, result))
               data = json.loads(result)
            except Exception as e:
               self.logger.error("%s connection failed with (%s)" % (self.name, str(e)))
The error occurs on the attempt to get the current state (result). The error reported is caused because no connection to the TP-Link is opened. This may be due to poor connectivity, network congestion or the target device being busy.

If you want to try a small experiment, and are comfortable editing Python code, you could try to increase the socket connection timeout value. The is located in tplink_smartplug.py on line 36
Code: Select all
s.settimeout(2.0)
You can try increasing the value to 3.0, 3.5 or even 4.0. If that works, please report back here and I can update the plugin.

Re: TP-Link WiFi Switches

PostPosted: Tue Dec 31, 2019 3:07 pm
by noeau
I don't know if it makes a difference but the one that works has a hardware version of 2.0 and Firmware of 1.5.4. And the two that don't work are hardware version 1.0 with a firmware of 1.2.5

Re: TP-Link WiFi Switches

PostPosted: Wed Jan 01, 2020 4:05 am
by berkinet
noeau wrote:
I don't know if it makes a difference but the one that works has a hardware version of 2.0 and Firmware of 1.5.4. And the two that don't work are hardware version 1.0 with a firmware of 1.2.5

It might be a timing difference between the two versions of the hardware. But in any case it is still not really a plug-in issue, other than adjusting the socket connection timeout, which might or might not work.

Re: TP-Link WiFi Switches

PostPosted: Wed Dec 09, 2020 6:33 pm
by johnpolasek
Quick question: what all data is required to add another device? I looked on Amazon and found they had KL100s for under $15 apiece, so I ordered one for the heck of it... the plugin finds it and IDs the model number just fine, but when I try to save, it fails with a message that ChildID not found in dict... which I assume means it didn't find the model number and associated command information. If I could find any hints on what commands to put in the dict, I'd be willing to add it myself and post it back...

Re: TP-Link WiFi Switches

PostPosted: Wed Dec 16, 2020 4:09 pm
by pgershon
Any experience with the Kasa Smart HS220 Dimmer Switch by TP-Link? Seems like a great alternative to Insteon dimmers (which re not available right now anyway)

Re: TP-Link WiFi Switches

PostPosted: Mon Dec 21, 2020 8:27 am
by johnpolasek
My only experience is with the HS200 "on/off" switch, which works wonderfully (at least for the past week) in an environment where insteon signals are being trashed by a pump controller. But looking at the 0.8.1 TPLink, code while trying to add a KL110 bulb to the capabilities, it looked like the command set for the KASA devices did not include any commands other than on and off despite the fact that the devices are defined as Indigo dimmer devices. But I admit I could have missed it since I wasn't looking in that direction.

Re: TP-Link WiFi Switches

PostPosted: Mon Dec 21, 2020 11:43 am
by jtburgess
The current TP-link device type is “relay”.
I will be defining a new “dimmer” device, once I figure out how to integrate new logic into the existing code.
The code I’ve found so far is python3, so I’m working on learning and back-porting it.
Stay tuned.