TP-Link smart plug HS100/HS110
Moderator: leecollings
-
- Posts: 30
- Joined: Thursday 01 September 2016 12:18
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Location: The Netherlands
- Contact:
Re: TP-Link smart plug HS100/HS110
-rwxrwxrwx 1 pi pi 3159 Oct 6 17:33 tplink_smartplug.py
but with filezilla I can change it anyway I want but it does not help a bit.
Also made an Sh script on and off that calls the python script on but also, no joy.
but with filezilla I can change it anyway I want but it does not help a bit.
Also made an Sh script on and off that calls the python script on but also, no joy.
-Domoticz-RFLink-PVoutput-Solarmeter-SBFSpot-ESPEasy-Volumio with spotify connect-
-
- Posts: 350
- Joined: Sunday 19 April 2015 0:36
- Target OS: Raspberry Pi / ODroid
- Domoticz version: V2022.2
- Location: UK
- Contact:
Re: TP-Link smart plug HS100/HS110
Clutching at straws here: have you successfully run other Domoticz commands from switches? have you got security enabled?
-
- Posts: 30
- Joined: Thursday 01 September 2016 12:18
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Location: The Netherlands
- Contact:
Re: TP-Link smart plug HS100/HS110
Dunno, will try another scriot but then still.... what is caausing the 'not running' ?
Switch is not secured.
Got Domoticz running on a PI2 now instead of a 3 but no difference.
So, maybe, a little setup a dummy switch for dummies anyone ? Might be something wrong there......
Switch is not secured.
Got Domoticz running on a PI2 now instead of a 3 but no difference.
So, maybe, a little setup a dummy switch for dummies anyone ? Might be something wrong there......
-Domoticz-RFLink-PVoutput-Solarmeter-SBFSpot-ESPEasy-Volumio with spotify connect-
-
- Posts: 10
- Joined: Tuesday 04 October 2016 20:45
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: TP-Link smart plug HS100/HS110
Thanks @MikeF!!!!!
-
- Posts: 30
- Joined: Thursday 01 September 2016 12:18
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Location: The Netherlands
- Contact:
Re: TP-Link smart plug HS100/HS110
Turned out... I had an error in the python script I think. Copied all the lines in to a file and saved that with notepad++ to the python file, which apparently is no good. Now, downloaded the python file, wacked it on the pi and .... working !!!
Thanks for the patience MikeF !!
Thanks for the patience MikeF !!
-Domoticz-RFLink-PVoutput-Solarmeter-SBFSpot-ESPEasy-Volumio with spotify connect-
Re: TP-Link smart plug HS100/HS110
Hi guys
I'm trying to get the python script running (on Windows), but no luck so far...
When using python 3, I get the error message:
"could not connect to host <ip> 9999 "
I also tried using python 2.7, which gives me the error message:
"AttributeError: 'module' objest has no attribute 'inet_pton'"
I'm not a Python expert, could anyone point me in the right direction?
I'm trying to get the python script running (on Windows), but no luck so far...
When using python 3, I get the error message:
"could not connect to host <ip> 9999 "
I also tried using python 2.7, which gives me the error message:
"AttributeError: 'module' objest has no attribute 'inet_pton'"
I'm not a Python expert, could anyone point me in the right direction?
-
- Posts: 30
- Joined: Thursday 01 September 2016 12:18
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Location: The Netherlands
- Contact:
Re: TP-Link smart plug HS100/HS110
Can't help you with scripting but.. the HS100's just stopped working through domoticz, get an error each time I want to switch them. Strange thing is, I can still switch from the command line...doaerts wrote:Hi guys
I'm trying to get the python script running (on Windows), but no luck so far...
When using python 3, I get the error message:
"could not connect to host <ip> 9999 "
I also tried using python 2.7, which gives me the error message:
"AttributeError: 'module' objest has no attribute 'inet_pton'"
I'm not a Python expert, could anyone point me in the right direction?
Changed nothing, updated nothing, just happened..
-Domoticz-RFLink-PVoutput-Solarmeter-SBFSpot-ESPEasy-Volumio with spotify connect-
-
- Posts: 7
- Joined: Wednesday 21 December 2016 10:18
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: TP-Link smart plug HS100/HS110
I've followed the instructions here and am having trouble getting it working with my HS100 plugs.
If I run this from the command line I get:
File "tplink-smartplug.py", line 22
import socket
^
IndentationError: unexpected indent
(I just coped the code from here and pasted it into a file called 'tplink-smartplug.py'.
If I press the switches in Domoticz's web page it shows this n the logs:
2016-12-22 14:04:31.566 Executing script: /home/pi/domoticz/scripts/tplink-smartplug.py
2016-12-22 14:04:31.658 Error: Error executing script command (/home/pi/domoticz/scripts/tplink-smartplug.py). returned: 256
Is this a problem with the script, or could I be doing something wrong?
Maybe one of you who have it working could add a link to download your version of the script and I could try that?
Edit:
I've gone through the steps again from the start and managed to get this working OK
If I run this from the command line I get:
File "tplink-smartplug.py", line 22
import socket
^
IndentationError: unexpected indent
(I just coped the code from here and pasted it into a file called 'tplink-smartplug.py'.
If I press the switches in Domoticz's web page it shows this n the logs:
2016-12-22 14:04:31.566 Executing script: /home/pi/domoticz/scripts/tplink-smartplug.py
2016-12-22 14:04:31.658 Error: Error executing script command (/home/pi/domoticz/scripts/tplink-smartplug.py). returned: 256
Is this a problem with the script, or could I be doing something wrong?
Maybe one of you who have it working could add a link to download your version of the script and I could try that?
Edit:
I've gone through the steps again from the start and managed to get this working OK
-
- Posts: 13
- Joined: Tuesday 17 January 2017 13:04
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 3.5877
- Location: Portugal
- Contact:
Re: TP-Link smart plug HS110 - send energy data to Domoticz
@MikeFMikeF wrote:I have now created a python script to send energy data from the TP-Link HS110 Smart Plug to Domoticz:
Create a virtual sensor with sensor type 'Electric (Instant+Counter)', and insert its IDx and the IP addresses of your HS110 and Domoticz server in the script. Then set up a crontab entry to run the script every 5 or 10 minutes, as you prefer.
- Spoiler: show
It will appear in the Utilities page - here's an example:
Tks a lot for this.
Getting though as 401 error even when run from the command line.
Script copied/ edited via nano and chmoded a+x.
Believe it is something regarding authorization but can not find solution.
Any hint from You?
-
- Posts: 13
- Joined: Tuesday 17 January 2017 13:04
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 3.5877
- Location: Portugal
- Contact:
Re: TP-Link smart plug HS100/HS110
@reddoreddo wrote:Can't help you with scripting but.. the HS100's just stopped working through domoticz, get an error each time I want to switch them. Strange thing is, I can still switch from the command line...doaerts wrote:Hi guys
I'm trying to get the python script running (on Windows), but no luck so far...
When using python 3, I get the error message:
"could not connect to host <ip> 9999 "
I also tried using python 2.7, which gives me the error message:
"AttributeError: 'module' objest has no attribute 'inet_pton'"
I'm not a Python expert, could anyone point me in the right direction?
Changed nothing, updated nothing, just happened..
See if this can help You.
Have lost a few hours trying to make this work.
Like You command line was ok but nothing else.
And finaly have found(I think) that editing the scripts in windows even with notepad+ and uploading them via FileZilla did not work.
Using the pi inbuilt nano editor and chomd via commmand line did the trick.
Enjoy
-
- Posts: 350
- Joined: Sunday 19 April 2015 0:36
- Target OS: Raspberry Pi / ODroid
- Domoticz version: V2022.2
- Location: UK
- Contact:
Re: TP-Link smart plug HS110 - send energy data to Domoticz
I've never used authorisation on Domoticz, so don't know, I'm afraid - try without?rebelo wrote: Getting though as 401 error even when run from the command line.
Script copied/ edited via nano and chmoded a+x.
Believe it is something regarding authorization but can not find solution.
Any hint from You?
-
- Posts: 13
- Joined: Tuesday 17 January 2017 13:04
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 3.5877
- Location: Portugal
- Contact:
Re: TP-Link smart plug HS110 - send energy data to Domoticz
Tks but what i ment by authorization was abt the error, 401, i get in the command line.MikeF wrote:I've never used authorisation on Domoticz, so don't know, I'm afraid - try without?rebelo wrote: Getting though as 401 error even when run from the command line.
Script copied/ edited via nano and chmoded a+x.
Believe it is something regarding authorization but can not find solution.
Any hint from You?
Never mind will try again.
-
- Posts: 3
- Joined: Wednesday 15 February 2017 9:19
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: TP-Link smart plug HS100/HS110
Hello,
First time reply on this forum but follower since months.
I have setup a new Domoticz server on a raspberry pi and it works like i charm.
I still need to read all tutorials and manuals to get it under control.
I have a smartplug HS100 and not HS110.
Meaning that i don't have the energy meter in it.
I am getting these errors when i launch the script:
I tried to remove the energy meter script lines from the given python script without success.
Can someone help me out and provide me a script that just turns on and off the HS100 without any error?
Thank you
First time reply on this forum but follower since months.
I have setup a new Domoticz server on a raspberry pi and it works like i charm.
I still need to read all tutorials and manuals to get it under control.
I have a smartplug HS100 and not HS110.
Meaning that i don't have the energy meter in it.
I am getting these errors when i launch the script:
~/Desktop $ python tplink-smartplug.py -c on
Traceback (most recent call last):
File "tplink-smartplug.py", line 63, in <module>
power = jsonData['emeter']['get_realtime']['power']
KeyError: 'get_realtime'
I tried to remove the energy meter script lines from the given python script without success.
Can someone help me out and provide me a script that just turns on and off the HS100 without any error?
Thank you
-
- Posts: 13
- Joined: Tuesday 17 January 2017 13:04
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 3.5877
- Location: Portugal
- Contact:
Re: TP-Link smart plug HS100/HS110
@ hitech2207
You have the links in this post
https://raw.githubusercontent.com/softS ... artplug.py
and
https://github.com/softScheck/tplink-smartplug
Check them out.
Rebelo
You have the links in this post
https://raw.githubusercontent.com/softS ... artplug.py
and
https://github.com/softScheck/tplink-smartplug
Check them out.
Rebelo
-
- Posts: 3
- Joined: Wednesday 15 February 2017 9:19
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: TP-Link smart plug HS100/HS110
Hi Rebelo,
I was able to successfully launch this script and my light on from my raspberry terminal.
Now i need to find out how i can implement this in domoticz correctly.
I used this on cmd but nothing happens..
for ON:
script:///home/pi/Desktop/tplink-smartplug.py -t 192.168.1.22 -c on
for OFF:
script:///home/pi/Desktop/tplink-smartplug.py -t 192.168.1.22 -c off
This doesn't work.
When i use in terminal:
python /home/pi/Desktop/tplink-smartplug.py -t 192.168.1.22 -c on
it works..
What is wrong?
Thank you
I was able to successfully launch this script and my light on from my raspberry terminal.
Now i need to find out how i can implement this in domoticz correctly.
I used this on cmd but nothing happens..
for ON:
script:///home/pi/Desktop/tplink-smartplug.py -t 192.168.1.22 -c on
for OFF:
script:///home/pi/Desktop/tplink-smartplug.py -t 192.168.1.22 -c off
This doesn't work.
When i use in terminal:
python /home/pi/Desktop/tplink-smartplug.py -t 192.168.1.22 -c on
it works..
What is wrong?
Thank you
-
- Posts: 13
- Joined: Tuesday 17 January 2017 13:04
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 3.5877
- Location: Portugal
- Contact:
Re: TP-Link smart plug HS100/HS110
Well, path looks ok.
And assuming that You are putting the cmd lines on the virtual switch that You have created.
If so check the script permissions and try to chmod it a+x.
Are you editing the scripts in windows even with notepad+ and uploading/ changing permissions via FileZilla?
I believe that was my mistake at that time.
Using the pi inbuilt nano editor and chomd via commmand line did the trick.
Let me know.
And assuming that You are putting the cmd lines on the virtual switch that You have created.
If so check the script permissions and try to chmod it a+x.
Are you editing the scripts in windows even with notepad+ and uploading/ changing permissions via FileZilla?
I believe that was my mistake at that time.
Using the pi inbuilt nano editor and chomd via commmand line did the trick.
Let me know.
-
- Posts: 3
- Joined: Wednesday 15 February 2017 9:19
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: TP-Link smart plug HS100/HS110
Hi Rebelo,
sudo chmod a+x did the trick
Concerning the scripts i always use the terminal on my mac to ssh into the raspberry pi and sudo nano the scripts.
Thanks again
sudo chmod a+x did the trick
Concerning the scripts i always use the terminal on my mac to ssh into the raspberry pi and sudo nano the scripts.
Thanks again
-
- Posts: 13
- Joined: Tuesday 17 January 2017 13:04
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 3.5877
- Location: Portugal
- Contact:
Re: TP-Link smart plug HS100/HS110
Good job , enjoy it.
- marcotini
- Posts: 28
- Joined: Thursday 16 February 2017 17:51
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Beta
- Contact:
Re: TP-Link smart plug HS110 - send energy data to Domoticz
Can you explain how to do that? Because when I create the virtual sensor and put the script in /script/ I don't know what else to do.MikeF wrote:I have now created a python script to send energy data from the TP-Link HS110 Smart Plug to Domoticz:
Create a virtual sensor with sensor type 'Electric (Instant+Counter)', and insert its IDx and the IP addresses of your HS110 and Domoticz server in the script. Then set up a crontab entry to run the script every 5 or 10 minutes, as you prefer.
- Spoiler: show
It will appear in the Utilities page - here's an example:
Re: TP-Link smart plug HS100/HS110
Did you ever found the solution?
I have exactly the same problem. Strange thing is: I created a Domoticz environment on a Windows computer. The script did id not work with python 2.7.4 but works fine with python 3.4 (I have modified the script for python3). However, if I run python3 on the raspberry with the same script it is still not working...
I have exactly the same problem. Strange thing is: I created a Domoticz environment on a Windows computer. The script did id not work with python 2.7.4 but works fine with python 3.4 (I have modified the script for python3). However, if I run python3 on the raspberry with the same script it is still not working...
Who is online
Users browsing this forum: No registered users and 1 guest