Giter Site home page Giter Site logo

homeassistant-tapo-p100-control's Introduction

Hi there 👋

homeassistant-tapo-p100-control's People

Contributors

fishbigger avatar r00tat avatar richard-scott avatar robtesch avatar shiner66 avatar vihman avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

homeassistant-tapo-p100-control's Issues

OSError: [Errno 113] Host is unreachable

I am really struggling to install this integration. I have looked on the logs and I get this error:
OSError: [Errno 113] Host is unreachable

Is there an easy fix for this? Anything I am doing wrong?
Thanks in advance

Updated plug firmware causes integration to fail

Thanks for creating this integration. I have it working with one of my smart plugs I upgraded the firmware on another one and the plug is no longer working via this integration.

Logger: homeassistant.helpers.service
Source: helpers/service.py:130
First occurred: 20:32:51 (9 occurrences)
Last logged: 20:38:44

Unable to find referenced entities switch.smart_plug

Not working?

Hello! I am super new to home assistant and I don't know if I am doing something wrong. I pasted the code into configuration.YAML then pasted the folder into the custom components folder. Restarted home assistant. But can't get it working. I changed the login to be my login on the tapo app. and I went into my router and took the IP from the Tapo smart plug and pasted that into the IP address box. If something is wrong here Please let me know. I want it to be able to be seen as an entity.

PyP100 module not available

Trying to get it to work on an up to date hassio install on Raspberry pi.

Error:

Logger: homeassistant.components.hassio
Source: components/hassio/init.py:383
Integration: Hass.io (documentation, issues)
First occurred: 2:33:51 PM (2 occurrences)
Last logged: 2:36:27 PM

Platform error switch.tapo_p100_control - Integration 'tapo_p100_control' not found.
Platform error switch.tapo_p100_control - No module named 'PyP100'

Tried SSH and install using pip3 install PyP100, got a gcc error (gcc appears not be installed by default on the hassio build).

Stops Tapo Control from working

Hi,
I've just upgraded the HA core to core-2021.6.6

I've added the new update from here but still getting these errors. Any ideas?

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 250, 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'

Don't need to login and handshake every time?

I don't know how long the cookies last, but certainly we don't need to do the handshake and login every time the bulb is turned on or off or the brightness is set.

I've commented out those lines for now in the turn_on function and it means I get much quicker response times (sub half second, rather than a second or two).

They are still called (and so the cookie is refreshed) in the setup_platform, init and update functions, but I'm not sure how often those happen.

"Entity Not Available"

I have three Tapo P100s, and have had all three working well with Home Assistant Core (v2021.10.3) for a few months, thanks to this excellent component.
Yesterday however, two of the three plugs became inaccessible to HA - there's an "Entity Not Available" message alongside them on my Lovelace dashboard. The third is still accessible. Both of the problem plugs are still accessible and controllable by the Tapo app on my phone, and their IP addresses remain correct (i.e. the same as those referenced in my configuration.yaml).
I've tried restarting HA twice, but the same two plugs remain unavailable.
Has anyone else had this problem?

Entity not available

Hi,
thanks for your work!! Really appreciated.
I tried latest version (as of commit 0d31932) in HA but tapo switch is not available.
The stack trace from HA registry is:

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 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 88, in update
    encodedName = data["result"]["nickname"]
TypeError: string indices must be integers

I ended up restoring the conversion from json to make it work:

diff --git a/tapo_p100_control/switch.py b/tapo_p100_control/switch.py
index 686fafe..ba4a959 100644
--- a/tapo_p100_control/switch.py
+++ b/tapo_p100_control/switch.py
@@ -84,6 +84,7 @@ class P100Plug(SwitchEntity):
         self._p100.login()
 
         data = self._p100.getDeviceInfo()
+        data = json.loads(data)
 
         encodedName = data["result"]["nickname"]
         name = b64decode(encodedName)

With the patch applied to tapo switch work as expected.
Marco

