xZetsubou / hass-localtuya

🔹 A Home Assistant integration to handle Tuya devices locally "fork from localtuya"
https://xzetsubou.github.io/hass-localtuya/
GNU General Public License v3.0
366 stars 41 forks source link

[Bug]: Huge delay for tuya wifi wall switch #276

Closed fzellner closed 2 months ago

fzellner commented 3 months ago

LocalTuya Version

2024.0.6

Home Assistant Version

2024.6.2

Environment

What happened?

After adding a wifi device, when I try to change the state of the switch the device takes a huge delay to reply. When I enabled the debug log, the log showed that when I tried to change the state, the payload was empty.

Steps to reproduce.

  1. Add a wifi device
  2. Try to change the state of the switch

Relevant log output

2024-06-14 22:06:07.484 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [eb3...t9f - Interruptor Sala] Dispatching message CMD 7 TuyaMessage(seqno=97, cmd=7, retcode=0, payload=b'', crc=2885055306, crc_good=True, prefix=21930, iv=None)
2024-06-14 22:06:13.542 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [eb3...t9f - Interruptor Sala] Dispatching message CMD 7 TuyaMessage(seqno=98, cmd=7, retcode=0, payload=b'', crc=373038980, crc_good=True, prefix=21930, iv=None)
2024-06-14 22:06:15.782 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [eb3...t9f - Interruptor Sala] Dispatching message CMD 7 TuyaMessage(seqno=99, cmd=7, retcode=0, payload=b'', crc=3416966657, crc_good=True, prefix=21930, iv=None)
2024-06-14 22:06:17.998 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [eb3...t9f - Interruptor Sala] Dispatching message CMD 7 TuyaMessage(seqno=100, cmd=7, retcode=0, payload=b'', crc=3067723865, crc_good=True, prefix=21930, iv=None)
2024-06-14 22:06:20.281 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [eb3...t9f - Interruptor Sala] Dispatching message CMD 7 TuyaMessage(seqno=101, cmd=7, retcode=0, payload=b'', crc=1800346076, crc_good=True, prefix=21930, iv=None)
2024-06-14 22:06:23.663 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [eb3...t9f - Interruptor Sala] Dispatching message CMD 7 TuyaMessage(seqno=102, cmd=7, retcode=0, payload=b'', crc=3599070482, crc_good=True, prefix=21930, iv=None)
2024-06-14 22:06:23.766 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [eb3...t9f - Interruptor Sala] Dispatching message CMD 8 TuyaMessage(seqno=0, cmd=8, retcode=0, payload=b'3.3\x00\x00\x00\x00\x00\x00eF\x00\x00\x00\x01\x7fq\xd5\xad\xf1H-\xe0\x9b\xeaP\xbb\xda:\xbcNr\xb4\xa5\x83W\xfe_/8\xbc\xd3\xdb-?\xbe\xf3w\x9e\xaf\x19\xceC\xec+\xe8\x9b={N\xd6\x9ew', crc=802029474, crc_good=True, prefix=21930, iv=None)

Diagnostics information.

localtuya-9c64053becbaab0cec25dc25e17a7e4f-Interruptor Sala-6a23806208be7de35c69a65ffb11a378.json

xZetsubou commented 3 months ago

The logs doesn't seem is full. Ensure the WiFi connection of that device is good. Try remove and re-add the device and you may also want to test protocol version 3.2.

You may need to check the connection of home-assistant as well that it good

Try ping to that device e.g. ping -n 20 192.168.1.102 and see ensure that it stable and low ms and no losses.

fzellner commented 2 months ago

Ty for the feedback and suggestions!

Made a ping session to the device, and has no packet loss and re add the device with 3.2 protocol and showed the same behavior. Also, the HA connection is healthy. I started to see the same delay on the Tuya app. Maybe, this is a issue regarding the device itself... it's a generic wall switch.

I am gonna try another switch ASAP

xZetsubou commented 2 months ago

I started to see the same delay on the Tuya app. Maybe, this is a issue regarding the device itself... it's a generic wall switch.

If the issue happened on all devices feel free to open this, I'm kinda sure that this is a device behavior.

note: the empty payload in the debug is just a "heartbeat" payload to keep the connection alive with the device it shouldn't shows because a debug need to enabled for the device it self.