Notice: This forum has been recovered from an old backup, so some content, links, and dates may be outdated. The forum is currently read-only while we restore sign-in and registration functionality. Details

If you find this forum valuable and would like to help keep it online, donations to help cover hosting and domain costs are greatly appreciated, but never expected. You can support the forum through Buy Me a Coffee or Ko-fi. Thank you for helping preserve the EventGhost community.

[MOVED] TP-Link Smart Plug

If you have a question or need help, this is the place to be.
Post Reply
Flyingsubs
Experienced User
Posts: 127
Joined: Sat Dec 29, 2012 11:26 pm

Re: TP-Link Smart Plug

Post by Flyingsubs »

18:15:04 Exception in thread TPLink:
18:15:04 Traceback (most recent call last):
18:15:04 File "threading.pyc", line 801, in __bootstrap_inner
18:15:04 File "C:\ProgramData\EventGhost\plugins\TPLink\__init__.py", line 352, in run
18:15:04 port
18:15:04 File "C:\ProgramData\EventGhost\plugins\TPLink\__init__.py", line 59, in __init__
18:15:04 device = self.GetDevice()
18:15:04 File "C:\ProgramData\EventGhost\plugins\TPLink\__init__.py", line 76, in __getattr__
18:15:04 raise AttributeError('%s does not have attribute %s' % (self, item))
18:15:04 AttributeError: eg.UserPluginModule.TPLink.Plug. does not have attribute GetDevice


Not sure if this is important but this is what happens at start up.
18:25:31 Error compiling script.
18:25:31 Traceback (most recent call last):
18:25:31 SyntaxError: invalid syntax (21, line 6)
18:25:31 Traceback (most recent call last) (0.5.0-rc2):
18:25:31 File "wx\_core.pyc", line 16766, in <lambda>
18:25:31 File "C:\Program Files (x86)\EventGhost\eg\Core.py", line 218, in Notify
18:25:31 listener(value)
18:25:31 File "C:\Program Files (x86)\EventGhost\eg\Classes\MainFrame\TreeCtrl.py", line 801, in OnNodeSelected
18:25:31 path = node.GetPath()
18:25:31 File "C:\Program Files (x86)\EventGhost\eg\Classes\TreeItem.py", line 284, in GetPath
18:25:31 path.append(parent.childs.index(item))
18:25:31 ValueError: tuple.index(x): x not in tuple
18:25:31 Error compiling script.
18:25:31 Traceback (most recent call last):
18:25:31 SyntaxError: invalid syntax (23, line 9)

Wow you made a plugin. Thank you so much! This is the error when I load it and i get this other error when i run it. Also is there a way to distinguish by device? Thanks!


18:15:25 Error in Action: "TPLink: Change Bulb State"
18:15:25 Traceback (most recent call last) (0.5.0-rc2):
18:15:25 File "C:\Program Files (x86)\EventGhost\eg\Classes\ActionBase.py", line 116, in CallWrapper
18:15:25 return self(*args)
18:15:25 TypeError: __call__() takes exactly 3 arguments (1 given)
User avatar
kgschlosser
Site Admin
Posts: 5190
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: TP-Link Smart Plug

Post by kgschlosser »

yup i did... This is going to be a little bit of back and forth because I do not have these devices so you are going to have to tell me what the errors are then i can fix them.
If you like the work I have been doing then feel free to Image
User avatar
kgschlosser
Site Admin
Posts: 5190
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: TP-Link Smart Plug

Post by kgschlosser »

ok give this bad larry a try and see if it's working now.
If you like the work I have been doing then feel free to Image
Flyingsubs
Experienced User
Posts: 127
Joined: Sat Dec 29, 2012 11:26 pm

Re: TP-Link Smart Plug

Post by Flyingsubs »

kgschlosser wrote:yup i did... This is going to be a little bit of back and forth because I do not have these devices so you are going to have to tell me what the errors are then i can fix them.

Totally can help on the testing front!


I am getting this error on start up.