Wrong brightness value

Hi

I have installed and got it working with homeassistant and two bulbs. I can control the bulbs fine but the brightness value being shown in home assistant is wrong.

E.g. bulb is set to 100%, it shows 100% in the app but home assistant is reporting it at about 40%.

Is there a setting I need to change?

Thanks

Stopped working with Home Assistant Core 2022.3.0

I haven't changed anything in my config and Home Assistant gives me the following error:

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

Here is my config (in a seperate switches.yaml):

- platform: tapo_p100_control
  ip_address: 192.168.178.48
  email: !secret email
  password: !secret tapo_password
- platform: tapo_p100_control
  ip_address: 192.168.178.47
  email: !secret email
  password: !secret tapo_password
- platform: tapo_p100_control
  ip_address: 192.168.178.37
  email: !secret email
  password: !secret tapo_password
- platform: tapo_p100_control
  ip_address: 192.168.178.36
  email: !secret email
  password: !secret tapo_password

How do I include a P100 switch in an HA automation?

Hi - I have two P100 switches setup & working in HA.
Now I'd like to include them in a simple automation to turn them on at sun set (I have lamps connected to them). Also probably a off automation to turn them off at a certain time.

However, the HA automation wizard/workflow requires me to select a "Device" from which to choose the switch entity to act on, but the TP100 entities seem to exist in HA without being attached to a Device.

Am I missing something? is there a way around this? ie can I create an automation manually in the automation.yaml conflict file? and if so, can you help me out with an example of an automation configuration that does not need a device definition?

Thanks 8-)

No 'version' key in the manifest file for custom integration 'tapo_p100_control'

Hi,

Just seen this in my logs in HA, I cloned the latest version just now and the error is still in the log, not sure if you were aware or not.

Logger: homeassistant.loader
Source: loader.py:794
First occurred: 17:21:50 (1 occurrences)
Last logged: 17:21:50

No 'version' key in the manifest file for custom integration 'tapo_p100_control'. As of Home Assistant 2021.6, this integration will no longer be loaded. Please report this to the maintainer of 'tapo_p100_control'

Possibly invalid credential/multiple plug/firmware issues

Hi,
I bought 4 Tapo P100 plugs.
During app configuration I updated firmware version on latest (1.4.9 Build 20210621 Rel.30941) for 3/4 of my plugs.
After this I've used your custom component in home assistant following your guide (copying folder and writing configuration.yaml).
Now the only plug recognized in home assistant is the one with old firmware version (1.2.10 Build 20210207 Rel. 67438).

Now do you think it is an issue with firmware? Or it is due to multiple plugs?
I tried also to reset plugs, change password to 8 characters, remove and re add plugs, but with no lucky.

Please help me in troubleshoot.

This is the logs I can see in homeassistant (multiplied by 3 plugs):

_Logger: custom_components.tapo_p100_control.switch
Source: custom_components/tapo_p100_control/switch.py:42
Integration: tapo_p100_control (documentation, issues)
First occurred: 23:40:47 (3 occurrences)
Last logged: 23:40:54

Could not connect to plug. Possibly invalid credentials_

_Logger: homeassistant.components.switch
Source: custom_components/tapo_p100_control/switch.py:83
Integration: Interruttore (documentation, issues)
First occurred: 23:40:50 (3 occurrences)
Last logged: 23:40:57

