petretiandrea / home-assistant-tapo-p100

A custom integration to control Tapo devices from home assistant.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Invalid authentication

petretiandrea opened this issue · comments

Version of the custom_component

Any

Describe the bug

A lot of people receive an "Invalid authentication" error message. Thanks to #120 and @mostlyvirtual, we have found an issue regarding username with capital letters. As reported by the user, in Tapo App settings is shown the email address, if this address contains capital letter, you probably receive "Invalid authentication" error from integration. In #120 they resolved by creating another account using an email all lower-case. In this way, the integration works.

So actually, only lower case E-mail works. I will investigate on this and fix asap

EDIT: Thanks to @rfnunes. When entering email, use the same case as seen in Tapo App.

My email address contains upper case letters and I was able to login after entering the email address case-sensitive, that is, using the exact same case as seen in the Tapo app. That worked for me as workaround and it's way more simple than creating another account.

I don't have any capital letters in my email address (only lower case, dot and numbers), but still I can't authorize with this component in my HomeAssistant.
I even changed my e-mail address, my username for camera and nothing works

@GrzegorzZajac000 Can you try to execute this snippet of code and report here the output?

import asyncio
from plugp100 import TapoApiClient


async def main():
    # create generic tapo api
    sw = TapoApiClient("<ip>", "<email>", "<passwd>")
    await sw.login()
    print(await sw.get_state())

loop = asyncio.get_event_loop()
loop.run_until_complete(main())
loop.run_until_complete(asyncio.sleep(0.1))
loop.close()

Hi there,
Not sure it helps, but maybe it will :-) I remember from I-don't-know-where, that the devices store the password when they first get added to the Tapo App. If you change your password later, it's still the initial one in the device!
Deleting/re-adding the devices in the app updates the password to the latest one.
Good luck!
Christophe

Hello,
Thanks for this integration.
I encounter an ''Invalid authentication'' (my email is all lower case).

I would like to use my Home Assistant (located in my house) to control a P100 switch (located in my office).
Does this integration work via cloud?
Or does it need to work in the same LAN?
Thank you,

Hello
I had an "Invalid Authentication" problem with version 1.2.8, but v1.2.4 works fine.
image

Thanks for your report, but as you can see here: v1.2.4...v1.2.8, there are no changes between the two version about authentication step. So retry the latest version and check if now works.

N.B. A user on home assistant community forum says that changing the password for tapo account will not refresh the password changed on the already associated devices until you remove and re-add the device from tapo app. @gpbicego @francesco-bonassi

Hello, Thanks for this integration. I encounter an ''Invalid authentication'' (my email is all lower case).

I would like to use my Home Assistant (located in my house) to control a P100 switch (located in my office). Does this integration work via cloud? Or does it need to work in the same LAN? Thank you,

For authentication issue, see the comment above. Regarding your question about "remote" control, this integration work on local polling, so you can't control it from an external home assistant instance. (Where external is intended as different network, like your office and home. So if you install home assistant on your home and the tapo is in your office, you can't control it. The only way is to install home assistant in your office and expose home assistant on "internet" and access to it from your home)

Thanks Andrea.
It would be useful to be able to manage this integration in Cloud Polling.
Thank's for your job

Auth issue as well - p/w and ID all lower case.

After further investigation it would add some devices, some failed. However, rebooting HA in-between adding it eventually allowed me to add all devices - weird, no idea.

This has stopped working for me too. In my case, after updating to HA 2022.3. Have tried removing and installing the integration, changing cam's user password, user and password...

No luck at all. Haven't seen logs about the error.

Any idea on what to try?

Why are you talking about cams? This integration doesn't support cameras

My bad, just got to the wrong repo.

Sorry!

Hello,

I've installed this in order to manage my L900. Today it stops working so I decided to remove the L900 and add it again.
I can't add the L900 back with the authentication error. (No capital in my email adress).
I removed the intergration, installed back and it works.

I'm seeing transient failure here too. My e-mail contains a +.

I tried reaching the device using the plugp100 package directly. When it wasn't working, I'd get:

aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host 192.168.1.153:80 ssl:default [Connect call failed ('191.168.1.153', 80)]

After a few retries, it starts working fine for both that client and the Home Assistant integration. Then 10 minutes later I'm getting unavailable data.

I am having the same problem. What is the value of the host field? Is this the IP address of home assistant or the Tapo device? I've tried both and in the error below am trying with the device.

image

This is in home-assistant.log:

aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host 192.168.1.53:80 ssl:default [Connect call failed ('192.168.1.53', 80)]

Ok it worked - didn't seem to like an upper case letter in the password. IP address was that of the device.

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@gmail.com
password: Password123”
Putting 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. 1”.
And i am using the home assistant core on ubuntu lastest version btw.
Thanks for the help.
image

I found that removing and re-adding my devices and auth started to work. I also noticed that the IP in the Tapo Mobile app assigned to a device was different to the actual IP the device had now. I could not use the IP that my DHCP server told me the device had, so I don't know if I was suffering from a stale password on the device or something else.

commented

Previously same problem.
Fixed using the last 1.2.12 version.

Configuration :

  • Home Assistant Core 2022.6.6 installed via docker method
  • home-assistant-tapo-p100 1.2.12 installed via "Manual way"
  • TAPO L530 in both 1.0 (with 1.2.2 firmware) and 2.0 (with 1.0.8 firmware)

What works:

  • after reloading the home assistant container, "Tapo Controller" is well recognized and seems functional (GUI loads)
    host: 192.168.x.x
    username: xxx@xxx.xxx (no special character, no uppercase)
    password: xxxx (no special constraint identified)

Thanks for this update and your great job!

Also I have found that similar to other sorts of devices such as Tuya, ensure that you do not have the app open on another device. That was my fix anyway.

commented

Hey guys, thanks for this integration, but I can't connect to a server, it takes a lot of time to request and then shows this error:
Config flow could not be loaded: undefined
Any suggestions?

In my case, I have 8 plugs under the same Tapo account. 5 added successfully. 3 get the invalid authentication. Obviously, the userid and password cannot be the issue as they work fine for the other 5. I have double checked the ip addresses I am entering and they are correct. All plugs are working fine in the Tapo app. I have in the past used the manual TP100 Control github to implement these plugs but have changed over entirely to this TAPO CONTROLLER integration now, so it is possible something is left over in the depths of HA for these plugs but nothing showing in the UI.

UPDATE

Removing and Re-adding these 3 to the Tapo app and ensuring I made no amendments to the name or any other aspect, meant that these could then be added to TAPO CONTROLLER although not first time for all. So a little confusing but currently working.

ANOTHER UPDATE BUT LESS POSITIVE

All 8 of my plugs were correctly showing in the Integration until I restarted Home Assistant (no integration updates, just some unrelated yaml changes).
Now, 5 have not connected in the integration. I have tried reloading but to no avail. The plugs are working in the Tapo app so the issue is in the Home Assistant integration. I did want to add 4 more plugs but these are failing too.
I had not changed any of the existing plugs in the app (editing did seem to be some form of issue before) so now am struggling to logically explain the reason why some work and some don't.

The logs are below (after a reload - same every time):

`Logger: homeassistant.config_entries
Source: config_entries.py:370
First occurred: 23:02:28 (18 occurrences)
Last logged: 23:32:36

Config entry 'Z-Wave JS' for zwave_js integration not ready yet: Cannot connect to host core-zwave-js:3000 ssl:default [Connect call failed ('172.30.33.2', 3000)]; Retrying in background
Config entry 'Tapo 5' for tapo integration not ready yet: None; Retrying in background
Config entry 'Tapo 1 - TV2' for tapo integration not ready yet: None; Retrying in background
Config entry 'Tapo 4' for tapo integration not ready yet: None; Retrying in background
Config entry 'Tapo 7 - TV1' for tapo integration not ready yet: None; Retrying in background`

Hey guys, thanks for this integration, but I can't connect to a server, it takes a lot of time to request and then shows this error:
Config flow could not be loaded: undefined
Any suggestions?

Pc os? Architecture?

commented

Hey guys, thanks for this integration, but I can't connect to a server, it takes a lot of time to request and then shows this error:
Config flow could not be loaded: undefined
Any suggestions?

Pc os? Architecture?

sorry iam a noob here, i just use this https://github.com/home-assistant/operating-system/releases/download/8.2/haos_rpi4-64-8.2.img.xz on raspberry pi, and its works fine after update hass os or core.
That's my hass info:
Version | core-2022.8.0.dev20220705
Installation Type | Home Assistant OS
Development | true
Supervisor | true
Docker | true
User | root
Virtual Environment | false
Python Version | 3.10.5
Operating System Family | Linux
Operating System Version | 5.15.32-v8
CPU Architecture | aarch64
Timezone | Africa/Cairo

can i add log details for ERROR here?
Thank u

Hi Guys, Thanks for this wonderful integration and I was using the Tapo P110 device with this integration for the last 3 months without any issues. But today evening I upgraded HA Core and Supervisor to 2022.7.0 but then I lost access to the device.

It's still accessible via the Tapo app but I could control it as it was the device was not available. Tapo Integration showed "Retiring setup: None". So I removed the existing installation and added it again.

