TP-Link Plugin v 0.9.3

Posted on
Mon Feb 15, 2021 2:46 pm
jtburgess offline
User avatar
Posts: 58
Joined: Jan 17, 2018
Location: NJ

TP-Link Plugin v 0.9.3

The new version supports these subtypes:
  1. the original Smart Plug (plug-ins and power strips)
  2. Smart Relay/Switch (wall switch with dimmer)
  3. Smart Bulb (light bulbs with dimmer)

Each type has a list of TP-link Model numbers (e.g. HS100, KP200, KL100) that are supported by each type.
Caveat: some of these assignments are guesses, because I can't test every model out there. (TP-Link keeps coming up with new ones!)
The reason for the 3 types is that they support fundamentally different JSON protocols.
If you discover a new model - it will show up as "unknown" - please add it to the appropriate model list in
tplink_*_plugin.py
.
If that works, let me know and I'll add it to the base code.
If it doesn't work with any existing type, use the command line tool (found in the top level directory of the plugin), run the 'info' command and send me the results. You may have discovered a new species!

I need to update the plugin description, because there are now several actions for the Smart Switch type, two of which also work for the dimmer bulb type to set its "ramp time" (the time it takes to change from one brightness to another). You can also set the rampTime in the Device Config dialog.

As always, let me know of any bugs or features you want to see.

Thanks, John

PS Does anyone have colored bulbs? How would you like them to behave? How about an action to set the color?

Posted on
Wed Feb 17, 2021 10:10 am
Ramias offline
Posts: 209
Joined: Nov 24, 2015

Re: TP-Link Plugin v 0.9.3

Upgraded from a previous version and getting this for a number of devices in my logs; it also disables comm for a number of my outlets. Rolling back to previous version resolves this.

