TP-Link Support

Questions and comments specific to a particular plugin should go here.
george tirebuyer
Posts: 35
Joined: Sun Apr 28, 2013 12:25 pm

Re: TP-Link Support

Post by george tirebuyer » Fri Jun 02, 2017 10:57 am

03:51:08 Plugin: TPLink
03:51:11 TPLink.Bulb.Added.New Light '192.168.1.100'

When I configure Bulb on and off the blank gui displays but the device tab is blank. Test generates the following.

03:51:42 TPLink: Toggle a Bulb On or Off:
03:51:42 BulbToggle: Device not found.

A second attempt at configure bulb generates this error:

03:55:50 Traceback (most recent call last) (0.5.0-rc2):
03:55:50 File "C:\Program Files (x86)\EventGhost\eg\Classes\TaskletDialog.py", line 162, in ProcessingTask
03:55:50 self.Configure(*args, **kwargs)
03:55:50 File "C:\Program Files (x86)\EventGhost\eg\Classes\ConfigDialog.py", line 106, in Configure
03:55:50 treeItem.Configure(*args)
03:55:50 File "C:\Program Files (x86)\EventGhost\eg\Classes\ActionItem.py", line 80, in Configure
03:55:50 return self.executable.Configure(*args)
03:55:50 File "C:\ProgramData\EventGhost\plugins\TPLink\__init__.py", line 737, in Configure
03:55:50 self._check_device
03:55:50 File "C:\ProgramData\EventGhost\plugins\TPLink\__init__.py", line 640, in __init__
03:55:50 SetData()
03:55:50 File "C:\ProgramData\EventGhost\plugins\TPLink\__init__.py", line 518, in SetData
03:55:50 gains = device.emeter_gain
03:55:50 File "C:\ProgramData\EventGhost\plugins\TPLink\tp_link\smartdevice.py", line 769, in emeter_gain
03:55:50 return self._query_helper("emeter", "get_vgain_igain", dict())
03:55:50 File "C:\ProgramData\EventGhost\plugins\TPLink\tp_link\smartdevice.py", line 101, in _query_helper
03:55:50 "Error on {}.{}: {}".format(target, cmd, result)
03:55:50 NotSupportedError: Error on emeter.get_vgain_igain: {u'err_msg': u'Module not support', u'err_code': -2001}

george tirebuyer
Posts: 35
Joined: Sun Apr 28, 2013 12:25 pm

Re: TP-Link Support

Post by george tirebuyer » Fri Jun 02, 2017 11:00 am

Then this happens:

03:56:33 Exception in thread TPLink:
03:56:33 Traceback (most recent call last):
03:56:33 File "threading.pyc", line 801, in __bootstrap_inner
03:56:33 File "C:\ProgramData\EventGhost\plugins\TPLink\__init__.py", line 305, in run
03:56:33 device.update()
03:56:33 File "C:\ProgramData\EventGhost\plugins\TPLink\__init__.py", line 108, in update
03:56:33 brightness = self.brightness
03:56:33 File "C:\ProgramData\EventGhost\plugins\TPLink\tp_link\smartbulb.py", line 189, in brightness
03:56:33 light_state = self.get_light_state()
03:56:33 File "C:\ProgramData\EventGhost\plugins\TPLink\tp_link\smartbulb.py", line 101, in get_light_state
03:56:33 dict()
03:56:33 File "C:\ProgramData\EventGhost\plugins\TPLink\tp_link\smartdevice.py", line 89, in _query_helper
03:56:33 request={target: {cmd: arg}}
03:56:33 File "C:\ProgramData\EventGhost\plugins\TPLink\tp_link\protocol.py", line 51, in query
03:56:33 raise TPLinkException.SocketError("Socket Connection Error:")
03:56:33 SocketError: Socket Connection Error:
03:56:33 Traceback (most recent call last):
03:56:33 File "C:\ProgramData\EventGhost\plugins\TPLink\tp_link\protocol.py", line 49, in query
03:56:33 sock.connect((host, port))
03:56:33 File "socket.pyc", line 228, in meth
03:56:33 timeout: timed out
03:56:33
03:56:33

User avatar
kgschlosser
Site Admin
Posts: 2891
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: TP-Link Support

Post by kgschlosser » Fri Jun 02, 2017 1:41 pm

See the issue is there are 4 different bulb types and they all have a different API which is very annoying. At least I think the API varies by model. It could vary by firmware I do not know as of yet. I just posted some information. About it to the guys that maintain the pyHS100 library to see what they think. I don't want to migrate the code to conform to API changes based on model number then it turns out to be that the API changes based on firmware. But either way I am going to have to create an object for specific device models/firmwares this will allow for much easier maintaining and adding to the code if necessary. Because if they come out with a new model and there isn't a specific container for that model I have have it check for specific bits and pieces to try and match the closest container type. This is going to take me a while to do. But I don't want to keep on bandaiding the code it's going to make a complete mess. Plus I also want to have the device display its own metrics instead of the config dialogs building it for them. This is where there are issues. If the actual container/devices does it the data contained within will always be correct and error free. I am working out a way to test the containers against a specific device if a model is unable to be obtained or there has not been a container made for that model number. I want to make this work for the foreseeable future with little maintance bit also if I fall over dead tomorrow someone will be able to pick up and easily add to the code to make new devices work with it.
If you like the work I have been doing then feel free to Image

george tirebuyer
Posts: 35
Joined: Sun Apr 28, 2013 12:25 pm

Re: TP-Link Support

Post by george tirebuyer » Fri Jun 02, 2017 5:48 pm

Sounds like you got your work cut out for you. Let me know if I can help with the testing. I have simple on off control using the npm command line thing but this project seems to be more elegant.

pearbear
Experienced User
Posts: 150
Joined: Mon Apr 02, 2012 10:28 pm
Contact:

Re: TP-Link Support

Post by pearbear » Sat Jun 10, 2017 7:48 am

I think you accidentally deleted all the plugin attachments because I didn't see a single one in the whole thread. It would be nice if the latest version could always be available in the first post so people don't need to look through the thread for the most recent attachment. Maybe you had it that way before it was lost in the attachment cleanup process.

User avatar
kgschlosser
Site Admin
Posts: 2891
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: TP-Link Support

Post by kgschlosser » Sat Jun 10, 2017 7:57 am

whoooops

LOL

I will get it back up tomorrow
If you like the work I have been doing then feel free to Image

User avatar
kgschlosser
Site Admin
Posts: 2891
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: TP-Link Support

Post by kgschlosser » Sat Jun 10, 2017 7:59 am

this is an incomplete plugin. it's a WIP. until I get a version that is not acting all weird i usually do not want to throw it on the first page. I do get burnt with working on something and take a short recess. This is next in line to work on. as soon as i get a semi decent working mouse for the xbox controllers plugin
If you like the work I have been doing then feel free to Image

User avatar
kgschlosser
Site Admin
Posts: 2891
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: TP-Link Support

Post by kgschlosser » Fri Jun 16, 2017 4:10 am

ok this is how this works with the actions.. if you go into the configure dialog for say turning a light on or off. and the device list is empty then running the action is going to produce an error because there is no device to send the command to.

what i am finding off about the last report ya made is that you said the device list is empty. but when you went into it a second time it produced that error. the thing is it doesn't populate the device information section unless a device is selected. and the fact that you were able to make it through 1/2 of the code to populate the information section leads me to think that the list isn't empty and in fact you have the item selected. now.. that being said. If you didn't give the device a name when you originally set the device up this would produce this kind of an issue. because there would be a device in the list. it simply would not have a name to it there for it would appear the list was blank.

so what I would do is I would go back through the original device setup procedure and give the device a name if there isn't one.
If you like the work I have been doing then feel free to Image

george tirebuyer
Posts: 35
Joined: Sun Apr 28, 2013 12:25 pm

Re: TP-Link Support

Post by george tirebuyer » Fri Jun 16, 2017 5:08 am

04:44:24 TPLink.Bulb.Added.New Light '192.168.1.100' is the name of the bulb and gets found. The drop down list is blank as if the bulb doesn't exit.

User avatar
kgschlosser
Site Admin
Posts: 2891
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: TP-Link Support

Post by kgschlosser » Fri Jun 16, 2017 6:44 am

and you are trying the on and off action?
If you like the work I have been doing then feel free to Image

george tirebuyer
Posts: 35
Joined: Sun Apr 28, 2013 12:25 pm

Re: TP-Link Support

Post by george tirebuyer » Fri Jun 16, 2017 9:13 am

By the way, the plugin is still deleted from the posts. I need to convert back to RC2 to try things but to answer your question Yes I was trying the Bulb On/Off selection.

User avatar
kgschlosser
Site Admin
Posts: 2891
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: TP-Link Support

Post by kgschlosser » Sat Jun 17, 2017 5:59 am

Yeah I know it has been deleted.

I am currently rewriting the whole thing. I am tearing down that pyHS100 package and redoing the thing to be more internally aware of the device. and restructuring the device classes.

as it was everything was lumped into one class. and then extras added to it if it is a bulb or a plug/switch.

so what I have done thus far is I separated device functions into decorator class instances.

Code: Select all

device.schedule
device.time
device.cloud
device.hardware
device.system
device.ap
device.emeter
device.countdown
device.antitheft
device.firmware
what this does is it lends to easier identification of what is going on and who is making what calls. the discovery method has been stripped from the protocol class and the protocol class has been done away with

so an as example if you want to know the tie on the device. say specifically the month

Code: Select all

print device.time.month
and to set the year

Code: Select all

device.time.year = 2017
the schedules will work very similar as well
if you want to know if a specific schedule is supposed to run on monday

Code: Select all

print device.schedule.SomeScheduleName.monday
and to set a schedule to be run on friday

Code: Select all

device.schedule.SomeScheduleName.friday = True
If you like the work I have been doing then feel free to Image

User avatar
kgschlosser
Site Admin
Posts: 2891
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: TP-Link Support

Post by kgschlosser » Mon Jun 19, 2017 4:28 pm

I just wanted to let you all know I am working on this actively I have rewritten the back end and am adding the different device models at this point and creating separate classes for each device model.
If you like the work I have been doing then feel free to Image

george tirebuyer
Posts: 35
Joined: Sun Apr 28, 2013 12:25 pm

Re: TP-Link Support

Post by george tirebuyer » Wed Jul 26, 2017 11:52 am

Any progress on this? I can see how busy you are.

Post Reply