petretiandrea / home-assistant-tapo-p100

A custom integration to control Tapo devices from home assistant.
MIT License
818 stars 102 forks source link

P100 Plug 1.20.0 HW does not work with 2022.7.x 'Auth fail' #209

Closed neildsb closed 2 years ago

neildsb commented 2 years ago

Plug P100 work with 2022.6.7 & v1.2.12, but not 2022.7.x & v1.2.12

image

'Auth fails' when trying to add a new device in the UI (not via YAML), - password 8 characters all lowercase alpha numeric

image

petretiandrea commented 2 years ago

Plug P100 work with 2022.6.7 & v1.2.12, but not 2022.7.x & v1.2.12

image

'Auth fails' when trying to add a new device, - password 8 characters al lowercase alpha numeric

Plug P100 work with 2022.6.7 & v1.2.12, but not 2022.7.x & v1.2.12

image

'Auth fails' when trying to add a new device, - password 8 characters al lowercase alpha numeric

Please be more detailed, as I say, report a screen of tapo app where there is hardware and firmware version and report the logs of home assistant when you receive the error. If you are configuring it via configuration.yml report the configuration too

TEMPLATER1 commented 2 years ago

The integration does not work through the UI. When trying to add a new device, the error "Invalid authentication" pops up, but there are no errors in the logs. On version HA=2022.6.7 and Tapo Control=1.2.12 everything works.

image

photo_2022-07-11_18-57-09

2022-07-11 14:05:03 DEBUG (MainThread) [custom_components.tapo.common_setup] Finished fetching tapo data in 0.726 seconds (success: False) 2022-07-11 14:17:15 WARNING (MainThread) [homeassistant.config_entries] Config entry 'Свет на балконе' for tapo integration not ready yet: None; Retrying in background

TEMPLATER1 commented 2 years ago

I tried to add a tapo p100 device via YAML and got the following error in the logs

config

2022-07-11 14:17:16 ERROR (MainThread) [homeassistant.components.switch] Error while setting up tapo platform for switch Traceback (most recent call last): File "/config/custom_components/tapo/common_setup.py", line 96, in _update_with_fallback return await self.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 225, in _execute_method_request dim_encrypted = self.tp_link_cipher.encrypt(jsons.dumps(method)) AttributeError: 'NoneType' object has no attribute 'encrypt'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/config/custom_components/tapo/common_setup.py", line 90, in _async_update_data return await self._update_with_fallback() File "/config/custom_components/tapo/common_setup.py", line 99, in _update_with_fallback await self.api.login() File "/usr/local/lib/python3.10/site-packages/plugp100/api.py", line 85, in login await self._login_request(self.username, self.password) File "/usr/local/lib/python3.10/site-packages/plugp100/api.py", line 209, in _login_request self.token = decrypted_inner_response['result']['token'] KeyError: 'result'

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 205, in _async_refresh self.data = await self._async_update_data() File "/config/custom_components/tapo/common_setup.py", line 92, in _async_update_data raise UpdateFailed() from exception homeassistant.helpers.update_coordinator.UpdateFailed