Error while setting up tapo_p100_control platform for switch
Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/urllib3/connection.py", line 169, in _new_conn
conn = connection.create_connection(
File "/usr/local/lib/python3.8/site-packages/urllib3/util/connection.py", line 96, in create_connection
raise err
File "/usr/local/lib/python3.8/site-packages/urllib3/util/connection.py", line 86, in create_connection
sock.connect(sa)
OSError: [Errno 113] Host is unreachable

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/urllib3/connectionpool.py", line 699, in urlopen
httplib_response = self._make_request(
File "/usr/local/lib/python3.8/site-packages/urllib3/connectionpool.py", line 394, in _make_request
conn.request(method, url, **httplib_request_kw)
File "/usr/local/lib/python3.8/site-packages/urllib3/connection.py", line 234, in request
super(HTTPConnection, self).request(method, url, body=body, headers=headers)
File "/usr/local/lib/python3.8/http/client.py", line 1255, in request
self._send_request(method, url, body, headers, encode_chunked)
File "/usr/local/lib/python3.8/http/client.py", line 1301, in _send_request
self.endheaders(body, encode_chunked=encode_chunked)
File "/usr/local/lib/python3.8/http/client.py", line 1250, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File "/usr/local/lib/python3.8/http/client.py", line 1010, in _send_output
self.send(msg)
File "/usr/local/lib/python3.8/http/client.py", line 950, in send
self.connect()
File "/usr/local/lib/python3.8/site-packages/urllib3/connection.py", line 200, in connect
conn = self._new_conn()
File "/usr/local/lib/python3.8/site-packages/urllib3/connection.py", line 181, in _new_conn
raise NewConnectionError(
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0xab535d48>: Failed to establish a new connection: [Errno 113] Host is unreachable

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/requests/adapters.py", line 439, in send
resp = conn.urlopen(
File "/usr/local/lib/python3.8/site-packages/urllib3/connectionpool.py", line 755, in urlopen
retries = retries.increment(
File "/usr/local/lib/python3.8/site-packages/urllib3/util/retry.py", line 574, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='192.168.1.143', port=80): Max retries exceeded with url: /app (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0xab535d48>: Failed to establish a new connection: [Errno 113] Host is unreachable'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 205, 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 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.8/site-packages/PyP100/PyP100.py", line 114, in handshake
r = requests.post(URL, json=Payload)
File "/usr/local/lib/python3.8/site-packages/requests/api.py", line 119, in post
return request('post', url, data=data, json=json, **kwargs)
File "/usr/local/lib/python3.8/site-packages/requests/api.py", line 61, in request
return session.request(method=method, url=url, **kwargs)
File "/usr/local/lib/python3.8/site-packages/requests/sessions.py", line 542, in request
resp = self.send(prep, **send_kwargs)
File "/usr/local/lib/python3.8/site-packages/requests/sessions.py", line 655, in send
r = adapter.send(request, **kwargs)
File "/usr/local/lib/python3.8/site-packages/requests/adapters.py", line 516, in send
raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPConnectionPool(host='192.168.1.143', port=80): Max retries exceeded with url: /app (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0xab535d48>: Failed to establish a new connection: [Errno 113] Host is unreachable'))

Countdown feature

In Tapo App there is a feature that you can set up a timer like "turn off after 5 minutes".
Is it possible to add such function in this integration ?

core-2021.6.0 - Stops Tapo Control from working

Hey there,

Just a heads up.
I've just upgraded the HA core to core-2021.6.0 and the intergration stops working. I downgraded back to core-2021.5.5 and it works fine.

Many thanks for your hard work.

Sam

-1501, Invalid Request or Credentials is it broken?

some of you might think that's it's my credentials that is the problem
but I recheck already it works on TP-Link website and apps
here's the full error

2021-07-30 21:19:08 ERROR (SyncWorker_1) [custom_components.tapo_p100_control.switch] Could not connect to plug. Possibly invalid credentials
2021-07-30 21:19:08 ERROR (MainThread) [homeassistant.components.switch] 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 250, 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

I'm sure that my credentials isn't the problem

Stopped working

Hi,

I did have this working then it has stopped working.

I've added the new update from here but still getting these errors. Any ideas?

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'

Incorrect type. Expected "array" Error

Hello! when I am putting the Tapo P100 Plug Control code in configuration.yaml I get an error that says
Incorrect type. Expected “array”. I am new to home assistant so I don’t know how to fix this. Thank you.
I am using Visual Studio Code add on if that makes a difference

HA blew up

Hi! I tried to add a P100 to HA but as I copied the folder and modified configuration.yaml HA stopped working. I can’t reach it from browser and I can’t start it from ssh (raspberry pi 3a+ with raspbian).

I have to say that the folder “custom_components” did not exist: I created it. Do I miss something?

No 'version' key in the manifest file for custom integration

Hey!
I get the following error message in Home Assistant when I try to add a Taco-P100 plug:

`Logger: homeassistant.loader
Source: loader.py:786
First occurred: 18:46:02 (1 occurrences)
Last logged: 18:46:02

No 'version' key in the manifest file for custom integration 'tapo_p100_control'. As of Home Assistant 2021.6, this integration will no longer be loaded. Please report this to the maintainer of 'tapo_p100_control'`

I would love to see a solution to this!

entity not available

Thank you so much for your amazing work.
If I connect my plug before starting home assistant everything is working fine. if I plug the Tapo with home assistant running I have to restart it, otherwise I get "entity not available" and it doesn't seem to look up for the device afterwards.
I'm really new to home assistant and I don't know if this is normal behaviour for other integrations as well.
Is it possible to look for connected Tapo's while home assistant is running?

Also is it possible to have more than one Tapo plug? (I don't have more at the moment and cannot test)

New Feature Request : L530 Bulbs

Thanks for all the hard work you and people have been putting in, im so happy i can use my bulbs with HA now.

Just wondering with the inclusion of the L510 bulbs could it be possible to extend this out to the L530 multicolor bulbs to allow them to have the color set within HA as well.

Thanks very much and happy to test or whatever is needed.

KeyError result

Hi,

I have a single tapo P100 plug setup via tapo app. When trying to integrate to HA 2022.4.3:

switch:
  platform: tapo_p100_control
  ip_address: 192.168.x.x
  email: !secret tapo_user
  password: !secret tapo_password

I get this error in the log:

Logger: homeassistant.components.switch
Source: custom_components/tapo_p100_control/switch.py:83
Integration: Switch (documentation, issues)
First occurred: 14:53:23 (1 occurrences)
Last logged: 14:53:23

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'

The plug is switched on and connected to the network via static IP and I can ping it from the hassio host. The device has 2.0 hardware version and firmware is 1.0.6 Build 210721 Rel.180949

Thanks

No 'version' key in the manifest

I get this warning:
No 'version' key in the manifest file for custom integration 'tapo_p100_control'. This will not be allowed in a future version of Home Assistant. Please report this to the maintainer of 'tapo_p100_control'

Bulb not showing in Entities/Integrations

Absolute HA newbie here. I (think I) have done everything correctly to set up 1 of my tapo bulbs. The github file is in the custom_components folder and inserted the lines(including the bulb's IP, TAPO username & password) in to the config.yaml using file editor. The "check configuration" does not come back with any errors before I reset. But when I look on entities there is still no sign of any bulbs.
I know this probably isn't enough info to go on, but any help would be appreciated.

no divice found in HA

Hi,
I added the component into my custom_components folder and I add my Tapo credential into the configuration.yaml but the device is not there.
The error is:
Questo errore ha avuto origine da un'integrazione personalizzata.

Logger: custom_components.tapo_p100_control.switch
Source: custom_components/tapo_p100_control/switch.py:41
Integration: tapo_p100_control (documentation, issues)
First occurred: 17:57:01 (1 occurrences)
Last logged: 17:57:01

Could not connect to plug. Possibly invalid credentials

My tapo firmware is: 1.4.5 build 20210122 rel 57265.
Hardwere verion: 1.20.0
I used a psw with only 8 chars.

Please, could you help me to solve this issue?

Add 2 plugs

Hello,
I tried to install 2 plug but it's not working, i can use only one because the other not appear
I try this different configuration and i try also to insert IP ADRESS of the rooter but in this case, nothing plug appear.
192.168.0.21 is the IP adresse of the firt plug and 192.168.0.35 to the second.

n1

switch:
##Plug1
    platform: tapo_p100_control
    ip_address: 192.168.0.21
    email: xxx
    password: xxxx
    
switch:
##Plug2
    platform: tapo_p100_control
    ip_address: 192.168.0.35
    email: xxx
    password: xxx

n2

switch:
##Plug1
    platform: tapo_p100_control
    ip_address: 192.168.0.21
    email: xxxx
    password: xxx
    
##Plug2
    platform: tapo_p100_control
    ip_address: 192.168.0.35
    email: xxx
    password: xxx

n3

switch:
##Plug1 and 2
    platform: tapo_p100_control
    ip_address: 192.168.0.21
    ip_address: 192.168.0.35
    email: xxx
    password: xxx

How i can add another plug to Home Assistant with this plugin ?
Thank you for reading. 😄

No reconnect after connection lost for lights

Hello,
I've been experimenting with L530E and discovered that if I turn off the bulb and turn it on again after some time, I need to restart HA to be able to control it. So, after power outage or connection loss, HA is not able to connect to the bulb (my HA instance is not at the same location)

urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0x7fdd65a50b20>: Failed to establish a new connection: [Errno 110] Operation timed out

after this message, the light.py script does no attempts to reestablish the connection and log HA logs just spams
WARNING (MainThread) [homeassistant.components.light] Updating tapo_p100_control light took longer than the scheduled update interval 0:00:30
every 30 seconds. I've checked with tcpdump, no packages are send after connection broke.

To fix this, I've added
p100 = PyP100.P100(192.168.2.xxx, xxx@mail, pass)
as a first line in update function.
Unfortunately, I don't have a lot of python programming experience and HA integration, I'm sure there is a way to make it more elegant with config parsing.

HA only finds one instead of multiple P100 plugs

Hi there, I'm pretty new to HA, but I manged that one TAPO P100 plug is shown within the enteties. So, in fact I have 5 plugs, which should be shown within the enteties. How should the config entries look alike.

I tried the following versions, but none of them worked out.

Version 01:

#P100 or P105 Plug
switch:
platform: tapo_p100_control
ip_address: 192.168.xxx.xxx
email: @.**
password: **

#P100 or P105 Plug
switch:
platform: tapo_p100_control
ip_address: 192.168.xxx.xxx
email: @.**
password: **

Version 02:
#P100 or P105 Plug
switch:
platform: tapo_p100_control
ip_address: 192.168.xxx.xxx
email: @.**
password: **

 platform: tapo_p100_control
 ip_address: 192.168.xxx.xxx
 email: ***@***.**
 password: **

Initial setup without app?

Thank you for this neat project! I have a P100 plug which is working nicely, but I was wondering if it would be possible to also handle the setup without the Tapo app? (Maybe not directly through HA, but via a second script, for example.)

AFAICT this would need two things:

  • initially sending the Wifi credentials (SSID & password) through Bluetooth
  • Calling an unknown(?) API endpoint to set the username and password for future connections

Has anyone looked into that already?

Error in 2021.8.8 - KeyError 'result'

Since latest patch the integration has stopped working. It was working correctly in version 2021.8.6.

Error:

Logger: homeassistant.components.switch
Source: custom_components/tapo_p100_control/switch.py:80
Integration: Interruptor (documentation, issues)
First occurred: 11:14:41 (1 occurrences)
Last logged: 11:14:41

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 52, 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 80, in update
    data = self._p100.getDeviceInfo()
  File "/usr/local/lib/python3.9/site-packages/PyP100/PyP100.py", line 247, in getDeviceInfo
    decryptedResponse = self.tpLinkCipher.decrypt(r.json()["result"]["response"])
KeyError: 'result'
 

Can not add L530E 2.0

Hi,
Setup is:
Home Assistant 2022.12.8 on 192.168.0.100/24
Tapo L530E 2.0 is configured to 10.10.19.53 responds to pings from HA network. It is also configured in the Tapo app and can be used.
Hardware 2.0
Firmware 1.0.9

Assumption: Home Assistant Auto-Discovery does not work, because I know that there is no multicast routing between the networks.

Adding it manually via TP-Link Kasa Smart integration and its ip is also not possible.
Error: Failed to connect

Automation use

I have an automation that would turn on the Tapo P100 switch in case the temperature is under 19ºC, but I can't seem to find a way to create an action that can use the P100.

I have the P100 as an Entity, but it does not exist as a Device, can I make create a device for it?
How?

I would also like to assign the P100 to an Area, but I can't seem to find how to do that.

Can you give me a hint on how to solve this?

[Enhancement] New device request - L920-5 Multicolor Light Strip

Hi
I've got one of the new Tapo L920-5 Multicolour LED Strips, which have several LED zones and can run effects displaying multiple colors at once.
I was hoping to request it to be added as a supported device by this awesome integration.

I've run the enumeration python script, the output is:
{'device_id': '80231D69690EC918595B9461405047901F53FFC5', 'fw_ver': '1.0.7 Build 220119 Rel.221439', 'hw_ver': '1.0', 'type': 'SMART.TAPOBULB', 'model': 'L920', 'mac': 'B4-B0-24-44-AA-4B', 'hw_id': '410A49E4E50D1DD5868EDDF2490083C4', 'fw_id': '7BECA9DC454565672FEC87D1104F9972', 'oem_id': '657AEF3473110D5D61531C4A8B32460F', 'color_temp_range': [9000, 9000], 'overheated': False, 'ip': 'xxx.xxx.xxx.xxx', 'time_diff': 0, 'ssid': 'UkVEQUNURUQ=', 'rssi': -52, 'signal_level': 2, 'latitude': xxxxxx, 'longitude': xxxxxx, 'lang': 'en_US', 'avatar': 'light_strip', 'region': 'Europe/London', 'specs': '', 'nickname': 'TGlnaHQgU3RyaXA=', 'has_set_location_info': True, 'lighting_effect': {'enable': 0, 'id': 'TapoStrip_7CC5y4lsL8pETYvmz7UOpQ', 'name': 'Rainbow', 'custom': 0, 'brightness': 100, 'display_colors': [[0, 100, 100], [100, 100, 100], [200, 100, 100], [300, 100, 100]]}, 'music_rhythm_enable': False, 'music_rhythm_mode': 'single_lamp', 'device_on': False, 'brightness': 100, 'hue': 120, 'saturation': 100, 'color_temp': 0, 'default_states': {'type': 'last_states', 'state': {'brightness': 100, 'hue': 120, 'saturation': 100, 'color_temp': 0}}}

Many thanks

Update for switch.led_lampen fails

Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 446, in async_update_ha_state
await self.async_device_update()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 649, in async_device_update
await 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 85, in update
self._name = self._p100.getDeviceName()
File "/usr/local/lib/python3.9/site-packages/PyP100/PyP100.py", line 290, in getDeviceName
errorCode = ast.literal_eval(decryptedResponse)["error_code"]
NameError: name 'decryptedResponse' is not defined

Multiple plugs switching Entity ID

I have 2x Tapo P100 plugs under this integration. Both appear in HA, but it seems when I restart HA the entities switch (i.e. switch 1 acts as switch 2 and vice-versa), throwing automations etc out (e.g. a bug spray coming on instead of fairy lights).
Wondering if this is a bug or something in my setup...

``#P100 or P105 Plug
switch:

  • platform: tapo_p100_control
    ip_address: xxx.xxx.xx.xx
    email: [email protected]
    password: xxxxxxxxxxxxxxxx

  • platform: tapo_p100_control
    ip_address: xxx.xxx.xx.yy
    email: [email protected]
    password: xxxxxxxxxxxxxxxx
    '`

Offline usage?

Can you explain the mechanism that used by this integration? Will it work in local network, when there is no internet connection, or this integration interracts with TP-Link server?

Unknown Error

Logger: homeassistant.components.switch
Source: custom_components/tapo_p100_control/switch.py:86
Integration: Switch (documentation, issues)
First occurred: 4:41:34 PM (1 occurrences)
Last logged: 4:41:34 PM

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 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 86, in update
data = self._p100.getDeviceInfo()
File "/usr/local/lib/python3.9/site-packages/PyP100/PyP100.py", line 278, in getDeviceInfo
decryptedResponse = self.tpLinkCipher.decrypt(r.json()["result"]["response"])
KeyError: 'result'

Core
Version
core-2021.12.6

Supervisor
Version
supervisor-2021.12.2

Invalid Request or Credentials

Hi,

I'm trying to set this up for one of my Tapo P100 plugs but I get the following error:
"Exception: Error Code: -1501, Invalid Request or Credentials"

I'm sure that credentials are OK. I even tried changing my password, it works on the Tapo app, but not in home assistant.

JSON formatting error with L510 bulb

Hi. I am quite new to Home Assistant and have been trying out this integration with Tapo plugs and L510E bulb. With the bulb, I can turn it off, but when I attempt to turn it back on, I get the following error:

Failed to call service light/turn_on. Error Code: -1003, JSON formatting error

However, adjusting the brightness slider manually will switch the bulb back on, just not the actual 'ON' switch.

Any help would be much appreciated.
Thanks

Power measurement with P110

Tapo P110 as a switch is working for now. But I bought the sockets in order to integrate the power measurement into my HA. Is there any way to do so?

switch_steckdose1_watt: friendly_name_template: "{{ states.switch.steckdose1.name}} Leistung" value_template: '{{ states.switch.steckdose1.attributes["current_power_w"] | float }}' unit_of_measurement: 'W'

Above code with adapted name didnt work. Any idea?

[Bug] NameError: name 'ast' is not defined

Hey there! Thanks for fixing the previous error.
I'm testing it with a L530 bulb. Already setup the integration and I can switch it off, but when I try to switch on the light I got the following error:

[140323122419888] name 'ast' is not defined

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 185, in handle_call_service
    await hass.services.async_call(
  File "/usr/src/homeassistant/homeassistant/core.py", line 1495, in async_call
    task.result()
  File "/usr/src/homeassistant/homeassistant/core.py", line 1530, in _execute_service
    await handler.job.target(service_call)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 209, in handle_service
    await self.hass.helpers.service.entity_service_call(
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 663, in entity_service_call
    future.result()  # pop exception if have
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 896, in async_request_call
    await coro
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 700, in _handle_entity_call
    await result
  File "/usr/src/homeassistant/homeassistant/components/light/__init__.py", line 494, in async_handle_light_on_service
    await light.async_turn_on(**filter_turn_on_params(light, params))
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 948, in async_turn_on
    await self.hass.async_add_executor_job(ft.partial(self.turn_on, **kwargs))
  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/light.py", line 89, in turn_on
    self._l530.setBrightness(newBrightness)
  File "/usr/local/lib/python3.9/site-packages/PyP100/PyL530.py", line 38, in setBrightness
    if ast.literal_eval(decryptedResponse)["error_code"] != 0:
NameError: name 'ast' is not defined

I'm also trying to see if I can change color and other stuff, but didn't find anything yet. We'll keep searching arround!

Brightness Value only works up to 98%

When adjusting the brightness using the brightness value 0-100 the brightness is only set up to 98%.

To show this I changed the brightness in Home Assistant as shown below in the screenshot and then looked at the value in Google Home. If you put any value over 99 the light does not change brightness. Setting the brightness at 99 seems to still report 98 in Google Home.

image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.