leeyuentuen / localtuya

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

Unable to add Multimode Gateway #86

Open NicolaP8 opened 5 months ago

NicolaP8 commented 5 months ago

I'm trying to add a Moes Multimode Gateway (ZigBee+BLE, WiFi + Ethernet) but I get an "unkown" error. I followed instructions and found IDs and keys. The "Local Key" is in the new format: ".>XL:@~n7>TwN1[~" (excluded the quotes).

This error originated from a custom integration.

Logger: custom_components.localtuya.config_flow
Source: custom_components/localtuya/config_flow.py:386
Integration: LocalTuya integration (documentation, issues)
First occurred: 19:34:08 (3 occurrences)
Last logged: 20:02:06

Unexpected exception
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/asyncio/tasks.py", line 500, in wait_for
    return fut.result()
           ^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/asyncio/locks.py", line 387, in acquire
    await fut
asyncio.exceptions.CancelledError

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

Traceback (most recent call last):
  File "/config/custom_components/localtuya/config_flow.py", line 386, in async_step_basic_info
    self.dps_strings = await validate_input(self.hass, user_input)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/localtuya/config_flow.py", line 292, in validate_input
    detected_dps = await interface.detect_available_dps()
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/localtuya/pytuya/__init__.py", line 702, in detect_available_dps
    status = await self.status()
             ^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/localtuya/pytuya/__init__.py", line 602, in status
    status = await self.exchange(ACTION_STATUS)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  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.11/asyncio/tasks.py", line 502, in wait_for
    raise exceptions.TimeoutError() from exc
TimeoutError
vshijiav commented 5 months ago

I have the same error

nigam-sa commented 5 months ago

I am also having the same error while adding multimode gateway. Was able to add just the zigbee gateway without any issues.

nigam-sa commented 5 months ago

I enabled the debug trace and added the Multimode (Zigbee + Bluetooth) gateway via configuration.yaml and see following in the trace so its clear that reaching the device successfully but something in the localtuya code is causing it to disconnect.

2024-01-27 13:58:24.384 DEBUG (MainThread) [custom_components.localtuya] Device bf1xxxxxxxxxx5b1b9l4wu found with IP 192.168.68.97 2024-01-27 13:58:24.385 DEBUG (MainThread) [custom_components.localtuya.common] [bf1...4wu] Connecting to gateway 192.168.68.97 2024-01-27 13:58:24.474 DEBUG (MainThread) [custom_components.localtuya.pytuya] [bf1...4wu] Started heartbeat loop 2024-01-27 13:58:24.475 DEBUG (MainThread) [custom_components.localtuya.pytuya] [bf1...4wu] Sending command heartbeat (device type: type_0d) 2024-01-27 13:58:24.475 DEBUG (MainThread) [custom_components.localtuya.pytuya] [bf1...4wu] Send payload: b'{}' 2024-01-27 13:58:24.479 DEBUG (MainThread) [custom_components.localtuya.pytuya] [bf1...4wu] Waiting for sequence number -100 2024-01-27 13:58:24.481 DEBUG (MainThread) [custom_components.localtuya.common] [bf1...4wu] Connected to gateway 192.168.68.97 successfully 2024-01-27 13:58:24.481 DEBUG (MainThread) [custom_components.localtuya.common] [bf1...4wu] Attempting to reconnect 0 subdevices 2024-01-27 13:58:24.565 DEBUG (MainThread) [custom_components.localtuya.pytuya] [bf1...4wu] Connection lost: [Errno 104] Connection reset by peer 2024-01-27 13:58:24.566 DEBUG (MainThread) [custom_components.localtuya.common] [bf1...4wu] Sending event_disconnected to 0 subdevices 2024-01-27 13:58:24.566 DEBUG (MainThread) [custom_components.localtuya.common] [bf1...4wu] Disconnected (TuyaGatewayDevice) - waiting for discovery broadcast 2024-01-27 13:58:24.570 DEBUG (MainThread) [custom_components.localtuya.pytuya] [bf1...4wu] Heartbeat failed due to timeout, disconnecting

tangobones commented 4 months ago

I'm getting the same error. Any idea of how to make it work?

nigam-sa commented 3 months ago

@leeyuentuen - please can you look into this. this is being outstanding for a while now. If you need any traces or help in reproducing pls. let me know