The above exception was the direct cause of the following exception:

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 "/config/custom_components/tapo/switch.py", line 28, in async_setup_platform coordinator = await setup_tapo_coordinator_from_dictionary(hass, config) File "/config/custom_components/tapo/common_setup.py", line 31, in setup_tapo_coordinator_from_dictionary return await setup_tapo_coordinator( File "/config/custom_components/tapo/common_setup.py", line 57, in setup_tapo_coordinator await coordinator.async_config_entry_first_refresh() File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 178, in async_config_entry_first_refresh raise ex homeassistant.exceptions.ConfigEntryNotReady

TEMPLATER1 commented 2 years ago

I tried to remove the tapo integration from hacs completely and reinstall it, but it had no effect. The logs still show the same error as I showed above, and when adding a device via UI, the error: "Invalid authentication".

Fernien commented 2 years ago

does your email contain capital letters?

TEMPLATER1 commented 2 years ago

does your email contain capital letters?

does your email contain capital letters?

no

Aljosha89 commented 2 years ago

Me too with 1.20 hardware and firmware 1.4.10. I do not have capital letters in mail or password. Before update everything was working, I tried several time to change password, remove plug and add it back.

Every time I receive error Invalid authentication.

TwoPlayer commented 2 years ago

I had the same problem with a P100 on HA 2022.7.3, Tapo Controller 1.2.13, Hardware 1.20.0 and Firmware 1.4.10. I fixed it, when i changed the capital letters in the password and removed all symbols from the password, so only letters and numbers.

petretiandrea commented 2 years ago

I think that invalid auth is a problem related to an inconsistency of tapo device. So changing password or email triggers a sort of re-sync and re-establish the consistency (I hope)

petretiandrea commented 2 years ago

I had the same problem with a P100 on HA 2022.7.3, Tapo Controller 1.2.13, Hardware 1.20.0 and Firmware 1.4.10. I fixed it, when i changed the capital letters in the password and removed all symbols from the password, so only letters and numbers.

So with the hardware 1.20.0 is working?

neildsb commented 2 years ago

I had the same problem with a P100 on HA 2022.7.3, Tapo Controller 1.2.13, Hardware 1.20.0 and Firmware 1.4.10. I fixed it, when i changed the capital letters in the password and removed all symbols from the password, so only letters and numbers.

So with the hardware 1.20.0 is working?

no, i have changed the Password and Email, no luck

petretiandrea commented 2 years ago

I had the same problem with a P100 on HA 2022.7.3, Tapo Controller 1.2.13, Hardware 1.20.0 and Firmware 1.4.10. I fixed it, when i changed the capital letters in the password and removed all symbols from the password, so only letters and numbers.

So with the hardware 1.20.0 is working?

no, i have changed the Password and Email, no luck

I asked @TwoPlayer.

I had the same problem with a P100 on HA 2022.7.3, Tapo Controller 1.2.13, Hardware 1.20.0 and Firmware 1.4.10. I fixed it, when i changed the capital letters in the password and removed all symbols from the password, so only letters and numbers.

So with the hardware 1.20.0 is working?

Yeah, after changing the password it worked. This is my P100 DEDD1662-81C3-4F18-BDE2-490FAAD0EB99

For the first connection I enabled internet for the switch, after this, I blocked it again in my router. Don‘t know if this is relevant

This confirm that is not a problem related to library itself (I think) which version of python are you using?

For the first connection I enabled internet for the switch, after this, I blocked it again in my router. Don‘t know if this is relevant

Yes this is absolutely relevant, the tapo device must be connected to internet even the integration use LAN. Cause there are synchronization mechanism between tapo cloud and device.

petretiandrea commented 2 years ago

I had the same problem with a P100 on HA 2022.7.3, Tapo Controller 1.2.13, Hardware 1.20.0 and Firmware 1.4.10. I fixed it, when i changed the capital letters in the password and removed all symbols from the password, so only letters and numbers.

So with the hardware 1.20.0 is working?

no, i have changed the Password and Email, no luck

Can you run this? python3 -c "import packaging.tags; print(list(packaging.tags.sys_tags()))"

if packaging not found, install it with pip install packaging

neildsb commented 2 years ago

I had the same problem with a P100 on HA 2022.7.3, Tapo Controller 1.2.13, Hardware 1.20.0 and Firmware 1.4.10. I fixed it, when i changed the capital letters in the password and removed all symbols from the password, so only letters and numbers.

So with the hardware 1.20.0 is working?

no, i have changed the Password and Email, no luck

I asked @TwoPlayer.

I had the same problem with a P100 on HA 2022.7.3, Tapo Controller 1.2.13, Hardware 1.20.0 and Firmware 1.4.10. I fixed it, when i changed the capital letters in the password and removed all symbols from the password, so only letters and numbers.

So with the hardware 1.20.0 is working?

Yeah, after changing the password it worked. This is my P100 DEDD1662-81C3-4F18-BDE2-490FAAD0EB99 For the first connection I enabled internet for the switch, after this, I blocked it again in my router. Don‘t know if this is relevant

This confirm that is not a problem related to library itself (I think) which version of python are you using?

I have blocked my switches from the internet as I have some kasa plugs that are useless in HA, will try tomorrow, thanks

petretiandrea commented 2 years ago

Ok guys, Internet must be enabled even the integration use it through LAN. There is synchronization mechanism between tapo cloud and tapo device (like authentication info)

TwoPlayer commented 2 years ago

I had the same problem with a P100 on HA 2022.7.3, Tapo Controller 1.2.13, Hardware 1.20.0 and Firmware 1.4.10. I fixed it, when i changed the capital letters in the password and removed all symbols from the password, so only letters and numbers.

So with the hardware 1.20.0 is working?

no, i have changed the Password and Email, no luck

I asked @TwoPlayer.

I had the same problem with a P100 on HA 2022.7.3, Tapo Controller 1.2.13, Hardware 1.20.0 and Firmware 1.4.10. I fixed it, when i changed the capital letters in the password and removed all symbols from the password, so only letters and numbers.

So with the hardware 1.20.0 is working?

Yeah, after changing the password it worked. This is my P100 DEDD1662-81C3-4F18-BDE2-490FAAD0EB99 For the first connection I enabled internet for the switch, after this, I blocked it again in my router. Don‘t know if this is relevant

This confirm that is not a problem related to library itself (I think) which version of python are you using?

Sorry, posted the answer with the wrong accout and deleted it, so it don't give confusion 😅 I run my HomeAssistant with Hass.io and the Phyton Version is 3.10.5

TwoPlayer commented 2 years ago

Ok guys, Internet must be enabled even the integration use it through LAN. There is synchronization mechanism between tapo cloud and tapo device (like authentication info)

For thew whole time or only for the initial setup with the integration?

SignalStealer commented 2 years ago

I had the same issue after upgrading to HA 2022.7.0. The plug model is the same, P100, same HW version and same firmware as in the image attached by @TEMPLATER1.

The bulb was added to HA before upgrading to 2022.7.0, only the upgrade broke the connection.

After I changed my TP-Link Cloud password and removed then re-added the device, was I able to make it work again. I used a password with no uppercare characters, just in case (no pun intended, but internally appreciated).

I am running HA in a docker container.

Worthy of note, I also use a TP-Link camera which uses the "Tapo: Cameras Control" custom component, and no such issues appeared there - it worked flawlessly after the upgrade.

lanerobertlane commented 2 years ago

Accidently updated firmware on plugs to 1.20.0, and all of them are now inaccessible in home assistant. I tried removing and readding a plug in HA (i don't have any caps in email or password), and am getting an auth fail. Plugs are not barred from the internet, work fine in the tapo app etc.

neildsb commented 2 years ago

ok i tried this morning- still not working :-( unblocked p100 from internet checked remote access from internet - ok upgraded 4.7.3 restart invalid config The following integrations and platforms could not be set up: tapo (Show logs) Please check your config and logs. update to 1.2.13 restart not working - Retrying setup: None delete from HA and APP, then re-add still invalid auth in UI

rollback my snapshot and all is working again on 2022.6.7

neildsb commented 2 years ago

Accidently updated firmware on plugs to 1.20.0, and all of them are now inaccessible in home assistant. I tried removing and readding a plug in HA (i don't have any caps in email or password), and am getting an auth fail. Plugs are not barred from the internet, work fine in the tapo app etc.

i did not update the FW, i have a few problems with TP-Link and their KASA plugs, what FW did you upgrade too? do you still have the problem with 2022.6.7?

petebiggs commented 2 years ago

I have three plugs, only one is working with v1.2.13 of the integration and that is the plug with firmware 1.0.5 Build 210615 Rel.135441. The two plugs which aren't working have firmware 1.4.10 Build 20211104 Rel.35882, so I believe this is a firmware issue.

Strangely the working plug with firmware 1.0.5 says it is up-to-date, so perhaps they are slightly different hardware?

I can't add the two plugs with the later firmware to the integration - I get an 'Invalid authentication' error. Password was changed this morning, 7 letters and a number, all lower case. I am running 2022.7.3.

lanerobertlane commented 2 years ago

Accidently updated firmware on plugs to 1.20.0, and all of them are now inaccessible in home assistant. I tried removing and readding a plug in HA (i don't have any caps in email or password), and am getting an auth fail. Plugs are not barred from the internet, work fine in the tapo app etc.

i did not update the FW, i have a few problems with TP-Link and their KASA plugs, what FW did you upgrade too? do you still have the problem with 2022.6.7?

Plug FW 1.4.10 Build 20211104 rel. 35882 Plug HW 1.20.0 HA 2022.6.7 Integration 1.2.13

lanerobertlane commented 2 years ago

Looking around other Repos for Tapo stuff, looking for other issues with auth issues on firmware update, and found this. Not sure if relevant.

Hardware v2.0 - handshake not respond cookie session ID needed to next command

Before in v1.0 or v1.2, handshake could be made normally, and responded with: { "error_code":0, "result":{ "key":"........." } } and also with TP Session ID.

But somehow when we try to connecting to Tapo hardware v2.0, the handshake did not go well. In result, responded with:

200 OK with Header: Server : SHIP 2.0

neildsb commented 2 years ago

Accidently updated firmware on plugs to 1.20.0, and all of them are now inaccessible in home assistant. I tried removing and readding a plug in HA (i don't have any caps in email or password), and am getting an auth fail. Plugs are not barred from the internet, work fine in the tapo app etc.

i did not update the FW, i have a few problems with TP-Link and their KASA plugs, what FW did you upgrade too? do you still have the problem with 2022.6.7?

Plug FW 1.4.10 Build 20211104 rel. 35882 Plug HW 1.20.0 HA 2022.6.7 Integration 1.2.13

rollback the HACS integration to 1.2.12, its ok and works with me, hopefully we can get a fix for our 1.20.0 HW with 2022.7.x & integration 1.2.13?

petretiandrea commented 2 years ago

A new version of integration released, please try it (v1.2.14)

donoghdb commented 2 years ago

v1.2.14 works for me. Thank you

SkoobyDu commented 2 years ago

All my p100 were still showing offline after your latest update. But I've just deleted them from integrations and I have been able to re-add them.

Thank you

mcgarley commented 2 years ago

I've just installed v1.2.14 in HA 2022.7.3 and I can add the L530 bulb but I only get the entities for overheating and signal strength. I can't actually do anything with the bulb. I've tried deleting the integration and readding a couple of times and same issue. Any ideas?

neildsb commented 2 years ago

A new version of integration released, please try it (v1.2.14)

your a rock star!

All working, also P100's still blocked from the internet. i did not even have to remove the devices from HA, i upgraded the integeration from 1.2.12 to 1.214 and then 2022.7.3 reboot and we are good to go.

Grazie mille

lanerobertlane commented 2 years ago

A new version of integration released, please try it (v1.2.14)

Fixed my issue. Thanks.

samwise22 commented 2 years ago

I still have the authentication issue adding via the UI but the Yaml method is working again now following update to v.1.2.14. Thank you for your hard work @petretiandrea

petebiggs commented 2 years ago

A new version of integration released, please try it (v1.2.14)

Fixed my issues, all three plugs working perfectly (and no need to use the yaml method for me).

Grazie di tutto @petretiandrea