rospogrigio / localtuya

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

Problem with added new device (2 gang switch) worked on Tuya app and Tuya Cloud. #1205

Open rafalolb opened 1 year ago

rafalolb commented 1 year ago

The problem

I want to add new switch device named 2 Gang WIFI Breaker Model TMW02 (like this https://shopee.pl/Smatrul-16A-1-2-Gang-Tuya-WiFi-Prze%C5%82%C4%85cznik-Bluetooth-Inteligentne-%C5%9Awiat%C5%82o-Mini-2-dro%C5%BCny-modu%C5%82-Prze%C5%82%C4%85cznik-czasowy-Odpowiedni-dla-Google-Home-Alexa-i.573465537.12347304908) and I get the error message "Connection to device succeeded but no datapoints found, please try again. Create a new issue and include debug logs if problem persists."

Environment

HomeAssistant: Home Assistant 2022.12.8 Frontend 20221213.1 - latest

Steps to reproduce

  1. localtuya integration -> Configure -> Add a new devices -> ... (selected) -> Submit ->
  2. In "Configure Tuya device" set correct "Local Key", "Host", "Device ID", 3.3 Protocol Version
  3. Clicked Submit and get the error: "Connection to device succeeded but no datapoints found, please try again. Create a new issue and include debug logs if problem persists."

DP dump

home-assistant_localtuya_2022-12-29T17-31-22.835Z.log

Provide Home Assistant taceback/logs

Logger: custom_components.localtuya.pytuya
Source: custom_components/localtuya/pytuya/__init__.py:259
Integration: LocalTuya ([documentation](https://github.com/rospogrigio/localtuya/), [issues](https://github.com/rospogrigio/localtuya/issues))
First occurred: 18:31:01 (1 occurrences)
Last logged: 18:31:01

[bfc...wob] Failed to get status:
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/pytuya/__init__.py", line 574, in detect_available_dps
    data = await self.status()
  File "/config/custom_components/localtuya/pytuya/__init__.py", line 507, in status
    status = await self.exchange(STATUS)
  File "/config/custom_components/localtuya/pytuya/__init__.py", line 486, in exchange
    msg = await self.dispatcher.wait_for(seqno)
  File "/config/custom_components/localtuya/pytuya/__init__.py", line 259, 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

Additional information

1 gang switch works, I have a problem with all 2 gangs switches. I you need more information, I'll complete the request.

rafalolb commented 1 year ago

I found a problem by used https://pypi.org/project/tinytuya/.

My 2 gang switches uses protocol 3.4, but localsTuya not suppert this protocol :(

Are there works planned to support 3.4 protocol in localtuya?

rafalolb commented 1 year ago

I found this issue: https://github.com/rospogrigio/localtuya/issues/1065

I try other integration of tuya-local named: https://github.com/make-all/tuya-local