Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

spamming error in logs #1891

Open
jaimielle opened this issue Jan 15, 2025 · 7 comments
Open

spamming error in logs #1891

jaimielle opened this issue Jan 15, 2025 · 7 comments
Labels
bug Something isn't working

Comments

@jaimielle
Copy link

jaimielle commented Jan 15, 2025

The problem

spamming errors on logs and cant configure local tuya devices entities

Environment

  • Localtuya version: 5.2.3
  • Home Assistant Core version: 2025.1.2
  • [] Does the device work using the Home Assistant Tuya Cloud component ?
  • [] Does the device work using the Tinytuya (https://github.com/jasonacox/tinytuya) command line tool ?
  • [] Was the device working with earlier versions of localtuya ? Which one?
  • [] Are you using the Tuya/SmartLife App in parallel ?

Steps to reproduce

DP dump

Provide Home Assistant traceback/logs

This error originated from a custom integration.

Logger: homeassistant
Source: custom_components/localtuya/discovery.py:67
integration: LocalTuya (documentation, issues)
First occurred: 1:49:30 AM (4884 occurrences)
Last logged: 9:04:23 AM

Error doing job: Exception in callback _SelectorDatagramTransport._read_ready() (None)
Traceback (most recent call last):
  File "/config/custom_components/localtuya/discovery.py", line 65, in datagram_received
    data = decrypt_udp(data)
  File "/config/custom_components/localtuya/discovery.py", line 30, in decrypt_udp
    return _unpad(decryptor.update(message) + decryptor.finalize()).decode()
                                              ~~~~~~~~~~~~~~~~~~^^
ValueError: The length of the provided data is not a multiple of the block length.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.13/asyncio/events.py", line 89, in _run
    self._context.run(self._callback, *self._args)
    ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/asyncio/selector_events.py", line 1241, in _read_ready
    self._protocol.datagram_received(data, addr)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^
  File "/config/custom_components/localtuya/discovery.py", line 67, in datagram_received
    data = data.decode()
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xa7 in position 0: invalid start byte


Logger: homeassistant.util.logging
Source: util/logging.py:95
First occurred: 1:49:29 AM (7170 occurrences)
Last logged: 9:04:25 AM

Exception in _update_handler when dispatching 'localtuya_eb2b58091baa2afe10fdrd': ({'1': True, '9': 0, '17': 17, '18': 0, '19': 0, '20': 2417, '21': 1, '22': 511, '23': 26552, '24': 13712, '25': 3040, '26': 0, '38': 'memory', '39': False, '40': 'relay', '41': False, '42': '', '43': '', '44': ''},) Traceback (most recent call last): File "/config/custom_components/localtuya/common.py", line 413, in _update_handler self.status_updated() ~~~~~~~~~~~~~~~~~~~^^ File "/config/custom_components/localtuya/binary_sensor.py", line 61, in status_updated elif state == self._config[CONF_STATE_OFF].lower(): ~~~~~~~~~~~~^^^^^^^^^^^^^^^^ KeyError: 'state_off'
Exception in _update_handler when dispatching 'localtuya_ebb6fffba6ae7b8a60xctq': ({'1': True, '9': 0, '17': 10, '18': 0, '19': 0, '20': 2404, '21': 1, '22': 518, '23': 26552, '24': 13813, '25': 3020, '26': 0, '38': 'memory', '39': False, '40': 'relay', '41': False, '42': '', '43': '', '44': ''},) Traceback (most recent call last): File "/config/custom_components/localtuya/common.py", line 413, in _update_handler self.status_updated() ~~~~~~~~~~~~~~~~~~~^^ File "/config/custom_components/localtuya/binary_sensor.py", line 61, in status_updated elif state == self._config[CONF_STATE_OFF].lower(): ~~~~~~~~~~~~^^^^^^^^^^^^^^^^ KeyError: 'state_off'
Exception in _update_handler when dispatching 'localtuya_ebd3290c2be73998912gzu': ({'1': True, '9': 0, '17': 9, '18': 128, '19': 188, '20': 2369, '21': 1, '22': 560, '23': 29500, '24': 15920, '25': 2620, '26': 0, '38': 'memory', '39': False, '40': 'relay', '41': False, '42': '', '43': '', '44': ''},) Traceback (most recent call last): File "/config/custom_components/localtuya/common.py", line 413, in _update_handler self.status_updated() ~~~~~~~~~~~~~~~~~~~^^ File "/config/custom_components/localtuya/binary_sensor.py", line 61, in status_updated elif state == self._config[CONF_STATE_OFF].lower(): ~~~~~~~~~~~~^^^^^^^^^^^^^^^^ KeyError: 'state_off'
Exception in _update_handler when dispatching 'localtuya_eb2b58091baa2afe10fdrd': ({'1': True, '9': 0, '17': 17, '18': 0, '19': 0, '20': 2407, '21': 1, '22': 511, '23': 26552, '24': 13712, '25': 3040, '26': 0, '38': 'memory', '39': False, '40': 'relay', '41': False, '42': '', '43': '', '44': ''},) Traceback (most recent call last): File "/config/custom_components/localtuya/common.py", line 413, in _update_handler self.status_updated() ~~~~~~~~~~~~~~~~~~~^^ File "/config/custom_components/localtuya/binary_sensor.py", line 61, in status_updated elif state == self._config[CONF_STATE_OFF].lower(): ~~~~~~~~~~~~^^^^^^^^^^^^^^^^ KeyError: 'state_off'
Exception in _update_handler when dispatching 'localtuya_ebb6fffba6ae7b8a60xctq': ({'1': True, '9': 0, '17': 10, '18': 0, '19': 0, '20': 2389, '21': 1, '22': 518, '23': 26552, '24': 13813, '25': 3020, '26': 0, '38': 'memory', '39': False, '40': 'relay', '41': False, '42': '', '43': '', '44': ''},) Traceback (most recent call last): File "/config/custom_components/localtuya/common.py", line 413, in _update_handler self.status_updated() ~~~~~~~~~~~~~~~~~~~^^ File "/config/custom_components/localtuya/binary_sensor.py", line 61, in status_updated elif state == self._config[CONF_STATE_OFF].lower(): ~~~~~~~~~~~~^^^^^^^^^^^^^^^^ KeyError: 'state_off'

Additional information

@jaimielle jaimielle added the bug Something isn't working label Jan 15, 2025
@jaimielle
Copy link
Author

sorry first time here...

@Habile2019
Copy link

Same for me, no devices available after updating to 5.2.3

@jaimielle
Copy link
Author

Same for me, no devices available after updating to 5.2.3

do you mange to fix it?

@Habile2019
Copy link

Same for me, no devices available after updating to 5.2.3

do you mange to fix it?

I've only just started looking at it and seeing what changed in code. Can't easily roll back as someone didn't take a backup before upgrading 🤦

@jaimielle
Copy link
Author

Same for me, no devices available after updating to 5.2.3

do you mange to fix it?

I've only just started looking at it and seeing what changed in code. Can't easily roll back as someone didn't take a backup before upgrading 🤦

hoping an update to fix it... anyway.. does it have impact in HA itself?... do i need to worry?.. or just wait for fix update?...

@bayfacalendar
Copy link

Having same similar issue, none of my lights are showing as available , and being spammed with these errors
Logger: homeassistant
Source: custom_components/localtuya/discovery.py:67
integration: LocalTuya (documentation, issues)
First occurred: 4:55:23 PM (208 occurrences)
Last logged: 5:01:08 PM

Error doing job: Exception in callback _SelectorDatagramTransport._read_ready() (None)
Traceback (most recent call last):
File "/config/custom_components/localtuya/discovery.py", line 65, in datagram_received
data = decrypt_udp(data)
File "/config/custom_components/localtuya/discovery.py", line 30, in decrypt_udp
return _unpad(decryptor.update(message) + decryptor.finalize()).decode()
~~~~~~~~~~~~~~~~~~^^
ValueError: The length of the provided data is not a multiple of the block length.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/local/lib/python3.13/asyncio/events.py", line 89, in _run
self._context.run(self._callback, *self._args)
~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.13/asyncio/selector_events.py", line 1241, in _read_ready
self._protocol.datagram_received(data, addr)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^
File "/config/custom_components/localtuya/discovery.py", line 67, in datagram_received
data = data.decode()
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe4 in position 4: invalid continuation byte

@jstaro
Copy link

jstaro commented Jan 17, 2025

Same here. Tried re-downloading 5.2.2 (which worked before the update) but still broken.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants