petretiandrea / home-assistant-tapo-p100

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

Unable to control L530 after upgrade to 1.1.0 Build 230721 #482

Closed petretiandrea closed 1 year ago

petretiandrea commented 1 year ago

Version of the integration

v2.6.1

Configuration

L530, fw: 1.1.0 Build 230721 hw: 2.0

Describe the bug

TP link has added a new procotol KLAP which is not supported by my library plugp100 see https://github.com/petretiandrea/plugp100/issues/113

jackmawer commented 1 year ago

Is it possible to downgrade these lights in the meantime? I have the bad luck of having bought several that have arrived today and of course the new firmware is forcibly updated on them during setup.

ohiomedic commented 1 year ago

This explains why my lights weren't working today. Mine must have autoupdated the firmware overnight.

woodlair commented 1 year ago

Here I thought it was just me. I updated several components today and suddenly my l530 bulbs would not initialize. Thank you for being so quick to identify the problem.

Evanito commented 1 year ago

Likely related news: https://hothardware.com/news/researchers-discover-vulnerabilities-in-tp-link-smart-bulbs-to-steal-passwords

DOSirl commented 1 year ago

I have also noticed that I've woken up to my L530's and L510's no longer controllable. I only just got the L530's. Is there anything that can be done to get them working again?

matteovisotto commented 1 year ago

Same problem, I removed my L530 from home assistant thinking it was an ip problem and now I cannot add it again. Hope for un update asap

DOSirl commented 1 year ago

Same problem, I removed my L530 from home assistant thinking it was an ip problem and now I cannot add it again. Hope for un update asap

I removed my 2 x L510's for the same reason and now can't add again. Hopefully it can be resolved. If I could help, I would, but I know nothing about this stuff unfortunately.

DavideBoschi commented 1 year ago

I had the same problem this morning, I got up and my L530 bulbs doesn't work anymore from home assistant... I checked the firmware and they are updated to the 1.1.0 Build 230721. What it means?! with this new version of firmware they are not anymore suitable from home assistant?

ngalatis commented 1 year ago

Pitching in to mention that I have the same problem as of today.

OldManOfTheSea69 commented 1 year ago

Same problem although I note that they are capable of working with Alexa.

ahthief commented 1 year ago

Same problem. After removing L530, I can not add it again anymore.

Carlosbro5 commented 1 year ago

just adding in that all 5 of my L530 bulbs not working. My tapo light strip works fine however not the bulbs. Hopefully a fix comes soon

naamah75 commented 1 year ago

Same problem...

Thinking it was an IP address issue I tried to uninstall the integration. But now I can't reconnect the bulbs, here is the error