But then after that, I am getting "Invalid Authentication", I couldn't pass this step and got stuck.

Now I tried everything it was suggested above,

  1. Removed the device and added it again to the existing email.
  2. Even though my email had lower cases, I created a new email id for the Tapo account and configured the device.
  3. Changed pwd to lower cases too and tried but no luck.
  4. Changed the device host IP to a different one.

I am not sure what else has gone wrong wiht this integration. All other integrations including TP-link add on is working fine.

Can someone please help with this issue?

Update:

After trying everything, I restored it back to Home Assistant Core: 2022.6.7 from 2022.7.0 and it just started working again without any modifications. Not sure what changes are breaking this integration.

Now my HA versions are,
Home Assistant Core: 2022.6.7
Home Assistant Supervisor: 2022.7.0

I am also having issues authenticating (obtaining "invalid credentials").

I tried to disable the error handing to see what was the actual exception, and I've got the following:

Traceback (most recent call last):
  File "/config/custom_components/tapo/config_flow.py", line 58, in async_step_user
    entry_metadata = await self._validate_input(user_input)
  File "/config/custom_components/tapo/config_flow.py", line 91, in _validate_input
    tapo_api = await self._test_credentials(
  File "/config/custom_components/tapo/config_flow.py", line 110, in _test_credentials
    await client.login()
  File "/usr/local/lib/python3.10/site-packages/plugp100/api.py", line 84, in login
    await self._handshake()
  File "/usr/local/lib/python3.10/site-packages/plugp100/api.py", line 157, in _handshake
    resp_dict = await response.json()
  File "/usr/local/lib/python3.10/site-packages/aiohttp/client_reqrep.py", line 1103, in json
    raise ContentTypeError(
aiohttp.client_exceptions.ContentTypeError: 0, message='Attempt to decode JSON with unexpected mimetype: text/html', url=URL('http://192.168.x.x/app')

It looks like something that should be handled in the library that calls the API

It looks like something that should be handled in the library that calls the API

I think its related to Issue#199 and Python 3.10 support not yet available for this integration on HA core 2022.7.x versions.

worked until issue#199. after this was resolved the invalid authentication issue popped up for me.

email is only lowercase letters
Home Assistant 2022.7.2
Supervisor 2022.07.0
Operating System 8.2
Frontend 20220707.0 - latest
Running in VM on proxmox

Readded the p100 plug to the app - no fix
redownloaded repo - no fix

same getting "Invalid authentication" error message
email-lowercase
Home Assistant 2022.7.2
Supervisor 2022.07.0
Operating System 8.2
Rpi4

look like P110 no problem adding. only the P100 getting error message

same getting "Invalid authentication" error message email-lowercase Home Assistant 2022.7.2 Supervisor 2022.07.0 Operating System 8.2 Rpi4

look like P110 no problem adding. only the P100 getting error message

Same problem here. P110 all good, P100 invalid authentication.

Same authentication issue for me on Raspberry Pi 4 -
Home Assistant 2022.7.2
Supervisor 2022.07.0
Operating System 8.2
Frontend 20220707.0 - latest
Tapo Controller v1.2.13

@petretiandrea this is possibly a different issue as my email has no capital letters, also everything had worked fine until update to v1.2.13 and 2022.7.2

Hi there, same issue here. No capital letters in email. Everything worked fine until recent upgrade for supporting HA v7.0. Both topics referred to each other but I could not manage to solve auth error problem.

Solved After different tests I managed to add my tapo p100 back in HA. First I remove n add in tapo add without success in adding back in HA. Same auth error! Then, I changed my tapo app password. remove device in tapo app and add it back. Finally, could add the device back in HA. Hope helps people with the same issue.

Hi there, same issue here. No capital letters in email. Everything worked fine until recent upgrade for supporting HA v7.0. Both topics referred to each other but I could not manage to solve auth error problem.

Solved After different tests I managed to add my tapo p100 back in HA. First I remove n add in tapo add without success in adding back in HA. Same auth error! Then, I changed my tapo app password. remove device in tapo app and add it back. Finally, could add the device back in HA. Hope helps people with the same issue.

Thank you! It worked. I managed to get things working too, by changing the password not to include capital letters and re-adding all devices in the Tapp app.

For me, nothing worked. Only Tapo P110 works, Tapo 100 doesn't (tried to change password, remove and add tapo in tapo app).

Tried the suggestion of changing the password and readding the plugs to the Tapo app, still not working.

I am also having issues authenticating (obtaining "invalid credentials").

I tried to disable the error handing to see what was the actual exception, and I've got the following:

Traceback (most recent call last):
  File "/config/custom_components/tapo/config_flow.py", line 58, in async_step_user
    entry_metadata = await self._validate_input(user_input)
  File "/config/custom_components/tapo/config_flow.py", line 91, in _validate_input
    tapo_api = await self._test_credentials(
  File "/config/custom_components/tapo/config_flow.py", line 110, in _test_credentials
    await client.login()
  File "/usr/local/lib/python3.10/site-packages/plugp100/api.py", line 84, in login
    await self._handshake()
  File "/usr/local/lib/python3.10/site-packages/plugp100/api.py", line 157, in _handshake
    resp_dict = await response.json()
  File "/usr/local/lib/python3.10/site-packages/aiohttp/client_reqrep.py", line 1103, in json
    raise ContentTypeError(
aiohttp.client_exceptions.ContentTypeError: 0, message='Attempt to decode JSON with unexpected mimetype: text/html', url=URL('http://192.168.x.x/app')

It looks like something that should be handled in the library that calls the API

version of plugp100?

Mine is:
Tapo P100
Hardware version: 1.20.0
Firmware version: 1.4.10 Build 20211104 Rel. 35882

+1, change the password (no caps, 8 digit long) and email (no underscore) always invalid

Plugs P100

1.2.13

Home Assistant 2022.7.3
Supervisor 2022.07.0
Operating System 8.2
Frontend 20220707.0 - latest

Mine is: Tapo P100 Hardware version: 1.20.0 Firmware version: 1.4.10 Build 20211104 Rel. 35882

I mean version of plugp100 library, is 2.1.17? Or alternatively, is integration version 1.2.13?

Mine is: Tapo P100 Hardware version: 1.20.0 Firmware version: 1.4.10 Build 20211104 Rel. 35882

I mean version of plugp100 library, is 2.1.17? Or alternatively, is integration version 1.2.13?

Yes, its 1.2.13

Mine is: Tapo P100 Hardware version: 1.20.0 Firmware version: 1.4.10 Build 20211104 Rel. 35882

I mean version of plugp100 library, is 2.1.17? Or alternatively, is integration version 1.2.13?

Yes, its 1.2.13

same here 1.2.13

Mine is: Tapo P100 Hardware version: 1.20.0 Firmware version: 1.4.10 Build 20211104 Rel. 35882

I mean version of plugp100 library, is 2.1.17? Or alternatively, is integration version 1.2.13?

Yes, its 1.2.13

same here 1.2.13

Idem. Also attempted the above mentioned solution. No joy.

By using this script here https://github.com/petretiandrea/plugp100 you can turn on device?

even tried 1.2.13 with Home Assistant Core 2022.6.7 no luck, and all lowercase Password

Same issue here, only thing to add is my plugs are ok but the bulb shows the invalid auth. Tried with email and password all lower case, same issue

Same issue here, only thing to add is my plugs are ok but the bulb shows the invalid auth. Tried with email and password all lower case, same issue

I think that this problem is related only to Tapo Device configuration, which in some way is not "synced" with your cloud username/password. If plug works, there is no reason that break bulbs (in terms of my library). Please guys, reports a log, without it, I can't help

Having the same issues:

  • Removed devices (P100) from tapo app
  • Reset password (8 chars - lowercase & numbers only)
  • Re-added devices
  • Removed integration from HA
  • Restarted HA
  • Installed HACS repo
  • Restarted HA
  • Located Tapo_Controller integration in HA
  • Entered ip address as shown in tapo app (matches on router config)
  • Entered email (all lowercase - matches tapo app)
  • Entered new password

component version 1.2.13
HA Core version 2022.7.3

  • "Invalid Authentication"

Having the same issues:

  • Removed devices (P100) from tapo app
  • Reset password (8 chars - lowercase & numbers only)
  • Re-added devices
  • Removed integration from HA
  • Restarted HA
  • Installed HACS repo
  • Restarted HA
  • Located Tapo_Controller integration in HA
  • Entered ip address as shown in tapo app (matches on router config)
  • Entered email (all lowercase - matches tapo app)
  • Entered new password

component version 1.2.13 HA Core version 2022.7.3

  • "Invalid Authentication"

logs?

Having the same issues:

  • Removed devices (P100) from tapo app
  • Reset password (8 chars - lowercase & numbers only)
  • Re-added devices
  • Removed integration from HA
  • Restarted HA
  • Installed HACS repo
  • Restarted HA
  • Located Tapo_Controller integration in HA
  • Entered ip address as shown in tapo app (matches on router config)
  • Entered email (all lowercase - matches tapo app)
  • Entered new password

component version 1.2.13 HA Core version 2022.7.3

  • "Invalid Authentication"

logs?

When I attempt to add and get the "Invalid Authentication" message I don't get anything in the logs

Same issue here, only thing to add is my plugs are ok but the bulb shows the invalid auth. Tried with email and password all lower case, same issue

I think that this problem is related only to Tapo Device configuration, which in some way is not "synced" with your cloud username/password. If plug works, there is no reason that break bulbs (in terms of my library). Please guys, reports a log, without it, I can't help

Because the device is not added, there isn't much to see in logs

_```
This error originated from a custom integration.

Logger: custom_components.tapo.common_setup
Source: helpers/update_coordinator.py:237
Integration: tapo_p100 (documentation, issues)
First occurred: 10:26:05 AM (1 occurrences)
Last logged: 10:26:05 AM

Error fetching tapo data:

I tried removing all devices (2 plugs (P100) and 1 bulb (L150)) and the first bulb added fine, the next one gives me this:

Unexpected exception
Traceback (most recent call last):
File "/config/custom_components/tapo/config_flow.py", line 57, in async_step_user
entry_metadata = await self._validate_input(user_input)
File "/config/custom_components/tapo/config_flow.py", line 94, in _validate_input
state = await tapo_api.get_state()
File "/usr/local/lib/python3.10/site-packages/plugp100/api.py", line 89, in get_state
state=await self.get_state_as_dict(),
File "/usr/local/lib/python3.10/site-packages/plugp100/api.py", line 213, in get_state_as_dict
return await self._execute_method_request(device_info_method)
File "/usr/local/lib/python3.10/site-packages/plugp100/api.py", line 233, in _execute_method_request
response = await self.http.async_make_post_cookie(f"{self.url}?token={self.token}", request_body,
File "/usr/local/lib/python3.10/site-packages/plugp100/core/http_client.py", line 19, in async_make_post_cookie
async with self.session.post(url, json=json, cookies=cookie) as response:
File "/usr/local/lib/python3.10/site-packages/aiohttp/client.py", line 1138, in aenter
self._resp = await self._coro
File "/usr/local/lib/python3.10/site-packages/aiohttp/client.py", line 559, in _request
await resp.start(conn)
File "/usr/local/lib/python3.10/site-packages/aiohttp/client_reqrep.py", line 898, in start
message, payload = await protocol.read() # type: ignore[union-attr]
File "/usr/local/lib/python3.10/site-packages/aiohttp/streams.py", line 616, in read
await self._waiter
aiohttp.client_exceptions.ClientOSError: [Errno 104] Connection reset by peer

I get an unexpected error when adding that and an auth error when adding the bulb. Only thing I could see as different between the bulbs in the last octet of the IP address was 2 digits for the device that adds ok and 3 for the other plug and the bulb

I tried removing all devices (2 plugs (P100) and 1 bulb (L150)) and the first bulb added fine, the next one gives me this:

Unexpected exception
Traceback (most recent call last):
File "/config/custom_components/tapo/config_flow.py", line 57, in async_step_user
entry_metadata = await self._validate_input(user_input)
File "/config/custom_components/tapo/config_flow.py", line 94, in _validate_input
state = await tapo_api.get_state()
File "/usr/local/lib/python3.10/site-packages/plugp100/api.py", line 89, in get_state
state=await self.get_state_as_dict(),
File "/usr/local/lib/python3.10/site-packages/plugp100/api.py", line 213, in get_state_as_dict
return await self._execute_method_request(device_info_method)
File "/usr/local/lib/python3.10/site-packages/plugp100/api.py", line 233, in _execute_method_request
response = await self.http.async_make_post_cookie(f"{self.url}?token={self.token}", request_body,
File "/usr/local/lib/python3.10/site-packages/plugp100/core/http_client.py", line 19, in async_make_post_cookie
async with self.session.post(url, json=json, cookies=cookie) as response:
File "/usr/local/lib/python3.10/site-packages/aiohttp/client.py", line 1138, in aenter
self._resp = await self._coro
File "/usr/local/lib/python3.10/site-packages/aiohttp/client.py", line 559, in _request
await resp.start(conn)
File "/usr/local/lib/python3.10/site-packages/aiohttp/client_reqrep.py", line 898, in start
message, payload = await protocol.read() # type: ignore[union-attr]
File "/usr/local/lib/python3.10/site-packages/aiohttp/streams.py", line 616, in read
await self._waiter
aiohttp.client_exceptions.ClientOSError: [Errno 104] Connection reset by peer

I get an unexpected error when adding that and an auth error when adding the bulb. Only thing I could see as different between the bulbs in the last octet of the IP address was 2 digits for the device that adds ok and 3 for the other plug and the bulb

Even UI shows invalid authentication, the logs suggest another type of error, likes device is not responding. Have you set static ip for your device?

Tried making it static, changing it to something other than the original IP and removing it from Tapo app and re-adding. The other plug has added ok now (that has a 3 digit last octet and only DHCP). Still getting the same error on the bulb

Tried making it static, changing it to something other than the original IP and removing it from Tapo app and re-adding. The other plug has added ok now (that has a 3 digit last octet and only DHCP). Still getting the same error on the bulb

Stupid question: where you take the ip of device? From tapo app or from router page? Can you ping the devices with right ip?

Tried making it static, changing it to something other than the original IP and removing it from Tapo app and re-adding. The other plug has added ok now (that has a 3 digit last octet and only DHCP). Still getting the same error on the bulb

Stupid question: where you take the ip of device? From tapo app or from router page? Can you ping the devices with right ip?

Since I have identical results I can answer as well. Tapo app, router same info. Ping positive return. The IP address used does definitely point to the plug.

Tried making it static, changing it to something other than the original IP and removing it from Tapo app and re-adding. The other plug has added ok now (that has a 3 digit last octet and only DHCP). Still getting the same error on the bulb

Stupid question: where you take the ip of device? From tapo app or from router page? Can you ping the devices with right ip?

Since I have identical results I can answer as well. Tapo app, router same info. Ping positive return. The IP address used does definitely point to the plug.

Yep same for me. Ping is ok and app and router agree on the IP

Ok, firmware info and hardware version of tapo? You take a screenshot from tapo app

Ok, firmware info and hardware version of tapo? You take a screenshot from tapo app

image

Same problem here with two P100 plugs, static IPs, respond to ping
scr
.

I thought to be clever for the time being and ad my 1 plug to Alexa and expose a input boolean from home assistant as well. Like that theoretically, with a routine for on and a routine for off, I should be able to switch the plug. Theory is sound, it works.... For a few minutes.

Now Alexa is incapable or reaching the plug. Re-adding doesn't work. Plug not found.

I have no clue if this is related, and if so how. But it might be worth to share here.

Please read this #206 (comment)

Maybe it can help someone.
Password with upper case and special characters does not work.
Password without upper case and special characters does not work.
Password without upper case and without special characters works.
I didn't have to remove and add devices from the tapo app.

I don’t know what is failling but in the same account i have tapo P110 and is working…

Maybe it can help someone. Password with upper case and special characters does not work. Password without upper case and special characters does not work. Password without upper case and without special characters works. I didn't have to remove and add devices from the tapo app.

Tried that, my plugs work but still not the bulb

Maybe it can help someone.
Password with upper case and special characters does not work.
Password without upper case and special characters does not work.
Password without upper case and without special characters works.
I didn't have to remove and add devices from the tapo app.

O don’t know how you change password without special characters. When I try to change it, I get an error saying it's mandatory.
Also, it was the password I had before and it worked. Now only the P110 works the P100, don’t.

I seem to have tried all options and my p100's are still failing to authenticate; nothing of consequence in the logs. Something to note is that the integration doesn't load and doesn't appear to retry.
Latest version of HA & TAPO integration.
I've also tried restoring from a previous full backup but that appears not to make any difference and my p100's remain unavailable.

Since update to Home Assistant 2022.7, no P100s are available in Tapo Controller.

`Logger: homeassistant.config_entries
Source: config_entries.py:384
First occurred: 21:56:27 (14 occurrences)
Last logged: 22:07:38

Config entry 'Tapo 8' for tapo integration not ready yet: None; Retrying in background
Config entry 'Tapo 2 - Wholehome' for tapo integration not ready yet: None; Retrying in background
Config entry 'Tapo 4' for tapo integration not ready yet: None; Retrying in background
Config entry 'Pantry KL110(EU)' for tplink integration not ready yet: Unable to connect to the device: 192.168.1.74: [Errno 113] Connect call failed ('192.168.1.74', 9999); Retrying in background
Config entry 'Tapo 6 - Network hub' for tapo integration not ready yet: None; Retrying in background`

SmartSelect_20220712-223545_Tapo

The issue is related to hardware 2.0 versio. There Is another issue alredy opened about this.

I have been having the same issue since updating to Home Assistant 2022.7 - Failed Authentication.

However, my P100s started working immediately after updating Tapo Controller to version 1.2.14 (was on 1.2.13 before). Also, I have the following Hardware and Firmware versions for 2 P100 plugs:

Hardware Version - 1.20.0
Firmware Version - 1.4.10 Build 20211104 Rel. 35882

@petretiandrea - Thanks for sorting it out (at least for me)!

@petretiandrea - Thanks for the update! The authentication issue is now gone and both my p100 plugs are working

@SkoobyDu

#209

As described in the above (now closed) issue a number of people have resolved their problem with an update to the latest version of Tapo Controller.

I'm pretty sure I'd contributed to this thread saying I had the same problem but I can't find it now.

Whatever, this new update of the integration 1.12.14 has corrected the issue and I added my L530 light first time :-)

Thanks

I'm pretty sure I'd contributed to this thread saying I had the same problem but I can't find it now.

Whatever, this new update of the integration 1.12.14 has corrected the issue and I added my L530 light first time :-)

Thanks

Yes, same here. The new update allowed my bulb to add first time after updating. Thanks @petretiandrea

SmartSelect_20220712-223545_Tapo

The issue is related to hardware 2.0 versio. There Is another issue alredy opened about this.

Can you tell me the issue number please

Just very quick post as I was having a similar issue. Don't have time to read whole thread but have search 2FA and Two Fac... with no result. I don't suppose your TP-Link Cloud accounts have 2FA enabled, as reluctantly removing this was the solution here and thought this might help someone if not covered already?

TapoP110 in use here (Firmware 1.0.7).
IP is static (192.168.0.218)
reset user & password -> still "Invalid auth"

What am I doing wrong here?

PS: My email adress was all lowercase.

This has stopped working for me too. In my case, after updating to HA 2022.3. Have tried removing and installing the integration, changing cam's user password, user and password...
No luck at all. Haven't seen logs about the error.
Any idea on what to try?

Why are you talking about cams? This integration doesn't support cameras

Well the Cam like the C200 use the same application and I am assuming the same password? For example I am able to connect and integrate the C200 camera with the same username (first side of the e-mail) and password but no the two smart plugs P100 and P110.

This has stopped working for me too. In my case, after updating to HA 2022.3. Have tried removing and installing the integration, changing cam's user password, user and password...
No luck at all. Haven't seen logs about the error.
Any idea on what to try?

Why are you talking about cams? This integration doesn't support cameras

Well the Cam like the C200 use the same application and I am assuming the same password? For example I am able to connect and integrate the C200 camera with the same username (first side of the e-mail) and password but no the two smart plugs P100 and P110.

No, finally I integrate the Tapo P110 using the email and the new password. One thing I did, was to reinstall one of the device and the system finally accepted the new password. Funny enough the Tapo integration recognized the P110 while actually I just reinstalled only the P100. I will try to do the same with the P110 and see if it will work for P100.

Confirmed...

I removed both my plugs in the app, and readded them, then I could connect to them via HA...

I had an issue with authentication, too. it was because my password had more than 8 charackters. setting it to a password with the length of 8 charackter fixed it.

I solved the problem..there was a space after the email I deleted it and the problem was solved

import asyncio
from plugp100 import TapoApiClient


async def main():
    # create generic tapo api
    sw = TapoApiClient("<ip>", "<email>", "<passwd>")
    await sw.login()
    print(await sw.get_state())

loop = asyncio.get_event_loop()
loop.run_until_complete(main())
loop.run_until_complete(asyncio.sleep(0.1))
loop.close()

Invalid authentication issues here - plus I get nothing from the above script (substituting my IP, use & pass)
If I run it from HA's terminal I get:
zsh: parse error near `)'
/ import asyncio
from plugp100 import TapoApiClient

If I run it as a bash script I get:
/ bash /config/tplink.sh
/config/tplink.sh: line 3: import: command not found
/config/tplink.sh: line 4: from: command not found
/config/tplink.sh: line 7: syntax error near unexpected token (' /config/tplink.sh: line 7: async def main():'

@martindell that’s Python code.

Hello, Thanks for taking the time to write this integration.
I also have the invalid authentication.
my email address is word.word1234@emailcompany.com
my password is 23 characters long only comprising of [a-z] (lower case only) and [0-9], no spaces, upper case or special characters.
Sorry but I can't find the tapo p-100 version but it "should" be the latest.
Running on a Raspberry Pi
Home Assistant 2022.8.7
Supervisor 2022.08.5
Operating System 8.5
Frontend 20220802.0 - latest

The Tapo P110 is hardware version 1.0
Firmware 1.0.11 Build 210926 Rel 155241

Is there any other information that you need?

As an experiment I tried removing the plug from the mobile phone app and then adding it into Home Assistant. This doesn't work as it resets the Tapo P110 and you need to reconfigure the WiFi connection on the plug. So need to keep the plug connected to the mobile phone app.

Note that I had a Firewall between HA & the P100, and it would give auth failed.
Maybe the error message could point out when the Tcp socket can't connect?
Note 2: What ports is it using? (I didn't tcpdump it yet :)
tx!

hello again.
migube, I'm not sure if you making a comment to me, but my HA and P110 are on the same network segment, which is a dedicated IoT segment.
But you do raise something, as my firewall is only permitting the P110 to access two IP addresses.
54.72.86.3 from "https://community.home-assistant.io/t/tp-link-tapo-p110-energy-monitoring-not-possible-without-cloud-access/388688"
52.221.133.55 "from wireshark"
I'm not sure if this could have an impact.

I have also tried reducing the password length with out success.
I have removed the P110 from the app, reset my password to 8 characters in length, using lower & uppercase, numbers and basic special characters. re-added the P110 to the app and then tried to add the integration in HA. Same result "Invalid authentication"

I am seeing the authentication error as well, and may be able to shed a bit more light on it. I do not have an capital letters etc.
I run home assistant in a python virtual environment.

I have two versions of hass, a development machine and a produiction machine.

On the development machine, the integration is working perfectly for a P110 plug.
Great stuff.

On the production machine I see the authentication error.

I've run the @martindell python code on my production linux box - it works fine.
HOWEVER, if I run the python code in the VENV that hass is running in I get an error...

Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.9/site-packages/Crypto/PublicKey/RSA.py", line 121, in __getattr__
    return int(self._key[attrname])
KeyError: 'export_key'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/pi/tapo.py", line 13, in <module>
    loop.run_until_complete(main())
  File "/usr/local/lib/python3.9/asyncio/base_events.py", line 642, in run_until_complete
    return future.result()
  File "/home/pi/tapo.py", line 9, in main
    await sw.login()
  File "/srv/homeassistant/lib/python3.9/site-packages/plugp100/api.py", line 84, in login
    await self._handshake()
  File "/srv/homeassistant/lib/python3.9/site-packages/plugp100/api.py", line 145, in _handshake
    self.__generate_keypair()
  File "/srv/homeassistant/lib/python3.9/site-packages/plugp100/api.py", line 250, in __generate_keypair
    self.key_pair = self.encryption.generate_key_pair()
  File "/srv/homeassistant/lib/python3.9/site-packages/plugp100/core/encryption.py", line 19, in generate_key_pair
    private_key = key.export_key(pkcs=8, format="DER")
  File "/srv/homeassistant/lib/python3.9/site-packages/Crypto/PublicKey/RSA.py", line 123, in __getattr__
    raise AttributeError(attrname)
AttributeError: export_key
Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0xb5268598>

So, my assertion is it is an issue with dependancies and the incorrect python modules being loaded in the hass environment.

So far I've not had any luck in finding out which...

Hi, just to add.
Brand new install, no uppercase on either password or email and getting invalid authentication as well.

Only testing on one p100 plug with firmware version 1.0.5 build 210615 rel 135441

Hass is version:.(running on Raspberry PI 4 (4GB))
Home Assistant 2022.9.0
Supervisor 2022.08.5
Operating System 8.5
Frontend 20220907.0 - latest

I have tried adding with GUI and config.yaml neither work.

In my case, I have solved the issue.
in my Python venv I ran...

pip3 -m pycryptodome -U

In theory it should not be needed. as HA should resolve the dependencies. However I have seen before with other integration, it does not always update to the latest version (I had an old version installed).

This may not be the cause of everyones issue, but it worked for me.

In my case, I have solved the issue. in my Python venv I ran...

pip3 -m pycryptodome -U

In theory it should not be needed. as HA should resolve the dependencies. However I have seen before with other integration, it does not always update to the latest version (I had an old version installed).

This may not be the cause of everyones issue, but it worked for me.

Colin, for a complete noob at all of this, would you be able to provide some instructions on how to do this (assume no prior knowledge as I have little!). I can then try and feedback to see if this resolves my issue.
I am on a RaspberryPi if that makes any difference running:Home Assistant 2022.9.1
Supervisor 2022.08.6
Operating System 8.5
Frontend 20220907.0 - latest

@robuk123, sorry not sure. I am running HA core, in a Python Venv. Whereas I think you are running the Supervisor version, which runs HA under Docker.
If you can login to the Docker image and get a shell, then the pip3 command may work in the shell.

Been trying to setup my L530 bulb and still getting this error. Email & password are all lowercase and host as device IP address. Not sure where it's going wrong

commented

I was also able to resolve this by changing my password. The password that caused the authentication error was Z9LfEe2n3,P.L,j - I changed to a new password with only lowercase/numbers and was able to authenticate

I was also able to resolve this by changing my password. The password that caused the authentication error was Z9LfEe2n3,P.L,j - I changed to a new password with only lowercase/numbers and was able to authenticate

Sam for me, I solved the problem changing the password and using just lower case lettere and numbers. Also I had to reinitialized the devices (two plugs)