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
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 you go.
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 »

the Time On reports how long the switch/plug has been on for.. I am sorry for that i thought you meant the time the switch/plug has stored.

if it is not showing properly then i need you to take a screen shot for me and post it so i can see what it is doing.
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. so this is now what I am working on...


here is a list of all the extra goodies I am going to attempt to add.

Code: Select all

system:
setting device id*
setting hardware id*
setting location*
setting time zone
setting time
rebooting*
testing uboot*
checking config*
resetting device to factory defaults*

firmware:
setting firmware download url*
getting firmware list
downloading firmware*
installing firmware*

wifi:
scanning access points*
connecting to access point*

cloud:
getting cloud information
setting cloud server url
connecting to cloud server
unregistering device from the cloud

meter:
getting meter voltage gain and current gain
setting meter voltage gain and current gain
meter calibration

schedule:
getting schedule
getting next scheduled action
editing a schedule item
deleting schedule item
delete schedule for a device
    
countdown - action to perform one time after a given period of time:
adding countdown 
editing countdown
deleting countdown
deleting all countdowns

anti-theft - actions to perform when mode is set to away:
get anti-theft list
new anti-theft
edit anti-theft
delete anti-theft
delete all anti-theft

*DONE
If you like the work I have been doing then feel free to Image
bbrech1
Posts: 7
Joined: Tue May 09, 2017 8:33 pm

Re: TP-Link Smart Plug

Post by bbrech1 »

The time appears to reset every time I open the Action Configuration Page or it shows up as a Negative number (see attachment). It does not appear to count the time the device is on.
Attachments
On Time
On Time
Time.JPG (10.55 KiB) Viewed 3923 times
bbrech1
Posts: 7
Joined: Tue May 09, 2017 8:33 pm

Re: TP-Link Smart Plug

Post by bbrech1 »

I tried installing on V0.4.1.r1722 and it gives some errors. Is it only compatible with V0.5?

Compiling C:\ProgramData\EventGhost\plugins\TPLink\__init__.py ...
SyntaxError: ('invalid syntax', ('UserPlugin\\__init__.py', 335, 49, ' check_name = {device.name: device for device in check_device}\n'))

Compiling C:\ProgramData\EventGhost\plugins\TPLink\tp_link\smartdevice.py ...
SyntaxError: ('invalid syntax', ('UserPlugin\\tp_link\\smartdevice.py', 239, 34, ' return {key: info[key] for key in keys}\n'))

Error while loading plugin-file C:\ProgramData\EventGhost\plugins\TPLink.
Traceback (most recent call last) (1722):
File "C:\Program Files (x86)\EventGhost\eg\Classes\PluginModuleInfo.py", line 70, in __init__
__import__(moduleName, None, None, [''])
File "C:\ProgramData\EventGhost\plugins\TPLink\__init__.py", line 335
check_name = {device.name: device for device in check_device}
^
SyntaxError: invalid syntax
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 »

yes at the moment it is. I have been changing things out to make it compatible with both versions but there are a couple of things left.

and the time thing i will have to tinker with it. tho it is not on the top of the TODO list. it's going to require me to really play around with python time objects and datetime objects. and time delta objects... I have never really dove into it that much because i have not had a need to. but in a week or so maybe.
If you like the work I have been doing then feel free to Image
george tirebuyer
Experienced User
Posts: 53
Joined: Sun Apr 28, 2013 12:25 pm

Re: TP-Link Smart Plug

Post by george tirebuyer »

I have an LB100 bulb and get the error when I try to configure it. The plugin 1.8 finds the bulb when installed.

