leeyuentuen / localtuya

local handling for Tuya devices
GNU General Public License v3.0
72 stars 17 forks source link

Added a second Zigbee gateway and according to log keeps disconnecting #36

Closed Anycubic closed 1 year ago

Anycubic commented 1 year ago

Version 3.6.5 beta 2. I added a second Zigbee gateway with one device attached. The device keeps on going to n/a state, if I make anything on Smart Life the device comes back and suddenly goes back to n/a. Every time it is the same. This is the log:

This error originated from a custom integration.

Logger: custom_components.localtuya.common
Source: custom_components/localtuya/pytuya/__init__.py:212
Integration: LocalTuya (documentation, issues)
First occurred: 4:15:59 PM (21 occurrences)
Last logged: 4:29:20 PM

[bf9...fqe] Connect to gateway 192.168.2.38 failed

I checked in Smart Life, wifi connection is good. I guess there is a timings issue with and additional gateway or something like that?

Anycubic commented 1 year ago

I suspect these are related:

This error originated from a custom integration.

Logger: homeassistant
Source: custom_components/localtuya/common.py:380
Integration: LocalTuya (documentation, issues)
First occurred: 4:16:30 PM (40 occurrences)
Last logged: 4:40:07 PM

Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/config/custom_components/localtuya/common.py", line 369, in _make_connection
    await self._get_sub_device_status(subitem)
  File "/config/custom_components/localtuya/common.py", line 439, in _get_sub_device_status
    status = await self._interface.status(cid)
  File "/config/custom_components/localtuya/pytuya/__init__.py", line 596, in status
    raise Exception("Unexpected sub-device cid", cid)
Exception: ('Unexpected sub-device cid', ('540f57fffec46918', {'dps': {101: None, 103: None, 102: None}, 'retry_status': False}))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/config/custom_components/localtuya/common.py", line 380, in _make_connection
    await self._interface.close()
KeyError: (-100, TuyaMessage(seqno=0, cmd=9, retcode=0, payload=b'', crc=2958142211, crcpassed=True))
Logger: homeassistant.util.logging
Source: util/logging.py:156
First occurred: 4:15:53 PM (1 occurrences)
Last logged: 4:15:53 PM

Exception in _handle_sub_device_request when dispatching 'localtuya_gateway_bf91a70ae982942971sfqe': ({'request': 'request_add', 'cid': '540f57fffec46918', 'content': {'dps': {101: None, 103: None, 102: None}}},) 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 403, in _handle_sub_device_request await self._get_sub_device_status(cid) File "/config/custom_components/localtuya/common.py", line 439, in _get_sub_device_status status = await self._interface.status(cid) File "/config/custom_components/localtuya/pytuya/__init__.py", line 598, in status status = await self.exchange(ACTION_STATUS, cid=cid) File "/config/custom_components/localtuya/pytuya/__init__.py", line 563, in exchange msg = await self.dispatcher.wait_for(seqno) File "/config/custom_components/localtuya/pytuya/__init__.py", line 325, 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
leeyuentuen commented 1 year ago

on creating the protocol 3.4 in this issue: https://github.com/leeyuentuen/localtuya/issues/35, I've notice there is a small looping. Not sure if the beta version 3.7 (don't try on production, still on testing) could temporary solve the issue

alexualbu commented 1 year ago

@Anycubic , I assume this can be closed also, right?

Anycubic commented 1 year ago

@Anycubic , I assume this can be closed also, right?

@alexualbu sure you can close this one

alexualbu commented 1 year ago

thanks, @Anycubic ! cc: @leeyuentuen