Code: Select all
Stopped plugin TP-Link Devices
   Upgrading plugin TP-Link Devices to newer version 0.9.3 (previous version moved to trash)
   Loading plugin "TP-Link Devices 0.9.3"
   Starting plugin "TP-Link Devices 0.9.3" (pid 13633)
   TP-Link Devices                 Log level set to info
   Started plugin "TP-Link Devices 0.9.3"
   TP-Link Devices Error           (tpl_relay_poll.py:run:81): Basement Bass Speaker connection failed with ('NoneType' object has no attribute 'debug')
   TP-Link Devices Error           (tpl_relay_poll.py:run:316): Error attempting to update Basement Bass Speaker: local variable 'data' referenced before assignment. Will try again in 30 seconds
   TP-Link Devices Error           (tpl_relay_poll.py:run:81): Basement Bass Speaker connection failed with ('NoneType' object has no attribute 'debug')
   TP-Link Devices Error           (tpl_relay_poll.py:run:316): Error attempting to update Basement Bass Speaker: local variable 'data' referenced before assignment. Will try again in 30 seconds
   TP-Link Devices Error           (tpl_relay_poll.py:run:81): Basement Bass Speaker connection failed with ('NoneType' object has no attribute 'debug')
   TP-Link Devices Error           (tpl_relay_poll.py:run:316): Error attempting to update Basement Bass Speaker: local variable 'data' referenced before assignment. Will try again in 30 seconds
   TP-Link Devices Error           (tpl_relay_poll.py:run:81): Basement Bass Speaker connection failed with ('NoneType' object has no attribute 'debug')
   TP-Link Devices Error           (tpl_relay_poll.py:run:316): Error attempting to update Basement Bass Speaker: local variable 'data' referenced before assignment. Will try again in 30 seconds
   TP-Link Devices Error           (tpl_relay_poll.py:run:81): Basement Bass Speaker connection failed with ('NoneType' object has no attribute 'debug')
   TP-Link Devices Error           (tpl_relay_poll.py:run:316): Error attempting to update Basement Bass Speaker: local variable 'data' referenced before assignment. Will try again in 30 seconds
   TP-Link Devices                 Polling started for Basement Bass Speaker@192.168.0.131.
   TP-Link Devices Error           (tpl_relay_poll.py:run:81): Basement Bass Speaker connection failed with ('NoneType' object has no attribute 'debug')
   TP-Link Devices Error           (tpl_relay_poll.py:run:316): Error attempting to update Basement Bass Speaker: local variable 'data' referenced before assignment. Will try again in 30 seconds
   TP-Link Devices Error           (tpl_relay_poll.py:run:81): Basement Bass Speaker connection failed with ('NoneType' object has no attribute 'debug')
   TP-Link Devices Error           (tpl_relay_poll.py:run:316): Error attempting to update Basement Bass Speaker: local variable 'data' referenced before assignment. Will try again in 30 seconds
   TP-Link Devices Error           (tpl_relay_poll.py:run:81): Basement Bass Speaker connection failed with ('NoneType' object has no attribute 'debug')
   TP-Link Devices Error           (tpl_relay_poll.py:run:316): Error attempting to update Basement Bass Speaker: local variable 'data' referenced before assignment. Will try again in 30 seconds
   TP-Link Devices Error           (tpl_relay_poll.py:run:81): Basement Bass Speaker connection failed with ('NoneType' object has no attribute 'debug')
   TP-Link Devices Error           (tpl_relay_poll.py:run:316): Error attempting to update Basement Bass Speaker: local variable 'data' referenced before assignment. Will try again in 30 seconds
   TP-Link Devices Error           (tpl_relay_poll.py:run:81): Basement Bass Speaker connection failed with ('NoneType' object has no attribute 'debug')
   TP-Link Devices Error           (tpl_relay_poll.py:run:316): Error attempting to update Basement Bass Speaker: local variable 'data' referenced before assignment. Will try again in 30 seconds
   TP-Link Devices Error           (tpl_relay_poll.py:run:81): Basement Bass Speaker connection failed with ('NoneType' object has no attribute 'debug')
   TP-Link Devices Error           (tpl_relay_poll.py:run:311): Unable to update Basement Bass Speaker: after 10 attempts. Polling for this device will now shut down. (local variable 'data' referenced before assignment)
   TP-Link Devices                 Polling started for Basement Sonos@192.168.0.131.
   TP-Link Devices                 Polling started for Basement Tivo@192.168.0.131.
   TP-Link Devices                 Polling started for Basement XBox 360@192.168.0.131.
   TP-Link Devices                 Polling started for Basement XBox One@192.168.0.131.
   TP-Link Devices                 Polling started for Basement Yamaha Receiver@192.168.0.131.
   TP-Link Devices Error           (tpl_relay_poll.py:run:81): Cabinet Lights Left connection failed with ('NoneType' object has no attribute 'debug')
   TP-Link Devices Error           (tpl_relay_poll.py:run:316): Error attempting to update Cabinet Lights Left: local variable 'data' referenced before assignment. Will try again in 30 seconds
   TP-Link Devices Error           (tpl_relay_poll.py:run:81): Cabinet Lights Left connection failed with ('NoneType' object has no attribute 'debug')
   TP-Link Devices Error           (tpl_relay_poll.py:run:316): Error attempting to update Cabinet Lights Left: local variable 'data' referenced before assignment. Will try again in 30 seconds
   TP-Link Devices Error           (tpl_relay_poll.py:run:81): Cabinet Lights Left connection failed with ('NoneType' object has no attribute 'debug')
   TP-Link Devices Error           (tpl_relay_poll.py:run:316): Error attempting to update Cabinet Lights Left: local variable 'data' referenced before assignment. Will try again in 30 seconds
   TP-Link Devices Error           (tpl_relay_poll.py:run:81): Cabinet Lights Left connection failed with ('NoneType' object has no attribute 'debug')
   TP-Link Devices Error           (tpl_relay_poll.py:run:316): Error attempting to update Cabinet Lights Left: local variable 'data' referenced before assignment. Will try again in 30 seconds
   TP-Link Devices Error           (tpl_relay_poll.py:run:81): Cabinet Lights Left connection failed with ('NoneType' object has no attribute 'debug')
   TP-Link Devices Error           (tpl_relay_poll.py:run:316): Error attempting to update Cabinet Lights Left: local variable 'data' referenced before assignment. Will try again in 30 seconds
   TP-Link Devices Error           (tpl_relay_poll.py:run:81): Cabinet Lights Left connection failed with ('NoneType' object has no attribute 'debug')

Posted on
Sun Feb 21, 2021 11:04 am
mintzps offline
Posts: 30
Joined: Apr 13, 2010

Re: TP-Link Plugin v 0.9.3

I just upgraded my mac to Big Sur and Indigo to 7.5. Just go a KASA Smart Outdoor plug. Trying to use the TP-Link plugin here is what I get in my log when I try to create a device. I dont have acluw when it comes to Python. What does all this mean?

Feb 21, 2021 at 11:42:36 AM
TP-Link Devices Error (plugin.py:getTpDevice:462): Discovery connection failed with ('NoneType' object has no attribute 'debug')

Feb 21, 2021 at 11:43:43 AM
TP-Link Devices Error Error in plugin execution UiAction:

Traceback (most recent call last):
File "plugin.py", line 507, in selectTpDevice
File "plugin.py", line 311, in initializeDev
File "/Library/Application Support/Perceptive Automation/Indigo 7.5/Plugins/TP-Link-Device.indigoPlugin/Contents/Server Plugin/protocol.py", line 99, in send
File "/Library/Application Support/Perceptive Automation/Indigo 7.5/Plugins/TP-Link-Device.indigoPlugin/Contents/Server Plugin/protocol.py", line 193, in debugLog
AttributeError: 'NoneType' object has no attribute 'debug'

TP-Link Devices Error Error in plugin execution UiValidate:

Traceback (most recent call last):
File "plugin.py", line 210, in validateDeviceConfigUi
File "/Library/Application Support/Perceptive Automation/Indigo 7.5/Plugins/TP-Link-Device.indigoPlugin/Contents/Server Plugin/tplink_relay_plugin.py", line 35, in validateDeviceConfigUi
KeyError: key childId not found in dict

TP-Link Devices Error Error in plugin execution UiValidate:

Traceback (most recent call last):
File "plugin.py", line 210, in validateDeviceConfigUi
File "/Library/Application Support/Perceptive Automation/Indigo 7.5/Plugins/TP-Link-Device.indigoPlugin/Contents/Server Plugin/tplink_relay_plugin.py", line 35, in validateDeviceConfigUi
KeyError: key childId not found in dict


Feb 21, 2021 at 11:44:19 AM
Reloading plugin "TP-Link Devices 0.9.3"
Stopping plugin "TP-Link Devices 0.9.3" (pid 2495)
Stopped plugin "TP-Link Devices 0.9.3"
Starting plugin "TP-Link Devices 0.9.3" (pid 3546)
TP-Link Devices Log level set to
Started plugin "TP-Link Devices 0.9.3"

Feb 21, 2021 at 11:44:42 AM
TP-Link Devices Error (plugin.py:getTpDevice:462): Discovery connection failed with ('NoneType' object has no attribute 'debug')

Feb 21, 2021 at 11:50:00 AM
TP-Link Devices Changed log level to
Disabling plugin "TP-Link Devices 0.9.3"
Stopping plugin "TP-Link Devices 0.9.3" (pid 3546)
Stopped plugin "TP-Link Devices 0.9.3"
Enabling plugin "TP-Link Devices 0.9.3"
Starting plugin "TP-Link Devices 0.9.3" (pid 3555)
TP-Link Devices Log level set to
Started plugin "TP-Link Devices 0.9.3"

Feb 21, 2021 at 11:50:56 AM
TP-Link Devices Error (plugin.py:getTpDevice:462): Discovery connection failed with ('NoneType' object has no attribute 'debug')

Posted on
Tue Feb 23, 2021 2:40 pm
jtburgess offline
User avatar
Posts: 58
Joined: Jan 17, 2018
Location: NJ

Re: TP-Link Plugin v 0.9.3

I will look into both of these bugs. Stay tuned..

If the older version does everything you need, there’s no urgent reason to upgrade.
The upgrade is all about the new sub-types.
I tried not to break anything, but obviously I missed something.

Posted on
Wed Feb 24, 2021 9:46 pm
mintzps offline
Posts: 30
Joined: Apr 13, 2010

Re: TP-Link Plugin v 0.9.3

Which older version of the plug-in should I use? I am committed to Big Sur and Indigo 7.5.

Posted on
Wed Feb 24, 2021 10:22 pm
jtburgess offline
User avatar
Posts: 58
Joined: Jan 17, 2018
Location: NJ

Re: TP-Link Plugin v 0.9.3

Which older version of the plug-in should I use? I am committed to Big Sur and Indigo 7.5.

My home server is still on High Sierra and 7.4, but that shouldn’t matter.
The previous release was 0.8.1. Revert to that. It’s been out and stable for over a year.

Posted on
Thu Mar 04, 2021 4:56 pm
jtburgess offline
User avatar
Posts: 58
Joined: Jan 17, 2018
Location: NJ

Re: TP-Link Plugin v 0.9.4

With the help of user James Holcomb, I fixed a number of bugs in the RelaySwitch Type, and added a lot more error checking, specifically to make sure the device type chosen by the user when creating a new device is the correct one for that device. [ Thanks, James! ]

When you click device status, it now prints more information in the log. It's easy to add more if that would be useful.

I also worked on the command line tool, and the README now explains the included Actions, among other improvements.

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 2 guests