[Custom Component] Tapo P100 Plug Control

This might be a newbie HA question but why are my Tapo devices showing up as entities rather than devices? Is there any way I can achieve that?

In case it’s useful in diagnosing the ‘invalid credentials’ problem, I moved from a Docker HA Core environment to a Virtual Machine HA Supervised environment (with a different IP) and the Tapo devices worked first time.

So I have one P100 v1.0 and P100 v1.2 … I am right now looking for the external API from Tapo and they are completed different requests. It’s super strange that with a new product they are already creating a completely new way of doing the requests

This is how you make requests with 1.2:

{
   "method":"passthrough",
   "params":{
      "deviceId":"8022827EE8EEE2D2ABE0580FC80C105CAAAAAAAA",
      "requestData":{
         "method":"multipleRequest",
         "params":{
            "requests":[
               {
                  "method":"get_device_running_info",
                  "terminalUUID":"98-3B-16-96-48-AA",
                  "requestTimeMils":1606006249234
               }
            ]
         },
         "requestTimeMils":0
      }
   }
}

And the response is:

{
    "error_code": 0,
    "result": {
        "responseData": {
            "result": {
                "responses": [
                    {
                        "result": {
                            "rssi": -44,
                            "time_usage_today": 7,
                            "latitude": 311112,
                            "ip": "192.168.1.9",
                            "device_on": true,
                            "avatar": "house",
                            "time_usage_past30": 12608,
                            "has_set_location_info": true,
                            "time_usage_past7": 8646,
                            "signal_level": 3,
                            "on_time": 453,
                            "overheated": false,
                            "nickname": "UGx1ZyAy",
                            "location": "bedroom",
                            "fw_ver": "1.2.1 Build 20200616 Rel. 31218",
                            "longitude": -91116
                        },
                        "method": "get_device_running_info",
                        "error_code": 0
                    }
                ]
            },
            "error_code": 0
        }
    }
}

Oh. Facepalm emoji. How annoying. But that’s great that you’re looking!

The multipleRequest method is used by the Tapo cameras as well, but they do use another simple way as well. Try this new method on the old plug and the old method on the new plug. You will might see that they both work.

The integration works great for a few days. After it I start to get, without being able to control the switches m

  • Updating tapo_p100_control switch took longer than the scheduled update interval 0:00:30

A fix is to reinstall HA. Any ideas?

Successfully installed and running on my Home Assistant server that runs on my Synology control for two plugs.
Initial attempt failed with the PyP100 error, simply copying tapo_p100_control folder into the custom_components folder and restarting the server before adding the lines to configuration.yaml solved it.
Now how do I create an automation? The Tapo plugs do not show up as devices when trying to create an action.

I’m doomed. I bought a P105 assuming that it will work since I saw a TP-Link documentation a long time ago. Now P100 is still a work in progress. I tried it and failed. It says that the credentials are wrong.

How do you sniff the data sent by the plugs?

Still getting the

Error Code: -1501, Invalid Request or Credentials

But I was able to login via the cloud api using postman and see all my devices registered via the cloud.
The thing that hinders me and got me stumped is in the login() function.
I reviewed the code and saw that this part depends on the encryption that was used by the app. I am not sure if the current PyP100 is aligned with the current Tapo App or I’m doing something wrong.

But I think it’s safe to assume that the encryption step of the app does not need to know the type of the device nor the model. I want to reverse engineer the app but I’m still hoping someone here still has the answer.

My Tapo app is currently 2.2.36

I have Home Assistant on Pi Zero, when installing the Tapo integration I get the error Platform error switch.tapo_p100_control - No module named ‘PyP100’, I see that running pip3 install PyP100 would fix this but as this is a pre install image I cant install python. Could anone advise on this.

Thanks in advance Richard.

I had this issue. Initial attempt failed with the PyP100 error. Deleted the installation and the deleted the lines from my yams file, restart. Then began again, simply copying tapo_p100_control folder into the custom_components folder and restarting the server before adding the lines to configuration.yaml solved it.

1 Like

I will give this a try. Thanks. Will post my result. :slight_smile:

Thank you! I had the same problem as @Richard_Erbe, running hassio on Rpi3B and that fixed it. Looks like order matters. For error no module found - PyP100, I copies files from repo Github PyP100, to the same folder as custom component: image

EDIT: @fishbigger thank you for all of your amazing work!

I’m just gonna close out my issue here. I managed to make my Tapo P105 Plug just by using an 8 character password with 1 number.

ex.
tplinkz1

Edit:
Just tested this component on Tapo L510E Bulb, and it works as a light entity as well.

switch:
  - platform: tapo_p100_control
    ip_address: 192.168.1.20
    email: [email protected]
    password: tplinkz1
light:
  - platform: switch
    name: Dirty Kitchen Bulb
    entity_id: switch.dkbulb

Note that dkbulb is the actual name of the bulb from the Tapo app.

Conclusion:
This component supports Tapo P105 and Tapo L510E

Latest Version now on pypi install using

pip3 install pyP100==0.0.10

It now has a setBrightness function created by Sonic74 on github which I will now work on implementing into ha

1 Like

The documentation for creating lights in ha is less obvious than creating switches so I’m going to tackle adding the lights at a later date :slight_smile:

1 Like

Happy Holidays!

I’ve been monitoring the component for some time now and I saw some behaviours that are quite problematic:

  1. Tapo devices gets disconnected from time to time HA
  • This resulted my aircon to run for hours lol
  1. Not too problematic - the response time of the switch is 1 to 2 seconds late
  2. This Log:
Logger: homeassistant.components.switch
Source: helpers/entity_platform.py:603
Integration: Switch (documentation, issues)
First occurred: 2:50:21 AM (114 occurrences)
Last logged: 3:46:52 AM

Updating tapo_p100_control switch took longer than the scheduled update interval 0:00:30

Unsure what is happening. I might try to debug if I have free time but the holiday season is in.

1 Like

Just wondering if there is any particular setup that need to be set up to run with the Tapo bulbs, just trying the 0.0.11 version though python on my computer just to have them turn on/off/brightness, but still getting the -1501 error when trying to set up. Running the L510B bulbs with 1.1.8 firmware, i saw there was some suggestion that i need to talk to TPlink to downgrade the firmware potentially to enable the connections?

Dude, you probably shouldn’t be posting your full login details including password on the internet…

thank you, didnt think, long day

Don’t forget to change the password for security :wink: