TP-Link Tapo P100

Thank you! My own fault for not reading the entire thread, I changed my password to 8 char, all lowercase with 1 number and it worked fine after that.

Hi, unfortunately, get_device_info method does not return any power usage for P110.
Maybe there are other methods to be called to get power consumption info.

{
    "result": {
        "device_id": "80226B0331A683416CC5DCDC3DE576XXXXXXXXXX",
        "fw_ver": "1.0.7 Build 210629 Rel.174901",
        "hw_ver": "1.0",
        "type": "SMART.TAPOPLUG",
        "model": "P110",
        "mac": "10-27-F5-XX-XX-XX",
        "hw_id": "2FB30EF5BF920C44099401XXXXXXXXXX",
        "fw_id": "00000000000000000000000000000000",
        "oem_id": "18BDC6C734AF8407B3EF87XXXXXXXXXX",
        "overheated": false,
        "ip": "192.168.1.104",
        "time_diff": 0,
        "ssid": "c2t5bmXX",
        "rssi": -63,
        "signal_level": 2,
        "latitude": 0,
        "longitude": 0,
        "lang": "en_US",
        "avatar": "plug",
        "region": "Europe",
        "specs": "",
        "nickname": "UmFkaWF0b3JQbHVn",
        "has_set_location_info": true,
        "device_on": true,
        "on_time": 24,
        "default_states": {
            "type": "last_states",
            "state": {}
        }
    },
    "error_code": 0
}
1 Like

So wanna set upt the P100. total noob here.

so I set up the custom_componets, but the tapo_p100_control folder in it and added

switch:
    platform: tapo_p100_control
    ip_address: 192.168.x.x
    email: [email protected]
    password: Password123
    

Into my configuration.yaml

First question. As the Email and Password, I use my tapo account right ?
Used it atleast and the pasword does have 1 Uppercase and 1 number and is atleast 8 long

The logs say:

Error while setting up tapo_p100_control platform for switch
17:15:07 – (FEHLER) Schalter (benutzerdefinierte Integration) - Die Nachricht ist zum ersten Mal um 17:15:06 aufgetreten und erscheint 4 mal
Could not connect to plug. Possibly invalid credentials
17:15:07 – (FEHLER) tapo_p100_control (benutzerdefinierte Integration) - Die Nachricht ist zum ersten Mal um 17:15:05 aufgetreten und erscheint 4 mal
Setup of switch platform tapo_p100_control is taking over 10 seconds.
17:15:07 – (WARNUNG) Schalter - Die Nachricht ist zum ersten Mal um 17:15:07 aufgetreten und erscheint 3 mal

clicking on details I get

Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/PyP100/PyP100.py", line 155, in login
    self.token = ast.literal_eval(decryptedResponse)["result"]["token"]
KeyError: 'result'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 249, in _async_setup_platform
    await asyncio.shield(task)
  File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 52, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/tapo_p100_control/switch.py", line 44, in setup_platform
    add_entities([P100Plug(p100)])
  File "/config/custom_components/tapo_p100_control/switch.py", line 53, in __init__
    self.update()
  File "/config/custom_components/tapo_p100_control/switch.py", line 84, in update
    self._p100.login()
  File "/usr/local/lib/python3.9/site-packages/PyP100/PyP100.py", line 159, in login
    raise Exception(f"Error Code: {errorCode}, {errorMessage}")
Exception: Error Code: -1501, Invalid Request or Credentials

SO pretty sure my credentilas are wrong ? but which one do i have to use ?

EDIT: GOT IT TO WORK had to change the first letter of the email to a lower case

Can I get power/energy readings with the P100?

No, only P110

I tried setting this up with 2 brand new P100’s and I’m getting the following error:

Platform error switch.tapo_p100_control - Requirements for tapo_p100_control not found: ['PyP100==0.0.18'].

I’m wondering if it is because I updated the firmware on the plugs before I added them.

Plugs Have a Hardware version 1.20.0 and Firmware 1.4.10

Thank you so very much. Had to sign up just to say thanks. Got a P100 from Amazon (UK) so I could turn on and off 3D printer using Klipper. Only later re-reading the docs to find the API no longer accessible. Saw a link to this thread and was hooked. The Python library installed and it worked perfectly first time. Amazing team effort!

My firmware updated, but still worked for me.

Just wanted to share that I bought three P100 and got them installed without internet access to the device.

Looks like a lot of the provisioning is on Bluetooth, so I turned off my WiFi, searched for a P100 on the Tapo app, and followed the steps to provide SSID and passkey for my WiFi network that has no internet out.

Back on HA, I added in the device with the P100 integration and it worked flawlessly.

No matter what I do I can’t seem to get HA to start without it throwing errors :frowning:

I’m pretty new to HA (I only installed it 2 days ago!) but I think I have followed everything correctly yet when HA starts I get the following errors:

ERROR (MainThread) [homeassistant.components.switch] Error while setting up tapo_p100_control platform for switch
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 249, in _async_setup_platform
    await asyncio.shield(task)
  File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/tapo_p100_control/switch.py", line 44, in setup_platform
    add_entities([P100Plug(p100)])
  File "/config/custom_components/tapo_p100_control/switch.py", line 53, in __init__
    self.update()
  File "/config/custom_components/tapo_p100_control/switch.py", line 83, in update
    self._p100.handshake()
  File "/usr/local/lib/python3.9/site-packages/PyP100/PyP100.py", line 124, in handshake
    encryptedKey = r.json()["result"]["key"]
KeyError: 'result'

And in my configuration.yaml:

switch living-room-lamp:
  - platform: tapo_p100_control
    ip_address: 192.168.1.129
    email: paul.*******@gmail.com
    password: ******

That’s with a 8 character password in lowercase with a single number. I have also tried removing and re-adding all of the config but I always get the same error :cry:.

Does anyone have any idea?
Thanks

For anyone who is also experiencing the KeyError exceptions, I’ve managed to get to the bottom of the error. It’s related to Handshake() being called twice from HA and the code not being defensive enough to handle it. I have raised an issue on the GitHub repo which details the fix. I can confirm my switch is now working as expected.

2 Likes

Hi @fanuch / all, I bought a P110 (P100 with energy monitoring) on special to muck around with. I’ve got it connected and working with the Tapo app, but can’t find it in HA / it isn’t being auto-discovered. When you say you added the device with “the P100 integration”, what integration are you referring to? Maybe I’ve missed something here?

I’ve added the TP-Link Smart Devices integration but that doesn’t find any devices (as it’s for Kasa devices which I’m now gathering are a different range altogether, I guess this is expected). Oddly the TP-Link integration doesn’t show up on my Integrations page, it’s the first time I’ve seen this behaviour. Is this normal?

@Brightspark good question :+1:

This one:

A quick look shows that it supports p110 and energy monitoring.

You add this through HACS and add one by one through Integrations.
You need to provide the IP address of the device, which you can get from the information on the Tapo app or your router DHCP list.

Ah thanks @fanuch, I really should have thought of that!

As always seems to happen…one step forward, two steps back. Any integration I add (like P100) in HACS doesn’t appear. And I can’t upgrade HACS nor currently installed integrations, the UI says it’s ready to upgrade after a restart but a restart does nothing (I’ve tried all restart options, including power cycling the RPi). Looks like I have a bigger problem to resolve first!

I’ve had that too @Britespark it just resolved itself after a couple of weeks.

In the meantime I got frustrated and copied the custom_components directory from the GitHub repo directly to my HA to bypass HACS. DM me if you want some help as I don’t want to bomb the rest with HACS woes in this thread :stuck_out_tongue:

That helps manage expectations - I’ll leave HACS for a few weeks then try again!

Thanks for your help - I followed the manual install path, and now have a working P110 unit to play with. Power monitoring is reporting 6.8W for a Philips 6W LED bulb which seems pretty accurate.

Can’t believe it took a couple of days to reach this point…I’ll call it a learning experience :cry:.

1 Like

Dear Mark!
Please help me to get work P100 plugin. I’am using an Ender 5 Pro printer with Raspberry Pi 4 B. Fluidd interface & klipper setup. I tried to setup my TPlink Tapo P100 smart plug, but moonraker don’t like it
The TAPO P100 IP address is already reserved in my router
This is my configuration:

[power printer_plug]
type: tplink_smartplug
address: 192.168.1.105

Hi everyone! Just started inspecting the bluetooth setup to avoid using the app configurator.Was able to send the first (cloned :stuck_out_tongue: ) message with response but struggling to setup 5 bytes, part of the 18 bytes header sent before the json, that seems a crc of the message…looking at the decompiled apk is no use. Does anybody has a firmware to look at? Thanks for the help :slight_smile:

Hi guys i am newbie with home assistant but its giving to me a “invalid authentication” when i am trying to put the host, username and the password and i already change the code on configuration.yaml to this
“switch:
platform: tapo_p100_control
ip_address: 192.168.x.x
email: [email protected]
password: Password123”
Puttin the ip of p100 my personal email and a new password and i already restart the HA and nothing changed still having the same error.
Btw i downloaded from here “GitHub - petretiandrea/home-assistant-tapo-p100: A custom integration to control Tapo devices from home assistant. ”.
Thanks for the help.

Does anyone know if the HACS tapo repository local or does it need internet/tp link ?