Failed to setup cannot connect
Traceback (most recent call last):
  File "/config/custom_components/tapo/config_flow.py", line 175, in _try_setup_api
    return value_or_raise(
           ^^^^^^^^^^^^^^^
  File "/config/custom_components/tapo/helpers.py", line 11, in value_or_raise
    raise value_or_error
plugp100.responses.tapo_exception.TapoException: Returned unknown error_code: 1003  msg: No message

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

Traceback (most recent call last):
  File "/config/custom_components/tapo/config_flow.py", line 88, in async_step_user
    api = await self._try_setup_api(user_input)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/tapo/config_flow.py", line 179, in _try_setup_api
    self._raise_from_tapo_exception(error)
  File "/config/custom_components/tapo/config_flow.py", line 188, in _raise_from_tapo_exception
    raise CannotConnect from exception
custom_components.tapo.errors.CannotConnect
Messelweg commented 1 year ago

Same problem. Hopefully a fix comes soon.

ItsMeRitch commented 1 year ago

Also affected, hopefully a solution can be found quick :(

@petretiandrea is there anything we can do to help support this?

petretiandrea commented 1 year ago

I'm working on It. I've already a working version of plugp100, but I need a way to known when to use klap protocol instead of actual protocol

ItsMeRitch commented 1 year ago

I'm working on It. I've already a working version of plugp100, but I need a way to known when to use klap protocol instead of actual protocol

You’re an absolute star. Doing some digging, seems these folk have been able to implement it for KASA Tp link products if it helps

https://github.com/python-kasa/python-kasa/issues/115

I’m not very good working with API and what not but If you want someone to test stuff, just give me a shout and I’ll do my best.

ItsMeRitch commented 1 year ago

@liquidv howd you manage to downgrade?

lasercheesecake commented 1 year ago

same problem, all of a sudden, all my bulbs were showing not available.

jaymunro commented 1 year ago

For this very reason I have my devices set to not autoupdate firmware. Yet by L530 bulb updated anyway. image

StefanoFrazzetto commented 1 year ago

@jaymunro it's possible they have a way to force devices to update then, regardless of that setting

Anyway, I'm also happy to help with code or testing. Let us know if there's anything we can do to get this fixed asap

sdb9696 commented 1 year ago

I'm working on It. I've already a working version of plugp100, but I need a way to known when to use klap protocol instead of actual protocol

If you can't get that info via the api you could probably get a discovery response and look inside for KLAP if you query the device on udp to port 20002 with a magic number. I believe this worked for TAPO devices pre the update so I'd imagine it still does. You can see an example for kasa devices here: https://github.com/python-kasa/python-kasa/pull/488

Giuseppe197575 commented 1 year ago

Same problem

derailius commented 1 year ago

same issues here

Namirred commented 1 year ago

I have the same problem

petretiandrea commented 1 year ago

I'm releasing plugp100 v3.9.0 which support KLAP protocol 🥳 special thanks to python-kasa. I will integration my new library version in HA

DavideBoschi commented 1 year ago

Hi @petretiandrea, thank you for your job!! I have a question, maybe stupid.. I just reinstalled the tapo control integration, but I still not able to add again my L530.. Where I wrong?! how can I update the plugp100 python library on my HA?? Thank you in advance for the help!

matteovisotto commented 1 year ago

Hi @petretiandrea, thank you for your job!! I have a question, maybe stupid.. I just reinstalled the tapo control integration, but I still not able to add again may L530.. Where I wrong?! how can I update the plugp100 python library on my HA?? Thank you in advance for the help!

@DavideBoschi He update the core library at the moment, I think he will also update home assistant integration soon.

DavideBoschi commented 1 year ago

Hi @petretiandrea, thank you for your job!! I have a question, maybe stupid.. I just reinstalled the tapo control integration, but I still not able to add again may L530.. Where I wrong?! how can I update the plugp100 python library on my HA?? Thank you in advance for the help!

@DavideBoschi He update the core library at the moment, I think he will also update home assistant integration soon.

Ok, thank you very much!!

dave2000gray commented 1 year ago

I'm releasing plugp100 v3.9.0 which support KLAP protocol 🥳 special thanks to python-kasa. I will integration my new library version in HA

Hero! Thank you for all your hard work. Coffee's inbound!

Valiante commented 1 year ago

Yep, buying a coffee right now to support this great integration.

petretiandrea commented 1 year ago

v2.7.0 support klap protocol try it, and re-open issue if problem persists

Pugwash69 commented 1 year ago

2.7.0 is working perfectly. Thanks!

Valiante commented 1 year ago

v2.7.0 support klap protocol try it, and re-open issue if problem persists

Working a treat, thanks for your support 👍

v966732 commented 1 year ago

Working again, thank-you very much

matteovisotto commented 1 year ago

Thank you so much. It works

Messelweg commented 1 year ago

Thank you so much, it works and i am happy again.

not1q84-1 commented 1 year ago

There still seems to be a bug in the klap_protocol.py. I have two L530 light bulbs, where off one is working fine but the other one produces an error in some switch events. Difficult to trace when exactly it is failing. But the error message in the HA log seems to be quite clear:

2023-08-27 08:49:05.116 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [140512203478720] 'utf-8' codec can't decode byte 0x81 in position 15: invalid start byte Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 226, in handle_call_service await hass.services.async_call( File "/usr/src/homeassistant/homeassistant/core.py", line 1974, in async_call response_data = await coro ^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/core.py", line 2011, in _execute_service return await target(service_call) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 235, in handle_service return await service.entity_service_call( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 870, in entity_service_call response_data = await _handle_entity_call( ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 942, in _handle_entity_call result = await task ^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/light/init.py", line 591, in async_handle_light_off_service await light.async_turn_off(filter_turn_off_params(light, params)) File "/config/custom_components/tapo/light.py", line 179, in async_turn_off (await self.coordinator.device.off()).get_or_raise() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/plugp100/api/light_device.py", line 41, in off return await self._api.set_device_info(SetPlugInfoParams(False)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/plugp100/api/tapo_client.py", line 126, in set_device_info return await self._set_device_info(dataclass_encode_json(device_info)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/plugp100/api/tapo_client.py", line 195, in _set_device_info response = await self._protocol.send_request( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/plugp100/protocol/klap_protocol.py", line 48, in send_request response = await self._send_request(request, retry) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/plugp100/protocol/klap_protocol.py", line 88, in _send_request self._klap_session.chiper.decrypt(response_data) File "/usr/local/lib/python3.11/site-packages/plugp100/protocol/klap_protocol.py", line 323, in decrypt return plaintextbytes.decode() ^^^^^^^^^^^^^^^^^^^^^^^ UnicodeDecodeError: 'utf-8' codec can't decode byte 0x81 in position 15: invalid start byte 2023-08-27 08:49:05.166 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [140512203478720] 'utf-8' codec can't decode byte 0x82 in position 15: invalid start byte Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 226, in handle_call_service await hass.services.async_call( File "/usr/src/homeassistant/homeassistant/core.py", line 1974, in async_call response_data = await coro ^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/core.py", line 2011, in _execute_service return await target(service_call) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 235, in handle_service return await service.entity_service_call( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 870, in entity_service_call response_data = await _handle_entity_call( ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 942, in _handle_entity_call result = await task ^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/light/init.py", line 591, in async_handle_light_off_service await light.async_turn_off(filter_turn_off_params(light, params)) File "/config/custom_components/tapo/light.py", line 179, in async_turn_off (await self.coordinator.device.off()).get_or_raise() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/plugp100/api/light_device.py", line 41, in off return await self._api.set_device_info(SetPlugInfoParams(False)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/plugp100/api/tapo_client.py", line 126, in set_device_info return await self._set_device_info(dataclass_encode_json(device_info)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/plugp100/api/tapo_client.py", line 195, in _set_device_info response = await self._protocol.send_request( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/plugp100/protocol/klap_protocol.py", line 48, in send_request response = await self._send_request(request, retry) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/plugp100/protocol/klap_protocol.py", line 88, in _send_request self._klap_session.chiper.decrypt(response_data) File "/usr/local/lib/python3.11/site-packages/plugp100/protocol/klap_protocol.py", line 323, in decrypt return plaintextbytes.decode() ^^^^^^^^^^^^^^^^^^^^^^^ UnicodeDecodeError: 'utf-8' codec can't decode byte 0x82 in position 15: invalid start byte 2023-08-27 08:49:39.411 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [140512203478720] Could not load a dict; the given string is not valid JSON.: line 1 column 16 (char 15) Traceback (most recent call last): File "/usr/local/lib/python3.11/site-packages/jsons/_loadimpl.py", line 150, in loads obj = json.loads(str, **jdkwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/json/init.py", line 346, in loads return _default_decoder.decode(s) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/json/decoder.py", line 337, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/json/decoder.py", line 353, in raw_decode obj, end = self.scan_once(s, idx) ^^^^^^^^^^^^^^^^^^^^^^ json.decoder.JSONDecodeError: Expecting ',' delimiter: line 1 column 16 (char 15)

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

Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 226, in handle_call_service await hass.services.async_call( File "/usr/src/homeassistant/homeassistant/core.py", line 1974, in async_call response_data = await coro ^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/core.py", line 2011, in _execute_service return await target(service_call) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 235, in handle_service return await service.entity_service_call( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 870, in entity_service_call response_data = await _handle_entity_call( ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 942, in _handle_entity_call result = await task ^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/light/init.py", line 580, in async_handle_light_on_service await light.async_turn_on(**filter_turn_on_params(light, params)) File "/config/custom_components/tapo/light.py", line 174, in async_turn_on (await self.coordinator.device.on()).get_or_raise() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/plugp100/api/light_device.py", line 34, in on return await self._api.set_device_info(SetPlugInfoParams(True)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/plugp100/api/tapo_client.py", line 126, in set_device_info return await self._set_device_info(dataclass_encode_json(device_info)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/plugp100/api/tapo_client.py", line 195, in _set_device_info response = await self._protocol.send_request( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/plugp100/protocol/klap_protocol.py", line 48, in send_request response = await self._send_request(request, retry) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/plugp100/protocol/klap_protocol.py", line 87, in _send_request decrypted_response = jsons.loads( ^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/jsons/_load_impl.py", line 152, in loads raise DecodeError('Could not load a dict; the given string is not ' jsons.exceptions.DecodeError: Could not load a dict; the given string is not valid JSON.: line 1 column 16 (char 15)