jtburgess / indigo-TP-LInk

Indigo Plugin for TP-Link SmartPlugs, powerStrips, dimmer switches, and dimmable bulbs; (coming someday color bulbs)
The Unlicense
2 stars 4 forks source link

Uncaught exception when adding 2 outlet smart plug #6

Closed indigodomo closed 2 years ago

indigodomo commented 3 years ago

When saving a new device, I get the following:

   TP-Link Devices Error           Error in plugin execution ServerReplacedElem:

Traceback (most recent call last):
  File "/Library/Application Support/Perceptive Automation/Indigo 7.5/IndigoPluginHost.app/Contents/Resources/PlugIns/plugin_base.py", line 1179, in deviceUpdated
  File "plugin.py", line 245, in deviceStartComm
KeyError: key devPoll not found in dict

The device does not work. This dual-outlet plugin worked in a prior release though I don't know for sure when it broke.

indigodomo commented 3 years ago

I've tried multiple of the previous releases and none work. Guess I was dreaming that it worked...

indigodomo commented 3 years ago

Turning off the "Enable multi-plug device polling" allows the device to be added, but on and off don't work:

   TP-Link Devices Error           Error in plugin execution ExecuteAction:

Traceback (most recent call last):
  File "plugin.py", line 400, in actionControlDevice
KeyError: (u'192.168.1.22',)

So it looks like some changes totally broke the 2 outlet plug-in module.

indigodomo commented 3 years ago

Looks like you also don't have a default logging level or something because I hit this one too:

   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'
indigodomo commented 3 years ago

Ok, final update: v0.8.1 works after turning off polling and setting a default log level in the plugin config. I'll stick with that version until all the other issues are worked out. Let me know if I can test.

jtburgess commented 3 years ago

My problem is that I don’t have any multi-plug devices to that with! And the person who wrote that code hasn’t responded to my emails. I refactored the code to support multiple device types, and obviously I broke something. I’m sorry you ran into it, but there are many other people using the plug-in ... just not with multi-plug devices, I guess.

I will take a look at the errors you sent me, but I could use more information. When I have a fix, can I ask you to download from GitHub and test it, because I can’t?!

-- John

On Mar 27, 2021, at 6:29 PM, Indigo Domotics @.***> wrote:

 Looks like you also don't have a default logging level or something because I hit this one too:

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'

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe.

jtburgess commented 3 years ago

Here’s what I found: This example is NOT from the latest code (v0.9.5). I fixed this bug already.

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' In the current code, the call to initializeDev() is line 322, not 311, and the debugLog() function is line 193 to 197 and reads as follows: def debugLog(self, stringToPrint): if self.isatty: print stringToPrint elif self.logger is not None: self.logger.debug(stringToPrint) Note the EXPLICIT test for "self.logger is not None"

From your first email:

TP-Link Devices Error Error in plugin execution ExecuteAction:

Traceback (most recent call last): File "plugin.py", line 400, in actionControlDevice KeyError: (u'192.168.1.22',)

That code hasn’t changed! I guess the original author didn’t test a multi-plug with polling off.

I fixed it to test that the Key exists, as it does in other places!

I’m pushing this to gthub as ver 0.9.5.1 Could you please download it and try it out. Thanks.

-- John

On Mar 27, 2021, at 6:29 PM, Indigo Domotics @.***> wrote:

Looks like you also don't have a default logging level or something because I hit this one too:

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'

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/jtburgess/indigo-TP-LInk/issues/6#issuecomment-808811271, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHAHALKWXNF65REKUSDMM33TFZL3JANCNFSM4Z5K7AFQ.

jtburgess commented 2 years ago

Have you had a chance to try any of the more recent commits?

indigodomo commented 2 years ago

I tried a previous version and got spammed with errors. I just upgraded to the latest from the store and it seems to be working.

jtburgess commented 2 years ago

Great, thanks. I'm gonna mark this issue closed.