localtuya icon indicating copy to clipboard operation
localtuya copied to clipboard

Unable to add devices: Failed to get status

Open roja45 opened this issue 2 years ago • 4 comments

The problem

Suddenly unable to add any devices via HA dashboard, even some that were previously working fine.

Environment

  • Localtuya version: 4.0.1
Version core-2022.7.1
Installation Type Home Assistant OS
Development false
Supervisor true
Docker true
User root
Virtual Environment false
Python Version 3.10.5
Operating System Family Linux
Operating System Version 5.15.45
CPU Architecture x86_64
Timezone America/Bogota
Configuration Directory /config

DP dump

INFO:localtuya:localtuya version 1.0.0 INFO:localtuya:Python 3.8.10 (default, Mar 15 2022, 12:22:08) [GCC 9.4.0] on linux INFO:localtuya:Using pytuya version '8.1.0' INFO:localtuya:Detecting list of available DPS of device 623170308cce4ef3ffc5 [192.168.1.101], protocol 3.3. DEBUG:localtuya.pytuya:Sending command status (device type: type_0a) DEBUG:localtuya.pytuya:paylod=b'{"gwId":"623170308cce4ef3ffc5","devId":"623170308cce4ef3ffc5"}' DEBUG:localtuya.pytuya:DATA RECEIVED! DEBUG:localtuya.pytuya:decode payload=b'\xf4\xcc0l\x1fE\x07\xfb\xaf q\xbe\\\xb3\x07\xe0\xc4u\xd2\x90\x12 \xf9\xf0\xefm\x9c)G)z' DEBUG:localtuya.pytuya:decrypted result='' DEBUG:localtuya.pytuya:Failed to connect to 192.168.1.101. Raising Exception. WARNING:localtuya.pytuya:Failed to get status: Expecting value: line 1 column 1 (char 0) INFO:localtuya:Detecting list of available DPS of device 623170308cce4ef3ffc5 [192.168.1.101], protocol 3.3. DEBUG:localtuya.pytuya:Sending command status (device type: type_0a) DEBUG:localtuya.pytuya:paylod=b'{"gwId":"623170308cce4ef3ffc5","devId":"623170308cce4ef3ffc5"}' DEBUG:localtuya.pytuya:DATA RECEIVED! DEBUG:localtuya.pytuya:decode payload=b'\x1c\xfd\xcb:\x06\xb8x\x0b\x9c\xd3@\x87\x98\xbc\xcf\xd5\x06\x88V\xba\x81K\xf63\xedr\x87\xebINR\x17Ch\xa7\xb6\x0c\xae\x0c\xf1\xf7H.}R\n\xf9-R9\x0b\xd4W\x1c\x19\x98\x9a\xf9\xd3z\xe4\xe5\xb4' DEBUG:localtuya.pytuya:decrypted result='{"devId":"623170308cce4ef3ffc5","dps":{"1":false,"9":0}}' AVAILABLE DPS ARE [{'1': False, '9': 0}] INFO:localtuya:COMPLETE response from device 623170308cce4ef3ffc5 [192.168.1.101].

**** deviceInfo returned OK ****

TuyaDebug (Tuya DPs dump) [1.0.0]

Device 623170308cce4ef3ffc5 at 192.168.1.101 key 47e346c775be8542 protocol 3.3 dev_type type_0a: DPS [1] VALUE [False] DPS [9] VALUE [0]

Provide Home Assistant taceback/logs

2022-07-17 11:05:20 ERROR (MainThread) [custom_components.localtuya.pytuya] [623...fc5] Failed to get status: Expecting value: line 1 column 1 (char 0) Traceback (most recent call last): File "/config/custom_components/localtuya/pytuya/init.py", line 539, in detect_available_dps data = await self.status() File "/config/custom_components/localtuya/pytuya/init.py", line 481, in status status = await self.exchange(STATUS) File "/config/custom_components/localtuya/pytuya/init.py", line 466, in exchange payload = self._decode_payload(msg.payload) File "/config/custom_components/localtuya/pytuya/init.py", line 588, in _decode_payload return json.loads(payload) File "/usr/local/lib/python3.10/json/init.py", line 346, in loads return _default_decoder.decode(s) File "/usr/local/lib/python3.10/json/decoder.py", line 337, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) File "/usr/local/lib/python3.10/json/decoder.py", line 355, in raw_decode raise JSONDecodeError("Expecting value", s, err.value) from None json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

## Additional information
<!-- Put here any information that you think it may be relevant -->
![image](https://user-images.githubusercontent.com/19314911/179410721-a92d91c5-f219-4103-9237-c5ed72e2ce76.png)

roja45 avatar Jul 17 '22 16:07 roja45

Also there is a problem with getting status of device. Device name is MK601. It has cb2s module (see attached photo). Protocol version of device is 3.4. Screenshot_20220720-151908_AliExpress

Maxfive avatar Jul 20 '22 12:07 Maxfive

Also there is a problem with getting status of device. Device name is MK601. It has cb2s module (see attached photo). Protocol version of device is 3.4.

surprised it was working previously, from the TO-DO list in the readme: "Support devices that use Tuya protocol v.3.4" Would assume that's the issue?

BlueTalon6 avatar Jul 22 '22 05:07 BlueTalon6

Also there is a problem with getting status of device. Device name is MK601. It has cb2s module (see attached photo). Protocol version of device is 3.4.

surprised it was working previously, from the TO-DO list in the readme: "Support devices that use Tuya protocol v.3.4" Would assume that's the issue?

Suppose it can be the reason. I've just tried to use that integration with my devices. I have almost the same four tuya devices and one of them works in localtuya but others have problem with adding in home assistant with error "Failed to get status". When I try to found differences using logging I see that one device give a reply with protocol version 3.3 and three others have 3.4 version.

Maxfive avatar Jul 22 '22 06:07 Maxfive

tinytuya 1.7.1 already supports 3.4. protocol

koyaya avatar Oct 19 '22 09:10 koyaya