[Custom Component] Tapo P100 Plug Control

Was this resolved? I am having the same issue

With the Tapo P100? I just found HA yesterday and I was trying to do this and the only solution was to change the password of the tapo login. Donā€™t know if this helps.

Home Assistant Tapo P100 Control V2 is here

The custom integration now has support for the L510 series of bulbs!! Please let me know either here or on github what features I should add next.

Installation

To install the Tapo P100 integration copy the tapo_p100_control folder from the github into the custom_components folder on your home assistant instance then these lines should be added to your configuration.yaml file.

#P100 or P105 Plug
switch:
    platform: tapo_p100_control
    ip_address: 192.168.x.x
    email: [email protected]
    password: Password123
    
#L510 Series Bulbs
light:
    platform: tapo_p100_control
    ip_address: 192.168.x.x
    email: [email protected]
    password: Password123
2 Likes

Just created an issue on GitHub but in case anyone here has a quick fix for me, I had this working then this evening my Node Red flow to turn the lights on failed. Updated to the new version and also HA has updated to 2012.01. Seeing the below error:

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 199, in _async_setup_platform
    await asyncio.shield(task)
  File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/tapo_p100_control/switch.py", line 43, in setup_platform
    add_entities([P100Plug(p100)])
  File "/config/custom_components/tapo_p100_control/switch.py", line 52, in __init__
    self.update()
  File "/config/custom_components/tapo_p100_control/switch.py", line 85, in update
    self._name = self._p100.getDeviceName()
  File "/usr/local/lib/python3.8/site-packages/PyP100/PyP100.py", line 285, in getDeviceName
    data = self.getDeviceInfo()
  File "/usr/local/lib/python3.8/site-packages/PyP100/PyP100.py", line 278, in getDeviceInfo
    decryptedResponse = self.tpLinkCipher.decrypt(r.json()["result"]["response"])
KeyError: 'result'

Hi, I realized too late that your implementation already existed, so I made my own. I saw on the repository that there are credential problems. In my implementation, which is based on the plugp100 library, there are no problems. If you are interested, we could merge our works by opening a pull request. In addition, since I had planned to add the integration configuration via UI to my implementation, I can add it directly to this one that is most used.

1 Like

Do you want to open an issue on this integrations GitHub to discuss it :slight_smile:

1 Like

2021.1.1 had fixed this issue it seems.

Hmm, Iā€™ve literally just installed a fresh home assistant via docker and freshly set this component up but still getting this trace:

Traceback (most recent call last):
  File "/usr/local/lib/python3.8/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 193, in _async_setup_platform
    await asyncio.shield(task)
  File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/tapo_p100_control/switch.py", line 43, in setup_platform
    add_entities([P100Plug(p100)])
  File "/config/custom_components/tapo_p100_control/switch.py", line 52, in __init__
    self.update()
  File "/config/custom_components/tapo_p100_control/switch.py", line 83, in update
    self._p100.login()
  File "/usr/local/lib/python3.8/site-packages/PyP100/PyP100.py", line 159, in login
    raise Exception(f"Error Code: {errorCode}, {errorMessage}")
Exception: Error Code: -1501, Invalid Request or Credentials

Not sure if itā€™s something with my setup, but there seems to be something getting mixed up between brightness as a value from 0-255 and brightness as a percentage. Whenever I set the brightness through the UI the slider then jumps about a second later to 100/255 of the value I just set it to. This is happening the same with the standard light card and with slider-entity-row plugin.

Can confirm, you need the hyphen and it works.

Can confirm I have the same issue re brightness.

Thanks all for developing this. Got the 530 in the mail today, editing your files to say ā€œ530ā€ instead of ā€œ510ā€ so for now all is working on on/off and the somewhat glitched brightness slider. Any ideas how to fix?

Thanks!

Temp fix but a bit buggy:
Allow for customisations in your config yaml. Customise your entities -> tapo -> brightness change from 50 to 100. Restart.
The slider only works from 1-99, if you punch in 100 it wonā€™t register a change. Anyone know JSON formatting who could assist getting around this? Maybe I need to actually edit the card to only go from 1 to 99, but thatā€™s another day.

Oh and i wanted to add another issue I came across and fixed, if youā€™re running the docker version on raspi OS, get into the dockers bash/console (I do this in portainer) and run the following if you get errors installing PyP100:


apk add --no-cache --virtual .build-deps gcc musl-dev
pip install cython
pip3 install PyP100

1 Like

The issue with the brightness has been noted and I will work on fixing it soon. I think it is something to do with mapping the 1-100 scale ha gives to the 1-255 scale the bulb needs. In other places Iā€™m working on making the integration async which will hopefully fix the takes too long to update error.:crossed_fingers: Thanks everyone for using this integration and another big thank you to everyone who helped me build it :smiley:

Youā€™re amazing thanks!

Hi,
I am new to HA and I installed the HA in VMware with the tutorial on the official guide and VMDK. I have two P100 switches. Recently, I followed the instruction in the github copying the p100 folder to /config/custom_components/. I also added the
following code to the configuration.yaml

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

After I reboot the HA, I still cannot find my device as a new entityā€¦ In the system log of supervisor, there is no error and no installation info of new custom component.
I wonder if I install the component in the right way?
Can any one help me to figure it out?
Thanks in advance.

Heya, did you fill out ip, email and password with your own details?

If not, give your tapo a static ip in your router and use that
use your tapo (TP-Link) account details for the rest

You also need to install PyP100: https://github.com/fishbigger/TapoP100

Fantastic. I have now got to the stage of 18 P100s (yes, I know), and itā€™s feeling a little sluggish and error-y. Be great to get it async, and merge it into a UIā€¦

(Happy to beta test if youā€™re looking at how it scalesā€¦)

Iā€™m approaching that now :smiley: I agree they are a bit sluggish. Does anyone have any resources on how to make a ui integration?

Hi,
Thank you very much!
I found that there is a bad indention in my codeā€¦ It is easier to find some typo mistake with the visual studio code rather than file editor.
They are working as expected now. Thank you very much!

1 Like

Did pedro96 mention they were planning something along the UI linesā€¦?

I didnā€™t see them say that but any help would be appreciated :slight_smile: