TP-Link Tapo wifi plug

Others (MiLight, Hue, Toon etc...)

Moderator: leecollings

knireis
Posts: 16
Joined: Wednesday 09 April 2014 14:44
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

TP-Link Tapo wifi plug

Post by knireis »

Does anyone have experience with the new TP-Link Tapo P100 plug? https://www.tp-link.com/nl/home-network ... tapo-p100/
piermusic
Posts: 1
Joined: Sunday 29 November 2020 8:38
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: TP-Link Tapo wifi plug

Post by piermusic »

Bumping this, I am also curious if anyone has gotten the P100 to work with domoticz.
Thanks!
Pier
593304
Posts: 6
Joined: Sunday 04 July 2021 15:54
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: TP-Link Tapo wifi plug

Post by 593304 »

This works with my P100 plug: https://github.com/593304/Domoticz-Tapo

Adam
User avatar
waltervl
Posts: 5712
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: TP-Link Tapo wifi plug

Post by waltervl »

593304 wrote: Sunday 04 July 2021 15:58 This works with my P100 plug: https://github.com/593304/Domoticz-Tapo

Adam
Thanks for creating. I added it to the Plugins Wiki page https://www.domoticz.com/wiki/Plugins
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
newpond
Posts: 26
Joined: Sunday 26 September 2021 2:34
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: TP-Link Tapo wifi plug

Post by newpond »

Hi, If I have multiple plugs do I need to add a new hardware device for each one?

I have been able to test yet as waiting for them to be delivered !

Usually when I add a plugin for something, the devices get added in the same plugin entry (as opposed to creating a new hardware entry for each one).

eg I have a wifi bulb plugin in the hardware section and when I want to add a new bulb, it has a button for adding a new device.

thanks in advance
User avatar
waltervl
Posts: 5712
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: TP-Link Tapo wifi plug

Post by waltervl »

It looks like you have to create a new hardware for each plug as you have to fill in the IP adress of the plug.
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
newpond
Posts: 26
Joined: Sunday 26 September 2021 2:34
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: TP-Link Tapo wifi plug

Post by newpond »

I've been trying for hours to get this working but with no joy.

I am getting the following errors.
2021-09-27 20:51:54.402 Error: tapo1: (tapo1) 'onHeartbeat' failed 'TypeError'.
2021-09-27 20:51:54.402 Error: tapo1: (tapo1) ----> Line 202 in '/home/pi/domoticz/plugins/Domoticz-Tapo/plugin.py', function onHeartbeat
2021-09-27 20:51:54.402 Error: tapo1: (tapo1) ----> Line 142 in '/home/pi/domoticz/plugins/Domoticz-Tapo/plugin.py', function onHeartbeat
2021-09-27 20:51:54.402 Error: tapo1: (tapo1) ----> Line 44 in '/home/pi/domoticz/plugins/Domoticz-Tapo/plugin.py', function beatHeartbeat
2021-09-27 20:51:54.402 Error: tapo1: (tapo1) ----> Line 148 in '/home/pi/domoticz/plugins/Domoticz-Tapo/plugin.py', function update


any ideas?

cheers jon
593304
Posts: 6
Joined: Sunday 04 July 2021 15:54
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: TP-Link Tapo wifi plug

Post by 593304 »

I've tried to reproduce the error, but I've only got a connection error.
I've added a debug message for the heartbeat function. Could you run the

Code: Select all

git pull
command in your Tapo plugin folder on your Domoticz server and restart your Domoticz server?
Please turn on the Debug messages on the hardware page for tapo1, then post the debug log message here. My best guess is that the response is not in JSON format.

Did you preconfigured your plug in the Tapo mobile app?

For the multiple device and one hardware question, I think I can modify the plugin to handle a list of IP addresses and create multiple devices from them. But first get rid of your error.
The python plugin for the Tapo devices is directly connecting to a device and not via your Tapo profile. That's why I've only handled one IP address/hardware.

