TP-Link Tapo P100

Got it’s a Json array so you can decompose it :slight_smile: really need python skills honed

Yep it’s called a dictionary if you want to read up on it :slight_smile:
https://www.w3schools.com/python/python_dictionaries.asp

@pnmoliveira - when you say you installed the latest version from @fishbigger what do you mean exactly? You downloaded the python from here: https://github.com/fishbigger/TapoP100 or installed from pip or something else?

Just installed Python 3.8.6 on Win 10 and the pip package but still get the same error. Also the init.py file contains a “.” which causes an error - I’m removing this “.” in order to get it to run - is that expected?

I also downloaded the PyP100.py file from git and replaced the contents in the Python package cache - but still get the error.

Right the latest version can be installed using pip install PyP100==0.0.7 The init.py containing a dot was a typo that thought I fixed but obviously not :slight_smile: I’m not sure what is going on with your plugs. I will keep thinking and keep you posted :slight_smile:

I have created the start of a home assistant integration which can be found at https://github.com/fishbigger/HomeAssistant-Tapo-P100-Control the folder needs to be copied into the custom_components folder on your home assistant instance and these lines added to configuration.yaml

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

I have no idea if it works as I can’t get it running on my system (Hopefully sorting this soon) so can someone test this and let me know if it works :slight_smile:

1 Like

Thanks @fishbigger. Yeah, its definitely pulled down 0.0.7. I might dust off my python skills and have a deeper dig!

Ok, Good Luck I’m still really confused why this is happening but as far as I can tell the code is working fine (catching the no key error and raising the -1501) but it may be down to you using linux so hashlib works differently? (This is my only thought at the moment :slight_smile: )

Yeah, I thought it might be that. But I’ve just installed it on my Windows 10 laptop and get the same result, so I don’t think is OS specific.

Ok good luck trying to fix it. If you do just make a pull request to the github page and I will merge it :slight_smile:

Just uploaded it to my fresh HA and got an error saying it couldn’t find the integration:

“Component error: tapo_p100_control - Integration ‘tapo_p100_control’ not found.
9:40:46 PM – Hass.io (ERROR) - message first occurred at 9:37:03 PM and shows up 2 times”

Followed your instructions :slight_smile: going to try and dig a bit further :slight_smile:

Have you restarted your home assistant instance?

I used the restart server from the control panel. Should I restart the container?

Restart server should have worked (I think) Is anything showing up in the logs?

So tried following the steps manually and found it genuinely was returning an Error 1501.

After logging into the Tapo app, changing password there and then putting the new password in the script, all is working fine.

Very weird. But looks to be there now!

Thanks for all your help.

I think I’ve got it :slight_smile: I’m pretty sure you need to add an __init__.py file like I’ve just put in the github repo. I completely forgot that this was needed in the integration :slight_smile:

Great, glad to hear that it works :slight_smile:

Still the same :confused:

020-10-30 22:14:58 ERROR (MainThread) [homeassistant.components.hassio] Component error: tapo_p100_control - Integration ‘tapo_p100_control’ not found.

2020-10-30 22:16:34 ERROR (MainThread) [homeassistant.components.hassio] Component error: tapo_p100_control - Integration ‘tapo_p100_control’ not found.

Edit:
Completely restarted my HA and got this now:

Logger: homeassistant.setup
Source: setup.py:138
First occurred: 10:35:43 PM (1 occurrences)
Last logged: 10:35:43 PM

Setup failed for tapo_p100_control: No setup function defined.

Hi everyone, thanks for the huuuuge work for this little thing

Analysing my other modules, I think the syntax should be :

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

With this, HA recognize the setup function BUT return the error code:

  File "/usr/local/lib/python3.8/site-packages/PyP100/__init__.py", line 1
    .

I already have this problem while testing the last repo on my PC, solved by deleting the “.” in the _init.py_ on my local environnement

Unfortunatly I am on docker and I don’t find the folder on my container for fix this line :sweat_smile:

EDIT :

Fixing the code by editing :

_init.py_ : delete the “.”

switch.py : Import PLATFORM_SCHEMA and editing CONF_USERNAME by CONF_EMAIL

from homeassistant.components.switch import SwitchEntity
from homeassistant.const import CONF_IP_ADDRESS, CONF_EMAIL, CONF_PASSWORD
from homeassistant.components.switch import PLATFORM_SCHEMA

# Validation of the user's configuration
PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
    vol.Required(CONF_IP_ADDRESS): cv.string,
    vol.Required(CONF_EMAIL): cv.string,
    vol.Required(CONF_PASSWORD): cv.string,
})

def setup_platform(hass, config, add_entities, discovery_info=None):
    """Set up the Awesome Light platform."""
    # Assign configuration variables.
    # The configuration check takes care they are present.
    ipAddress = config[CONF_IP_ADDRESS]
    email = config[CONF_EMAIL]
    password = config.get(CONF_PASSWORD)

Thanks for troubleshooting the correct yaml syntax :slight_smile: I have updated the module to finally work by removing the dot and I have updated the integration to install the new version (0.0.8). The full setup process (I think) should be:

Copy the tapo_p100_control folder from the github page and place it into the custom_components folder in your home assistant instant then these lines should be added to your configuration.yaml file

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

I hope this works :slight_smile: Thanks for all your help testing it so far

1 Like

Thanks so much I will make those changes now :slight_smile: Does a switch appear on your dashboard that can turn the plugs on and off?