15:38:08 Traceback (most recent call last) (0.5.0-rc2):
15:38:08 File "C:\Program Files (x86)\EventGhost\eg\Classes\TaskletDialog.py", line 162, in ProcessingTask
15:38:08 self.Configure(*args, **kwargs)
15:38:08 File "C:\Program Files (x86)\EventGhost\eg\Classes\ConfigDialog.py", line 106, in Configure
15:38:08 treeItem.Configure(*args)
15:38:08 File "C:\Program Files (x86)\EventGhost\eg\Classes\ActionItem.py", line 80, in Configure
15:38:08 return self.executable.Configure(*args)
15:38:08 File "C:\ProgramData\EventGhost\plugins\TPLink\__init__.py", line 793, in Configure
15:38:08 self._check_device
15:38:08 File "C:\ProgramData\EventGhost\plugins\TPLink\__init__.py", line 698, in __init__
15:38:08 SetData()
15:38:08 File "C:\ProgramData\EventGhost\plugins\TPLink\__init__.py", line 564, in SetData
15:38:08 **device.get_location()
15:38:08 File "C:\ProgramData\EventGhost\plugins\TPLink\__init__.py", line 151, in get_location
15:38:08 return self.device.location
15:38:08 File "C:\ProgramData\EventGhost\plugins\TPLink\tp_link\smartdevice.py", line 250, in location
15:38:08 return dict(latitude=info["latitude"], longitude=info["longitude"])
15:38:08 KeyError: 'latitude'
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... what I have found is that there are some subtle changes in the API between different devices. give me a little bit and I will have that fixed
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 this is a very experimental version. Tho i have not added anything GUI based as of yet for all of the above features i am adding. the back end to set them is in place. I do not know if the plugin is going to function properly. so if you get any errors please do post them here. I have made the changes to accommodate for the API change for the latitude and longitude so hopefully this will fix the issue.
If you like the work I have been doing then feel free to Image
george tirebuyer
Experienced User
Posts: 53
Joined: Sun Apr 28, 2013 12:25 pm

Re: TP-Link Smart Plug

Post by george tirebuyer »

This is the error I get with the newest plugin (1.9) :

16:17:34 Traceback (most recent call last) (0.5.0-rc2):
16:17:34 File "C:\Program Files (x86)\EventGhost\eg\Classes\TaskletDialog.py", line 162, in ProcessingTask
16:17:34 self.Configure(*args, **kwargs)
16:17:34 File "C:\Program Files (x86)\EventGhost\eg\Classes\ConfigDialog.py", line 106, in Configure
16:17:34 treeItem.Configure(*args)
16:17:34 File "C:\Program Files (x86)\EventGhost\eg\Classes\ActionItem.py", line 80, in Configure
16:17:34 return self.executable.Configure(*args)
16:17:34 File "C:\ProgramData\EventGhost\plugins\TPLink\__init__.py", line 855, in Configure
16:17:34 self._check_device
16:17:34 File "C:\ProgramData\EventGhost\plugins\TPLink\__init__.py", line 698, in __init__
16:17:34 SetData()
16:17:34 File "C:\ProgramData\EventGhost\plugins\TPLink\__init__.py", line 568, in SetData
16:17:34 for key, value in device.get_timezone().items():
16:17:34 File "C:\ProgramData\EventGhost\plugins\TPLink\__init__.py", line 196, in get_timezone
16:17:34 return self.device.timezone
16:17:34 File "C:\ProgramData\EventGhost\plugins\TPLink\tp_link\smartdevice.py", line 284, in timezone
16:17:34 return self._query_helper("time", "get_timezone", dict())
16:17:34 File "C:\ProgramData\EventGhost\plugins\TPLink\tp_link\smartdevice.py", line 105, in _query_helper
16:17:34 "Error on {}.{}: {}".format(target, cmd, result)
16:17:34 DeviceException: Error on time.get_timezone: {u'err_msg': u'Module not support', u'err_code': -2001}
16:17:34 None

Also the cli.py doesn't compile in the pyHS100 in site packages in lib27. The plugin finds the bulb and generates an event when I change the state.
george tirebuyer
Experienced User
Posts: 53
Joined: Sun Apr 28, 2013 12:25 pm

Re: TP-Link Smart Plug

Post by george tirebuyer »

This is the error when I execute the Action:
16:24:58 Error in Action: "TPLink: Toggle a Bulb On or Off"
16:24:58 Traceback (most recent call last) (0.5.0-rc2):
16:24:58 File "C:\Program Files (x86)\EventGhost\eg\Classes\ActionBase.py", line 116, in CallWrapper
16:24:58 return self(*args)
16:24:58 TypeError: __call__() takes exactly 2 arguments (1 given).
george tirebuyer
Experienced User
Posts: 53
Joined: Sun Apr 28, 2013 12:25 pm

Re: TP-Link Smart Plug

Post by george tirebuyer »

This is what I get when I run the python script: I don't know if it helps or not.



16:30:48 Python Script
16:30:58 Found device: {u'ip': '192.168.1.100',
16:30:58 u'port': 9999,
16:30:58 u'sys_info': {u'emeter': {u'err_code': -2001,
16:30:58 u'err_msg': u'Module not support'},
16:30:58 u'system': {u'get_sysinfo': {u'active_mode': u'none',
16:30:58 u'alias': u'New Light',
16:30:58 u'ctrl_protocols': {u'name': u'Linkie',
16:30:58 u'version': u'1.0'},
16:30:58 u'description': u'Smart Wi-Fi LED Bulb with Dimmable Light',
16:30:58 u'dev_state': u'normal',
16:30:58 u'deviceId': u'8012996ED1F8DA43EFFD58B62BEC5ADE18192F88',
16:30:58 u'disco_ver': u'1.0',
16:30:58 u'err_code': 0,
16:30:58 u'heapsize': 340808,
16:30:58 u'hwId': u'111E35908497A05512E259BB76801E10',
16:30:58 u'hw_ver': u'1.0',
16:30:58 u'is_color': 0,
16:30:58 u'is_dimmable': 1,
16:30:58 u'is_factory': False,
16:30:58 u'is_variable_color_temp': 0,
16:30:58 u'light_state': {u'dft_on_state': {u'brightness': 50,
16:30:58 u'color_temp': 2700,
16:30:58 u'hue': 0,
16:30:58 u'mode': u'normal',
16:30:58 u'saturation': 0},
16:30:58 u'on_off': 0},
16:30:58 u'mic_mac': u'50C7BF3393F1',
16:30:58 u'mic_type': u'IOT.SMARTBULB',
16:30:58 u'model': u'LB100(US)',
16:30:58 u'oemId': u'264E4E97B2D2B086F289AC1F00B90679',
16:30:58 u'preferred_state': [{u'brightness': 100,
16:30:58 u'color_temp': 2700,
16:30:58 u'hue': 0,
16:30:58 u'index': 0,
16:30:58 u'saturation': 0},
16:30:58 {u'brightness': 75,
16:30:58 u'color_temp': 2700,
16:30:58 u'hue': 0,
16:30:58 u'index': 1,
16:30:58 u'saturation': 0},
16:30:58 {u'brightness': 25,
16:30:58 u'color_temp': 2700,
16:30:58 u'hue': 0,
16:30:58 u'index': 2,
16:30:58 u'saturation': 0},
16:30:58 {u'brightness': 1,
16:30:58 u'color_temp': 2700,
16:30:58 u'hue': 0,
16:30:58 u'index': 3,
16:30:58 u'saturation': 0}],
16:30:58 u'rssi': -54,
16:30:58 u'sw_ver': u'1.2.3 Build 170123 Rel.100146'}}}}
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 »

well the action is not going to work unless you select a device. but since you are having an issue with the selection dialog you are not able to select the device. So i have to fix the dialog. so give me a few to have a look see at what could be causing it


and I am not sure what you mean by this
Also the cli.py doesn't compile in the pyHS100 in site packages in lib27. The plugin finds the bulb and generates an event when I change the state.
for the plugin to function you have no need to put anything into the lib27 folder it is all self contained
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 here goes. give this a shot
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 »

This topic has been moved to the plugins support section

viewtopic.php?f=9&t=9687&p=46213#p46213

@Flyingsubs if you could please add [MOVED] to the beginning of the topic label and also edit the first post and at the top state that this has been moved and paste the url for the new thread into there that would be most helpful

K
If you like the work I have been doing then feel free to Image
Post Reply