rospogrigio / localtuya

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

Failed to add device: Failed to get status (Failed to get status: unpack requires a buffer of 20 bytes) #1075

Open dimyard opened 2 years ago

dimyard commented 2 years ago

The problem

Im trying to add AUBESS Mini Smart Switch. Some time ago i did it successfully by the protocol 3.3. Now Im stuck on adding form; I check local ID of device (by command tuya-cli wizard), then in HA integration try to add new device. Device automaticly shows in list, I`ve select it. Then enter name and local key. Submit. 3.4 protocol return "User input malformed" without any awayt. If i select 3.3, it shows loader and error like "Connection to device succeeded but no datapoints found, please try again. Create a new issue and include debug logs if problem persists.".

All I see in logs is:

This error originated from a custom integration.

Logger: custom_components.localtuya.pytuya Source: custom_components/localtuya/pytuya/init.py:259 Integration: LocalTuya (documentation, issues) First occurred: 8:10:19 PM (5 occurrences) Last logged: 8:23:08 PM

[bf6...zup] Failed to get status: Traceback (most recent call last): File "/home/homeassistant/.homeassistant/custom_components/localtuya/pytuya/init.py", line 574, in detect_available_dps data = await self.status() File "/home/homeassistant/.homeassistant/custom_components/localtuya/pytuya/init.py", line 507, in status status = await self.exchange(STATUS) File "/home/homeassistant/.homeassistant/custom_components/localtuya/pytuya/init.py", line 486, in exchange msg = await self.dispatcher.wait_for(seqno) File "/home/homeassistant/.homeassistant/custom_components/localtuya/pytuya/init.py", line 259, in wait_for await asyncio.wait_for(self.listeners[seqno].acquire(), timeout=timeout) File "/usr/lib/python3.8/asyncio/tasks.py", line 501, in wait_for raise exceptions.TimeoutError() asyncio.exceptions.TimeoutError <<<<<<

Environment

Steps to reproduce

I check local ID of device (by command tuya-cli wizard), then in HA integration try to add new device. Device automaticly shows in list, I`ve select it. Then enter name and local key. Submit. 3.4 protocol return "User input malformed" without any awayt. If i select 3.3, it shows loader and error like "Connection to device succeeded but no datapoints found, please try again. Create a new issue and include debug logs if problem persists.".

Configuration configuration.yaml or config_flow


# Configure a default setup of Home Assistant (frontend, api, etc)
default_config:

# Text to speech
tts:
  - platform: google_translate

group: !include groups.yaml
automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml

panel_iframe:
  configurator:
    title: Configurator
    icon: mdi:square-edit-outline
    url: <cut>

homeassistant:
  packages: !include_dir_named packages

lovelace:
  resources:
    - url: /local/mini-media-player-bundle.js?v=1.16.4
      type: module

DP dump

INFO:localtuya:localtuya version 1.0.0 INFO:localtuya:Python 3.8.10 (default, Sep 28 2021, 16:10:42) [GCC 9.3.0] on linux INFO:localtuya:Using pytuya version '8.1.0' INFO:localtuya:Detecting list of available DPS of device [], protocol 3.3. DEBUG:localtuya.pytuya:Sending command status (device type: type_0a) DEBUG:localtuya.pytuya:paylod=b'{"gwId":"","devId":""}' DEBUG:localtuya.pytuya:DATA RECEIVED! DEBUG:localtuya.pytuya:READING AGAIN! DEBUG:localtuya.pytuya:Failed to connect to . Raising Exception. WARNING:localtuya.pytuya:Failed to get status: unpack requires a buffer of 20 bytes

marcelhoogantink commented 1 year ago

This device has protocol 3.4 which is not (yet) supported (see https://github.com/rospogrigio/localtuya/issues/1065)