Adam
newpond
Posts: 26
Joined: Sunday 26 September 2021 2:34
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: TP-Link Tapo wifi plug

Post by newpond »

Hi Adam,
thanks for your quick response and the changes you made already.

I have re-installed the new plugin and the error now says the following

2021-09-28 13:23:36.361 Error: Tapo2: (Tapo2) 'onHeartbeat' failed 'TypeError':'can only concatenate str (not "dict") to str'.


kind regards
Jon
593304
Posts: 6
Joined: Sunday 04 July 2021 15:54
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: TP-Link Tapo wifi plug

Post by 593304 »

Hi Jon,

I've update the code to handle the dict response from the PyP100 python module. Sorry I did not check that they updated their device info response type.
I've tested on my RPI with the old and the new version of the PyP100 module and both of them are working now.
Please try again after git pull and Domoticz restart.

Thanks,
Adam
newpond
Posts: 26
Joined: Sunday 26 September 2021 2:34
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: TP-Link Tapo wifi plug

Post by newpond »

Adam!

You my friend, are an absolute legend!!!!!

Works perfectly now. Thank you so much for sorting that out so quickly, I am pretty new to python so have been pulling my hair out for hours over this.

Out of interest, once it is added as a device, does it ever need to contact the Tapo servers again or does Domoticz talk directly to it after that.

(I am wanting to put together a system that is not cloud dependent, should there be a loss of internet connection.)

If you are able to code it so you can add multiple IPs to one hardware item that would be awesome. (but totally happy that it works now either way!).

thanks again
Jon
593304
Posts: 6
Joined: Sunday 04 July 2021 15:54
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: TP-Link Tapo wifi plug

Post by 593304 »

Hi Jon,

Thank you and you're welcome :)

It will work offline without the cloud, because the PyP100 module communicates directly with the device.

If I have a little spare time, then I will update the module with the multiple IP option. I think it will take a few days.

Regards,
Adam
newpond
Posts: 26
Joined: Sunday 26 September 2021 2:34
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: TP-Link Tapo wifi plug

Post by newpond »

Hi Adam, Yep I just tested it by pulling out my phone line and it all kept going. I wasn't sure though whether Tapo ever did any checkins or changes that might require a connection (expired keys etc sort of things). Time will tell I guess.

I have updated to the latest Tapo P100 firmware which is 1.4.9 build 20210621 rel 30941 on hardware 1.20.0. and can confirm it works great.

I have just ordered a couple of Tapo L530B colour changing light bulbs which turn up tomorrow. You reckon they might work? :-)

Thanks again for your help. Made my day

Cheers
Jon
593304
Posts: 6
Joined: Sunday 04 July 2021 15:54
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: TP-Link Tapo wifi plug

Post by 593304 »

Hi Jon,

Great news! Unfortunately I'm not have a bulb, so I cannot test that part. At this time only an on/off switch will be created for the bulb. It's easier to update my module to handle bulbs correctly, then adding the multiple IP feature, but I'm also need a little time for that.

Other thing from the PyP100 Github page:
Tapo P100 is a Python library for controlling the Tp-link Tapo P100 plugs, P105 plugs and L510E bulbs.
. But let's hope for the best and assume that the module will work with the newer bulb version. I will post a message when the module is updated with the color switch option.

Regards,
Adam
newpond
Posts: 26
Joined: Sunday 26 September 2021 2:34
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: TP-Link Tapo wifi plug

Post by newpond »

sounds good.

if there is anything I can do to help you test anything let me know.

cheers
Jon
newpond
Posts: 26
Joined: Sunday 26 September 2021 2:34
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: TP-Link Tapo wifi plug

Post by newpond »

Hi Adam,

I can confirm the bulbs work with the on/off function like your said. So a good start!!

Cheers

Jon
newpond
Posts: 26
Joined: Sunday 26 September 2021 2:34
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: TP-Link Tapo wifi plug

Post by newpond »

HI Adam,
I seem to have found a bug with the plugin. (or the PyP100)

With the plugs enabled in hardware, the pi cpu starts going up (more as you enable each device).

It goes up by about 4-5% for each device that is added.

Then sometimes when you enable debug, or disable/enable one fo the devices it shuts down the Domoticz service which you can't then restart again without rebooting the whole device.

With 4 devices added (2 plugs and 2 bulbs) my cpu runs at about 18% (where as it usually runs at about 2%) and it makes the whole system unstable. Switches randomly stop working and events don't run correctly.

I have had to disable the plugin now to allow it to run the other devices.

Any ideas?

EDIT
I believe it "might" be related to sending too many requests to the Tapo service which appears to be rate limited. If these requests are queued rather than ignored this might explain why domoticz eventually dies.

The reason I came to this conclusion is because a tried adding the Tapo plugin to my Homebridge application (running on the same box) and whilst it didn't add any additional cpu overhead, if I try to turn on multiple devices, quickly, one after the other I get the following error why implies that too many requests have been sent in a short amount of time (hence why I believe the tape service is rate limited).

[10/5/2021, 19:52:45] [Tapo Smart Platform] 371 Error: Request failed with status code 429

The Homebridge however doesn't as I say increase cpu usage or crash so I am guessing maybe it deletes the failed requests and send new ones rather than queuing them all and trying to resend them. (if that's what it happens to be doing of course).

Just my initial thoughts anyway.
Let me know what you think

CHeers
Jon
newpond
Posts: 26
Joined: Sunday 26 September 2021 2:34
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: TP-Link Tapo wifi plug

Post by newpond »

On further investigation this looks to be the issue

# Simple heartbeat with a 10 secs interval
class Heartbeat():
def __init__(self):
self.callback = None
self.interval = 1

Note mentions 10 secs interval but is actually set to 1

Change to
self.interval = 25

This seems to work quite well and lower cpu than setting to 10. I don't recommend setting any higher than 25 as I believe domoticz will consider the device down if it doesn't hear from it within 30 seconds as documented here

https://www.domoticz.com/wiki/Developin ... #Callbacks

And this forum entry states the following
viewtopic.php?t=20408


****
Warning: Setting this interval to greater than 30 seconds will cause a 'thread seems to have ended unexpectedly' message to be written to the log file every 30 seconds. The plugin will function correctly but this message can not be suppressed because it is a standard warning from Domoticz that a piece of hardware may have stopped responding.
If a plugin wants to heartbeat every 100 seconds it should be coded with the heartbeat interval set to 10, 20 or 25 seconds and only take action every 6th, 5th or 4th time the callback is invoked.
****

rgds
Jon
nezber
Posts: 4
Joined: Wednesday 09 August 2017 22:42
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: TP-Link Tapo wifi plug

Post by nezber »

Hi All

Hopefully someone can help my probable dumb question, I have installed the plugin as per the instructions and get the following error after adding the hardware and nothing shows up in the devices

2021-10-28 11:57:06.843 Error: (TapoPlugin) failed to load 'plugin.py', Python Path used was '/home/pi/domoticz/plugins/Domoticz-Tapo/:/usr/lib/python35.zip:/usr/lib/python3.5:/usr/lib/python3.5/plat-arm-linux-gnueabihf:/usr/lib/python3.5/lib-dynload:/usr/local/lib/python3.5/dist-packages:/usr/lib/python3/dist-packages:/usr/lib/python3.5/dist-packages'.
2021-10-28 11:57:06.843 Error: (Utility Room Switch) Module Import failed, exception: 'ImportError'
2021-10-28 11:57:06.843 Error: (Utility Room Switch) Module Import failed: ' Name: PyP100'
2021-10-28 11:57:06.843 Error: (Utility Room Switch) Error Line details not available.

Thanks in advance

Rich
User avatar
waltervl
Posts: 5712
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: TP-Link Tapo wifi plug

Post by waltervl »

Try

Code: Select all

sudo pip3 install PyP100
This is a known issue for python plugins :-)
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest