home-assistant-tapo-p100 icon indicating copy to clipboard operation
home-assistant-tapo-p100 copied to clipboard

Invalid authentication

Open petretiandrea opened this issue 3 years ago • 99 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.

petretiandrea avatar Jan 25 '22 08:01 petretiandrea

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.

rfnunes avatar Feb 02 '22 15:02 rfnunes

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 avatar Feb 04 '22 16:02 GrzegorzZajac000

@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()

petretiandrea avatar Feb 10 '22 08:02 petretiandrea

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

chconil avatar Feb 16 '22 09:02 chconil

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,

francesco-bonassi avatar Feb 21 '22 18:02 francesco-bonassi

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

gpbicego avatar Feb 22 '22 11:02 gpbicego

Thanks for your report, but as you can see here: https://github.com/petretiandrea/home-assistant-tapo-p100/compare/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

petretiandrea avatar Feb 22 '22 15:02 petretiandrea

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)

petretiandrea avatar Feb 22 '22 15:02 petretiandrea

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

francesco-bonassi avatar Feb 27 '22 10:02 francesco-bonassi

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

geidorei avatar Mar 05 '22 12:03 geidorei

Check if there are extra blank spaces before or after the e-mail address. I've found that android's keyboard adds a extra blank spaces at the end when inserting from auto-complete.

Maybe the integration could trim the e-mail string before attempting to authenticate.

rfnunes avatar Mar 05 '22 13:03 rfnunes

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.

geidorei avatar Mar 06 '22 12:03 geidorei

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

petretiandrea avatar Mar 07 '22 20:03 petretiandrea

My bad, just got to the wrong repo.

Sorry!

luixal avatar Mar 07 '22 23:03 luixal

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.

vindbrann avatar Mar 22 '22 15:03 vindbrann

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.

dannycjones avatar May 03 '22 18:05 dannycjones

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)]

chrisuk-web avatar May 04 '22 14:05 chrisuk-web

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

chrisuk-web avatar May 04 '22 17:05 chrisuk-web

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 protected] 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

josecarlospaulo avatar May 17 '22 09:05 josecarlospaulo

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.

richard-scott avatar Jun 07 '22 12:06 richard-scott

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: [email protected] (no special character, no uppercase) password: xxxx (no special constraint identified)

Thanks for this update and your great job!

viba1 avatar Jun 17 '22 18:06 viba1

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.

jackielegs98 avatar Jun 25 '22 03:06 jackielegs98

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?

Hobiano avatar Jun 26 '22 04:06 Hobiano

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`

stain3565 avatar Jun 27 '22 12:06 stain3565

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?

petretiandrea avatar Jun 30 '22 17:06 petretiandrea

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

Hobiano avatar Jul 05 '22 16:07 Hobiano

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

nithikalisamy avatar Jul 07 '22 14:07 nithikalisamy

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

aialenti avatar Jul 08 '22 23:07 aialenti

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.

nithikalisamy avatar Jul 09 '22 00:07 nithikalisamy

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

VictoriousCupid avatar Jul 09 '22 15:07 VictoriousCupid