With a few editing (maybe wrong idk) on switch.py, I’m stiil having a last error on my HA log :
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 197, 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 37, in setup_platform
add_entities([P100Plug(p100)])
File "/config/custom_components/tapo_p100_control/switch.py", line 44, in __init__
self.is_on = False
AttributeError: can't set attribute
Currently searching how to fix it !
EDIT :
FIx !
Juste edit the
self.is_on
by
self._is_on
Another error now :
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 197, 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 37, in setup_platform
add_entities([P100Plug(p100)])
File "/config/custom_components/tapo_p100_control/switch.py", line 45, in __init__
self.update()
File "/config/custom_components/tapo_p100_control/switch.py", line 77, in update
self._is_on = data["device_on"]
TypeError: string indices must be integers
I already fix it on my last test in local environnement by convert the string in JSON, example :
Thanks everybody for all your help on this. Thanks to @vbtrek for raising this question. I have released the first fully working version on github along with the installation instructions. Please continue the discussion at [Custom Component] Tapo P100 Plug Control and I will continue to update the intergration with new features (Starting with getting the name of the plug)
Thank you for all of your work everyone, Its great to see.
Do you think its likely for TP Link to change the way it works so this stops working?
Only reason I ask is because not being able to control the Tapo plugs other than with the app (plus smart Assistants) has been kept me from buying them but with this I might buy.
Logger: homeassistant.components.switch
Source: custom_components/tapo_p100_control/switch.py:79
Integration: Switch (documentation, issues)
First occurred: 7:51:03 PM (1 occurrences)
Last logged: 7:51:03 PM
Error while setting up tapo_p100_control platform for switch
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 197, 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 41, in setup_platform add_entities([P100Plug(p100)]) File “/config/custom_components/tapo_p100_control/switch.py”, line 49, in init self.update() File “/config/custom_components/tapo_p100_control/switch.py”, line 79, 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
Are you 100% your credentials are ok? From the error it seems that the crendentials don’t appear to be correct, Exception: Error Code: -1501, Invalid Request or Credentials
Presuming you’ve copied the folder across successfully, it sounds like you need to comment out (put a # in front of) the Tapo config lines and, if you’ve not already, restart HA. It should then recognise the folder in Custom Components, and then you can add them back in and restart again.
Folder copied to config\custom_components. Commented out switch: section, restarted HA and reinstated switch: same issue. Also tried recreating new Tapo account with no joy.
Could it be a permissions issue? I don’t know how to check that