10:58:53 Exception in thread TPLink:
10:58:53 Traceback (most recent call last):
10:58:53 File "threading.pyc", line 801, in __bootstrap_inner
10:58:53 File "C:\ProgramData\EventGhost\plugins\TPLink\__init__.py", line 351, in run
10:58:53 port
10:58:53 File "C:\ProgramData\EventGhost\plugins\TPLink\__init__.py", line 59, in __init__
10:58:53 self.name = self.device.alias
10:58:53 File "C:\ProgramData\EventGhost\plugins\TPLink\__init__.py", line 73, in __getattr__
10:58:53 return self.func(self.ip, self.port)
10:58:53 File "C:\ProgramData\EventGhost\plugins\TPLink\pyHS100\pyHS100.py", line 651, in __init__
10:58:53 SmartDevice.__init__(self, ip_address, protocol)
10:58:53 File "C:\ProgramData\EventGhost\plugins\TPLink\pyHS100\pyHS100.py", line 48, in __init__
10:58:53 socket.inet_pton(socket.AF_INET, ip_address)
10:58:53 AttributeError: 'module' object has no attribute 'inet_pton'


This error when i execute the new macro. Thanks!

10:57:21 Error in Action: "TPLink.PlugState(u'', u'On')"
10:57:21 Traceback (most recent call last) (0.5.0-rc2):
10:57:21 File "<string>", line 1, in <module>
10:57:21 NameError: name 'TPLink' is not defined
User avatar
kgschlosser
Site Admin
Posts: 5190
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: TP-Link Smart Plug

Post by kgschlosser »

yeah the macro error is because the plugin had an error


so I removed the call to socket.inet_pton. that function is only available on unix and since EG can only run in windows there is no need to do anything further with it.. so Give this plugin a go and see what you come up with
If you like the work I have been doing then feel free to Image
User avatar
kgschlosser
Site Admin
Posts: 5190
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: TP-Link Smart Plug

Post by kgschlosser »

Flyingsubs wrote: This error when i execute the new macro. Thanks!

10:57:21 Error in Action: "TPLink.PlugState(u'', u'On')"
10:57:21 Traceback (most recent call last) (0.5.0-rc2):
10:57:21 File "<string>", line 1, in <module>
10:57:21 NameError: name 'TPLink' is not defined

Oh BTW when this gets all up and running you are going to have to double click on the action. that will open a dialog where you will be able to select a device.. if the list is empty then you have no devices that support that action. i just wanted to let ya know because TPLink.PlugState(u'', u'On') the first parameter is blank u'' = blank
If you like the work I have been doing then feel free to Image
Flyingsubs
Experienced User
Posts: 127
Joined: Sat Dec 29, 2012 11:26 pm

Re: TP-Link Smart Plug

Post by Flyingsubs »

kgschlosser wrote:
Flyingsubs wrote: This error when i execute the new macro. Thanks!

10:57:21 Error in Action: "TPLink.PlugState(u'', u'On')"
10:57:21 Traceback (most recent call last) (0.5.0-rc2):
10:57:21 File "<string>", line 1, in <module>
10:57:21 NameError: name 'TPLink' is not defined

Oh BTW when this gets all up and running you are going to have to double click on the action. that will open a dialog where you will be able to select a device.. if the list is empty then you have no devices that support that action. i just wanted to let ya know because TPLink.PlugState(u'', u'On') the first parameter is blank u'' = blank



These are the latest errors.

12:03:38 Error compiling script.
12:03:38 Traceback (most recent call last):
12:03:38 SyntaxError: invalid syntax (21, line 6)
12:03:38 Traceback (most recent call last) (0.5.0-rc2):
12:03:38 File "wx\_core.pyc", line 16766, in <lambda>
12:03:38 File "C:\Program Files (x86)\EventGhost\eg\Core.py", line 218, in Notify
12:03:38 listener(value)
12:03:38 File "C:\Program Files (x86)\EventGhost\eg\Classes\MainFrame\TreeCtrl.py", line 801, in OnNodeSelected
12:03:38 path = node.GetPath()
12:03:38 File "C:\Program Files (x86)\EventGhost\eg\Classes\TreeItem.py", line 284, in GetPath
12:03:38 path.append(parent.childs.index(item))
12:03:38 ValueError: tuple.index(x): x not in tuple
12:03:38 Error compiling script.
12:03:38 Traceback (most recent call last):
12:03:38 SyntaxError: invalid syntax (23, line 9)


THis is when i execute the script. Nothing pops up yet. Is that when I select the device?

12:09:00 Error in Action: "TPLink.PlugState(u'', u'On')"
12:09:00 Traceback (most recent call last) (0.5.0-rc2):
12:09:00 File "<string>", line 1, in <module>
12:09:00 NameError: name 'TPLink' is not defined


Also when i delete the plugin and add it again i get this error

12:29:18 Error loading plugin file: C:\ProgramData\EventGhost\plugins\TPLink
12:29:18 Traceback (most recent call last) (0.5.0-rc2):
12:29:18 File "C:\ProgramData\EventGhost\plugins\TPLink\__init__.py", line 56, in <module>
12:29:18 from . import pyHS100 # NOQA
12:29:18 ImportError: cannot import name pyHS100


When I delete the plugin from %programdata% and readd your latest verision.

This error comes up as well

12:31:23 Traceback (most recent call last) (0.5.0-rc2):
12:31:23 File "wx\_core.pyc", line 16766, in <lambda>
12:31:23 File "C:\Program Files (x86)\EventGhost\eg\Classes\PluginInstall.py", line 169, in Import
12:31:23 shutil.rmtree(info.path, False)
12:31:23 File "shutil.pyc", line 239, in rmtree
12:31:23 File "shutil.pyc", line 237, in rmtree
12:31:23 WindowsError: [Error 3] The system cannot find the path specified: u'C:\\ProgramData\\EventGhost\\plugins\\TPLink\\*.*'
Flyingsubs
Experienced User
Posts: 127
Joined: Sat Dec 29, 2012 11:26 pm

Re: TP-Link Smart Plug

Post by Flyingsubs »

So we might need to ignore my last post.

I removed the plugin and started fresh. This is what i get at start up. When i double click on the script in the drop down, I don't see a device.

Thanks!


13:02:56 Exception in thread TPLink:
13:02:56 Traceback (most recent call last):
13:02:56 File "threading.pyc", line 801, in __bootstrap_inner
13:02:56 File "C:\ProgramData\EventGhost\plugins\TPLink\__init__.py", line 362, in run
13:02:56 port
13:02:56 File "C:\ProgramData\EventGhost\plugins\TPLink\__init__.py", line 70, in __init__
13:02:56 self.name = self.device.alias
13:02:56 File "C:\ProgramData\EventGhost\plugins\TPLink\pyHS100\pyHS100.py", line 132, in alias
13:02:56 return self.sys_info['alias']
13:02:56 File "C:\ProgramData\EventGhost\plugins\TPLink\pyHS100\pyHS100.py", line 87, in sys_info
13:02:56 return self.get_sysinfo()
13:02:56 File "C:\ProgramData\EventGhost\plugins\TPLink\pyHS100\pyHS100.py", line 97, in get_sysinfo
13:02:56 return self._query_helper("system", "get_sysinfo")
13:02:56 File "C:\ProgramData\EventGhost\plugins\TPLink\pyHS100\pyHS100.py", line 70, in _query_helper
13:02:56 raise_from(SmartPlugException(), ex)
13:02:56 File "future\utils\__init__.pyc", line 454, in raise_from
13:02:56 SmartPlugException
13:02:56
User avatar
kgschlosser
Site Admin
Posts: 5190
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: TP-Link Smart Plug

Post by kgschlosser »

ok here goes another.

I reworked the whole way it handles exceptions. I am hoping we will see better results from this. and if not it should tell us the reason as to why...

make sure you delete the old folder for the plugin then install this one. I had to reorganize the whole thing and because of one of your errors I am thinking there is an issue somewhere..

it's in your c:\programdata\eventghost\plugins folder.
If you like the work I have been doing then feel free to Image
Flyingsubs
Experienced User
Posts: 127
Joined: Sat Dec 29, 2012 11:26 pm

Re: TP-Link Smart Plug

Post by Flyingsubs »

kgschlosser wrote:ok here goes another.

I reworked the whole way it handles exceptions. I am hoping we will see better results from this. and if not it should tell us the reason as to why...

make sure you delete the old folder for the plugin then install this one. I had to reorganize the whole thing and because of one of your errors I am thinking there is an issue somewhere..

it's in your c:\programdata\eventghost\plugins folder.

OK! Definitely down to keep testing this with you. Here is the new error. I made sure to remove the plugin from program data and eventghost and fresh install it. Also still getting a start up error, not sure if its related.

Startup Error:

15:40:28 Error compiling script.
15:40:28 Traceback (most recent call last):
15:40:28 SyntaxError: invalid syntax (21, line 6)
15:40:28 Traceback (most recent call last) (0.5.0-rc2):
15:40:28 File "wx\_core.pyc", line 16766, in <lambda>
15:40:28 File "C:\Program Files (x86)\EventGhost\eg\Core.py", line 218, in Notify
15:40:28 listener(value)
15:40:28 File "C:\Program Files (x86)\EventGhost\eg\Classes\MainFrame\TreeCtrl.py", line 801, in OnNodeSelected
15:40:28 path = node.GetPath()
15:40:28 File "C:\Program Files (x86)\EventGhost\eg\Classes\TreeItem.py", line 284, in GetPath
15:40:28 path.append(parent.childs.index(item))
15:40:28 ValueError: tuple.index(x): x not in tuple
15:40:28 Error compiling script.
15:40:28 Traceback (most recent call last):
15:40:28 SyntaxError: invalid syntax (23, line 9)

TP link install error

15:41:15 Exception in thread TPLink:
15:41:15 Traceback (most recent call last):
15:41:15 File "threading.pyc", line 801, in __bootstrap_inner
15:41:15 File "C:\ProgramData\EventGhost\plugins\TPLink\__init__.py", line 362, in run
15:41:15 port
15:41:15 File "C:\ProgramData\EventGhost\plugins\TPLink\__init__.py", line 70, in __init__
15:41:15 self.name = self.device.alias
15:41:15 File "C:\ProgramData\EventGhost\plugins\TPLink\tp_link\smartdevice.py", line 126, in alias
15:41:15 return self.sys_info['alias']
15:41:15 File "C:\ProgramData\EventGhost\plugins\TPLink\tp_link\smartdevice.py", line 81, in sys_info
15:41:15 return self.get_sysinfo()
15:41:15 File "C:\ProgramData\EventGhost\plugins\TPLink\tp_link\smartdevice.py", line 91, in get_sysinfo
15:41:15 return self._query_helper("system", "get_sysinfo", dict())
15:41:15 File "C:\ProgramData\EventGhost\plugins\TPLink\tp_link\smartdevice.py", line 57, in _query_helper
15:41:15 response = self.protocol.query(
15:41:15 AttributeError: 'int' object has no attribute 'query'
User avatar
kgschlosser
Site Admin
Posts: 5190
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: TP-Link Smart Plug

Post by kgschlosser »

OK... this should get us off and running. Good thing i cleaned up those exceptions like i did. now I know what was going on.


Hopefully this will bring about some results
If you like the work I have been doing then feel free to Image
Flyingsubs
Experienced User
Posts: 127
Joined: Sat Dec 29, 2012 11:26 pm

Re: TP-Link Smart Plug

Post by Flyingsubs »

kgschlosser wrote:OK... this should get us off and running. Good thing i cleaned up those exceptions like i did. now I know what was going on.


Hopefully this will bring about some results

Excellent!

here is the latest error, its very impressive you can do this without testing it yourself.


21:34:19 Exception in thread TPLink:
21:34:19 Traceback (most recent call last):
21:34:19 File "threading.pyc", line 801, in __bootstrap_inner
21:34:19 File "C:\ProgramData\EventGhost\plugins\TPLink\__init__.py", line 349, in run
21:34:19 self.devices[alias] = device_type(self.plugin, ip)
21:34:19 File "C:\ProgramData\EventGhost\plugins\TPLink\__init__.py", line 69, in __init__
21:34:19 self.name = self.device.alias
21:34:19 File "C:\ProgramData\EventGhost\plugins\TPLink\__init__.py", line 83, in __getattr__
21:34:19 return self.func(self.ip)
21:34:19 File "C:\ProgramData\EventGhost\plugins\TPLink\tp_link\smartplug.py", line 58, in __init__
21:34:19 smartdevice.SmartDevice.__init__(self, ip_address, protocol)
21:34:19 File "C:\ProgramData\EventGhost\plugins\TPLink\tp_link\smartdevice.py", line 38, in __init__
21:34:19 protocol = protocol.TPLinkSmartHomeProtocol()
21:34:19 AttributeError: 'NoneType' object has no attribute 'TPLinkSmartHomeProtocol'
User avatar
kgschlosser
Site Admin
Posts: 5190
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: TP-Link Smart Plug

Post by kgschlosser »

Yeah but you have to endure my lousy typing. because that is what most of this is... just plain ol dumbass mistakes. things I would be able to get rid of before i released anything if I had the means to test it. but this works just the same. But I can really get this done very quick if you allowed me a VPN connection to ya. this way I would be able to see your network. that is the only way because the discover routine does a broadcast and broadcasts are not routable so opening a port on a router wouldn't work.


But at any rate we can also continue like we are it's just going to take a long while to get all the kinks out.

So here is the next one.. another stupid mistake I made.

Oh BTW I added your name to the Author's section of the plugin. It's the least I can do for the work you are doing.
If you like the work I have been doing then feel free to Image
Flyingsubs
Experienced User
Posts: 127
Joined: Sat Dec 29, 2012 11:26 pm

Re: TP-Link Smart Plug

Post by Flyingsubs »

kgschlosser wrote:Yeah but you have to endure my lousy typing. because that is what most of this is... just plain ol dumbass mistakes. things I would be able to get rid of before i released anything if I had the means to test it. but this works just the same. But I can really get this done very quick if you allowed me a VPN connection to ya. this way I would be able to see your network. that is the only way because the discover routine does a broadcast and broadcasts are not routable so opening a port on a router wouldn't work.


But at any rate we can also continue like we are it's just going to take a long while to get all the kinks out.

So here is the next one.. another stupid mistake I made.

Oh BTW I added your name to the Author's section of the plugin. It's the least I can do for the work you are doing.

Yeah definitely back and forth is definitely way harder. Don't be so hard on yourself, this is awesome! Happy to test, wish I could help more with the coding. I really want to learn to get to your level.

We are definitely getting closer! TP Device added and the IP Address is there now. The drop down box is still blank.

YEAH!! i saw that you added me as an author, so honored!! ITs so cool to be part of open source and contribute in anyway I am able. Thank you again so much for taking time out of your day to help me man!


00:03:34 Plugin: TPLink
00:03:37 TPLink.Device.Added.Den Light '10.0.0.202'
00:03:41 Exception in thread TPLink:
00:03:41 Traceback (most recent call last):
00:03:41 File "threading.pyc", line 801, in __bootstrap_inner
00:03:41 File "C:\ProgramData\EventGhost\plugins\TPLink\__init__.py", line 288, in run
00:03:41 device for device in self.devices if
00:03:41 File "C:\ProgramData\EventGhost\plugins\TPLink\__init__.py", line 289, in <genexpr>
00:03:41 (device.ip, device.name) not in current_device
00:03:41 AttributeError: 'unicode' object has no attribute 'ip'
00:03:41
User avatar
kgschlosser
Site Admin
Posts: 5190
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: TP-Link Smart Plug

Post by kgschlosser »

this has only taken me 2-3 hours so it's not a biggie.. I just posted about this plugin and EventGhost in the forums for TPLink. maybe get more people using eventghost.
I am going to be on here for a while. so if you hang out we can get this bugger almost complete very quickly.
If you like the work I have been doing then feel free to Image
Post Reply