rospogrigio / localtuya

local handling for Tuya devices
GNU General Public License v3.0
2.84k stars 546 forks source link

Error msg "Got message type 10 for unknown listener" #1230

Open blavak68 opened 1 year ago

blavak68 commented 1 year ago

The problem

After upgrade to LocalTuya 5.0 i have from time to time in log this error

Environment

Steps to reproduce

1.

Configuration configuration.yaml or config_flow

on all devices are use protocol version: 3.3

DP dump

Provide Home Assistant taceback/logs

Logger: custom_components.localtuya.pytuya Source: custom_components/localtuya/pytuya/init.py:662 Integration: LocalTuya integration (documentation, issues) First occurred: 17:20:36 (3 occurrences) Last logged: 17:34:23

[bfe...dxg] Got message type 10 for unknown listener 1: TuyaMessage(seqno=1, cmd=10, retcode=0, payload=b"\xf9\xa1%\xd0\x9b\xe41]\xe8\xa3\x1c\xec\x93E\x1f\x96\xca\xfb\x06@i\xf3\xf1\xc8\x83\tV\xb8B\xf5\x1fA<;\xb6ZF&'\xe3\x8f\xce\x925>[?\xfa\x18\xe5]7.n4\xc2u\x9b\x1atk\x83}\xc3", crc=3884422780, crc_good=True)
[bf7...1wl] Got message type 10 for unknown listener 1: TuyaMessage(seqno=1, cmd=10, retcode=1, payload=b"\xa6\xf9+\x0b\xf6V\x15\x00\x8f\xc0Z\xeeu\xad-'\xd4Jxk\xab\x83g\xc2!\x95~\x11\xf7\x07\xdf6", crc=1976365790, crc_good=True)
[bf4...3l4] Got message type 10 for unknown listener 1: TuyaMessage(seqno=1, cmd=10, retcode=0, payload=b'\xa8F\xb4\x01`\xb9\xc1\x1c\x039(\xa7\xd5\xaf\xc91\xbe\xfa{_X/W\xac5}\x10\xde#Z\xd2\x17\xc8\x1e\xc7\x90\x1fp\x03\x03&m\xfa*\xc1cqR\x96\x81\xf3Y\xc36\xfdl\x8e\x93Z(p{\xe8\xfc', crc=3712963961, crc_good=True)

Additional information

i use the follow devices:

rospogrigio commented 1 year ago

Yeah I noticed the same thing in my setup, will investigate even though I don't think it's a big issue, probably we are just losing the first packet but then everything works as expected (or at least I'm not experiencing problems).

patrik-malina commented 1 year ago

I noticed the same thing today. It was garage door opener throwing this error (switch and sdnsor entity). Sensor was available and switch not. It happened to it always to be unavailable after it lose electricity. Solution for me is to open and close garage from tuya app.

Istria1704 commented 1 year ago

I have a Tuya light bulb that has the same behaviour. Unavailable, and becomes available again when I turn it on and off from the Tuya app. Since localtuya 5.0 I get this same error as well in HA logs.


This error originated from a custom integration.

Logger: custom_components.localtuya.pytuya
Source: custom_components/localtuya/pytuya/__init__.py:662
Integration: LocalTuya integration (documentation, issues)
First occurred: 22:06:08 (7 occurrences)
Last logged: 23:14:14

[200...26a] Got message type 10 for unknown listener 1: TuyaMessage(seqno=1, cmd=10, retcode=0, payload=b"\xd9\xb4(r\xd0\xf5\xad-\xe7#\x19\xad\xe1\xf3\x9f\xb1,5~\x9f\xb07\x8e\xe9<$\x8c\xf1\x91y\x9e\xe9\xbb\x99\xc9\xcf\x8d\x1cGwq\x89\x8b\xdaV[}\x89\xd3\x95j'\xb8B\xc9N`\xb53A\xbe\xef\xee\x96\xcd\xae{\xa1\xe2\x80\xbb\xafU\x0cV\x17T\x97\xcc\x17", crc=3906448824, crc_good=True)
[010...d96] Got message type 10 for unknown listener 1: TuyaMessage(seqno=1, cmd=10, retcode=0, payload=b"6\xa4\x81{\x9czF\xaa\x04zVd\xfa<`\xb2\xbb\xcb\xd9}1nA*\xb3\xd36\x16\xd2\xf0Q\xcc\xd9\x18}KpX[\x04\x98@.c\x94\x83+\x89\xbc\xaf\x8d3\xc1\x1b-\xb1\t\xe2|\x94\xbd\x15\x1b\xe0\xddN\xec]\x9e\xcd]\x83'5\xed\x97\x12#\xa4\xe1", crc=1327396593, crc_good=True)```
awigen commented 1 year ago

These messages started after I updated the protocol to 3.4 one a couple of devices. Changing the protocol back to 3.2 or 3.3 resolved the issue for me.

rospogrigio commented 1 year ago

@awigen why did you change the protocol to 3.4? The protocol is not something YOU decide, every device is designed to communicate using a specific protocol, it's not your choice. They might be able to work also with other protocols but in general you should stick to the protocol detected at scan, so the protocol selected by default when you add a new device.

Istria1704 commented 1 year ago

I never changed it to 3.4. It's still @ 3.3, and I got the error. Have not seen it again though. Just thought I'd mention it.

rospogrigio commented 1 year ago

Just to make it clear for everybody: this message is not a new behavior, I just turned it from a debug message to an Error message because I wanted to check when it was happening. The proper level should be Warning, however. This happens when a message times out waiting for its reply, which means the device takes more than 5 sec. to respond. This has always happened (and probably always will) because you just might have connectivity issues from time to time, you just didn't know it was happening before I changed its logging level. Will turn it into a Warning soon.

blavak68 commented 1 year ago

Just to make it clear for everybody: this message is not a new behavior, I just turned it from a debug message to an Error message because I wanted to check when it was happening. The proper level should be Warning, however. This happens when a message times out waiting for its reply, which means the device takes more than 5 sec. to respond. This has always happened (and probably always will) because you just might have connectivity issues from time to time, you just didn't know it was happening before I changed its logging level. Will turn it into a Warning soon.

5 sec. for response is too short

rospogrigio commented 1 year ago

Well, the respond should be almost immediate. There is no perfect value for that, so you can reduce the number of occurrencies but not get rid of them. I am experiencing messages arriving 30 sec. after the timeout, it just can't wait that long. I am thinking of a way to recover those messages even when timeouts occur.

jocamane commented 1 year ago

more one 2023-01-21 21:07:50.913 ERROR (MainThread) [custom_components.localtuya.pytuya] [bf9...k0m] Got message type 10 for unknown listener 1: TuyaMessage(seqno=1, cmd=10, retcode=0, payload=b'\xb7\xcfx\t\xa7+{\x91\xd2t\xc3\x18\xf6\xc90<\xa8\xc3\xd1B\xde?&\xc3\x91\xd5\r\x8bc\xa3\xa6z/\xff\xd7G\xe7\x18g\xd1w\x1bU,\x02\xb7\xda+&\xfd\xb1\xaf,/\xc7k9\x1a1H\xc1\x10I\x179s\xe5\xe6\xe4\x1c\x99\xfb\xd9\xc2\x97\x80\xb9Jtz\xbcy\x01\rB\xfa\xba\xa1\x88\xb3\xc2\x16v\xf9\xac[n\xb3\x8d\x97C}=OKZ\x86\xab\xe2\x9f\x89\xbf', crc=603791527, crc_good=True)

smarthomefamilyverrips commented 1 year ago

Same error here

jocamane commented 1 year ago

Too many errors in this integration. another error:

This error originated from a custom integration.

Logger: custom_components.localtuya.common Source: custom_components/localtuya/pytuya/init.py:450 Integration: LocalTuya (documentation, issues) First occurred: 15:22:54 (1 occurrences) Last logged: 15:22:54

[bf9...k0m] Failed to set DP 20 to False Traceback (most recent call last): File "/usr/local/lib/python3.10/asyncio/locks.py", line 390, in acquire await fut asyncio.exceptions.CancelledError

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/local/lib/python3.10/asyncio/tasks.py", line 456, in wait_for return fut.result() asyncio.exceptions.CancelledError

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

Traceback (most recent call last): File "/config/custom_components/localtuya/common.py", line 322, in set_dp await self._interface.set_dp(state, dp_index) File "/config/custom_components/localtuya/pytuya/init.py", line 836, in set_dp return await self.exchange(CONTROL, {str(dp_index): value}) File "/config/custom_components/localtuya/pytuya/init.py", line 763, in exchange msg = await self.dispatcher.wait_for(seqno, payload.cmd) File "/config/custom_components/localtuya/pytuya/init.py", line 450, in wait_for await asyncio.wait_for(self.listeners[seqno].acquire(), timeout=timeout) File "/usr/local/lib/python3.10/asyncio/tasks.py", line 458, in wait_for raise exceptions.TimeoutError() from exc asyncio.exceptions.TimeoutError

junalmeida commented 1 year ago

I'm also seeing those errors often:

2023-02-06 08:42:29.628 ERROR (MainThread) [custom_components.localtuya.pytuya] [013...62f] Got message type 10 for unknown listener 1: TuyaMessage(seqno=1, cmd=10, retcode=0, payload=b'\xf2M\xc2\xa3\x87\xd8_Z<\xbd\r@ \x04R"\xca\xfcUot+\x8d\x8d\x9b\x0b\xc4\xf1s\'\xcelY\xa6\xd8@%\xdc\xbf#\'\x02\x90\xe9\xb3\xbd}\x0e\xa4\x7fZ\xf8\t\x16\xab\xabN\xcc\xb0*\xfd\x9d\x98u\xf8E\xdb\xc5B\xa9\xcd\xa9\xb3;\xa0\xc2\xd2\x0f\x91\x07\xd1;\x9d*\xfb-.\\\x89\x91\xfb\xed\x9c\xa6\xba\xd7`|\x1c\xfc\xc5\x98~X<\x7f>\xecC\x81z9\xde\x1b:\x81\x1e\xc9&\xee`\x1b#699\xabii\xad\x06U\x01\xbf\xb3\xc4\xd1\xe1\xeb=$\xf3m1g\xde,\x8d6\x98a\xa7\xb0Pm&\xba\x85\xcfE', crc=3501975006, crc_good=True)

(all my devices are 3.3 protocol)

Not sure if related but I have a device that is online on Tuya app and on official Tuya integration however it is unavailable in localtuya. I can't find any log that I could say for sure it is the cause.

kine90 commented 1 year ago

Same error happening here. 4 Gosund EP2 smart plugs and a Nedis Wall Switch often become unavailable. Many times they seem to recover automatically (the problem remains as everytime they do it automations are triggered, as HA sees a change in their state), but expecially one of the plugs exhibit the exact same behaviour of the garage door here https://github.com/rospogrigio/localtuya/issues/1230#issuecomment-1379549748 and remains unavailable until I connect to it using Smartlife.

I am using protocol 3.3 as selected by autodiscovery. I have already trying re-pairing. I am not implementing any kind of interneet block on the network.

I also have similar errors in the log: 2023-02-14 15:56:27.155 ERROR (MainThread) [custom_components.localtuya.pytuya] [bf4...hin] Got message type 10 for unknown listener 1: TuyaMessage(seqno=1, cmd=10, retcode=0, payload=b'\xcc\x96\xd2\x00\x12|\xe3\xe0G\xde\xa5K\xddT)\xfc\x9a\xd3\x998\x8b\x8b&\xa0`\xe7\xaf{f\x10\xa3T\xdd\x18\xfe\xdcz\x94\x82\x87n\xf0#\xb8\xd1j\xd4\x99\x03\x82I\x12J\x1c\xb8\x91\x9e1P f\xf1G\x88\xc7\xfc\x1aA\x91)y\xdf\xeeC\x0cg\xcb; \xda\xfbO\x08\x9c\xcb\x86(\xdb\x9c!M\xf1N\xd0\xfa~\xc4x\x9b\x11\xddL\x19Fk\x9fJ\x8d\xdf\xc2\xb8"\x04\x96f#\xf5\xe1\xf6s{A\x96\xbfW&\xa2%', crc=1952154015, crc_good=True) 2023-02-14 15:56:46.002 ERROR (MainThread) [custom_components.localtuya.pytuya] [bf1...ukp] Got message type 10 for unknown listener 1: TuyaMessage(seqno=1, cmd=10, retcode=0, payload=b"x\xf6\x0eV\x03\x1c\xc9p\x91\xb0n\x82\xd9Itj\xf6\xd7\xa3\xbc\x85Jdgf\xbd\xf7G\x18Uc\xa8\xcc\x91\xfc\x00OX\x94\xea\xcf\\,\xeb8\x9d\xcao-4?#\xc82\xe2\xa3\x96\x03\x83\xbea\x9c\x11\xfe\x90)\xbf\x8b\xa2\x95\x14^\x93~\xc7S\xd4\x0en87\x8a\x9aq\xd9UC\xe7'\xb5\x9a\xbb\xd1#Z\x99\x0e\xb5\x82'q\xdb?&\xb6\xd6\x08\xea>\xe7\xcc\xdf9\x051\xce\xe2,\x1co\xce\xac;DO\x95\xc6p", crc=185515873, crc_good=True) 2023-02-14 15:56:48.804 ERROR (MainThread) [custom_components.localtuya.pytuya] [307...45f] Got message type 10 for unknown listener 1: TuyaMessage(seqno=1, cmd=10, retcode=0, payload=b'\n\x01\xc1T\x82\xf3\xb3c\xfbK\x82[\xcb\xc9 N\xc02 8\xf2\xf31h\xa6\xc5TP\x1d}\x1c\x93H5x\n,\xf01\xb8U\x8f4\x872\xfcR\xd77#FWr\xf6\xa1_\xe8\x0e`f\xf9c\xaeR\tI\xce\xbc\xec\x95\xb3.\xbc)2\x8f\xe4\xeb\xf5\x0c \x91]\xa9\x84\x8c\xab\x16\x9b4\xbb\x8c\xda\xadxo', crc=2769261722, crc_good=True)

After days trying different solutions I become so annoyed that I mailed Gosund and requested the upgrade of the plug's firmware to version 1.0.6, so I can flash Tasmota/EspHome if this problem persists.