codeclinic / TuyaPower2MQTT

Reports full power stats / data from Tuya sockets & switches and reports results via MQTT
MIT License
11 stars 1 forks source link

Incomplete response from plug [...] #3

Closed dferrandizmont closed 4 years ago

dferrandizmont commented 4 years ago

As I explained in the hass forums, I still have some problems with my Tuya devices. Tried your new update and had the following errors:

{"result": "Incomplete response from plugbfb50067e2c0b15c28udin [192.168.1.158].", "deviceid": "bfb50067e2c0b15c28udin", "datetime": "2020-02-01T21:35:25Z"}

tried with differents IPs in case I was targeting the wrong one

{"result": "Incomplete response from plugbfb50067e2c0b15c28udin [192.168.1.157].", "deviceid": "bfb50067e2c0b15c28udin", "datetime": "2020-02-01T22:24:59Z"} {"result": "Incomplete response from plugbfb50067e2c0b15c28udin [192.168.1.158].", "deviceid": "bfb50067e2c0b15c28udin", "datetime": "2020-02-01T22:25:15Z"} {"result": "Incomplete response from plugbfb50067e2c0b15c28udin [192.168.1.166].", "deviceid": "bfb50067e2c0b15c28udin", "datetime": "2020-02-01T22:25:33Z"} {"result": "Incomplete response from plugbfb50067e2c0b15c28udin [192.168.1.167].", "deviceid": "bfb50067e2c0b15c28udin", "datetime": "2020-02-01T22:25:55Z"} {"result": "Incomplete response from plugbfb50067e2c0b15c28udin [192.168.1.168].", "deviceid": "bfb50067e2c0b15c28udin", "datetime": "2020-02-01T22:26:13Z"} {"result": "Incomplete response from plugbfb50067e2c0b15c28udin [192.168.1.173].", "deviceid": "bfb50067e2c0b15c28udin", "datetime": "2020-02-01T22:26:29Z"} {"result": "Incomplete response from plugbfb50067e2c0b15c28udin [192.168.1.174].", "deviceid": "bfb50067e2c0b15c28udin", "datetime": "2020-02-01T22:26:45Z"} {"result": "Incomplete response from plugbfb50067e2c0b15c28udin [192.168.1.192].", "deviceid": "bfb50067e2c0b15c28udin", "datetime": "2020-02-01T22:27:13Z"}

No one worked ... from the logs I could get this:

INFO:pytuya:pytuya version 7.0.5 INFO:pytuya:Python 2.7.16 (default, Oct 10 2019, 22:02:15) [GCC 8.3.0] on linux2 INFO:pytuya:Using PyCrypto (3, 9, '4') INFO:pytuya:Using PyCrypto from '/home/pi/.local/lib/python2.7/site-packages/Crypto/__init__.pyc' DEBUG:pytuya:status() entry DEBUG:pytuya:json_payload='{"devId":"bfb50067e2c0b15c28udin","gwId":"bfb50067e2c0b15c28udin"}' DEBUG:pytuya:status received data="\x00\x00U\xaa\x00\x00\x00\x00\x00\x00\x00\n\x00\x00\x00,\x00\x00\x00\x01d\x8f\xf6\xc4\xbf\xf1\xb3\xe3\xa0\xaa\xc3Y\xcb\xaeC\x84\xbe\xec\xf6\x9d\x13\x17\xf0P{\x19\xd5\xc7\xa6\xdbO>a'\x01\x1d\x00\x00\xaaU" DEBUG:pytuya:result='d\x8f\xf6\xc4\xbf\xf1\xb3\xe3\xa0\xaa\xc3Y\xcb\xaeC\x84\xbe\xec\xf6\x9d\x13\x17\xf0P{\x19\xd5\xc7\xa6\xdbO>' DEBUG:pytuya:decrypted result=u'json obj data unvalid' DEBUG:pytuya:status() entry DEBUG:pytuya:json_payload='{"devId":"bfb50067e2c0b15c28udin","gwId":"bfb50067e2c0b15c28udin"}' DEBUG:pytuya:status received data="\x00\x00U\xaa\x00\x00\x00\x00\x00\x00\x00\n\x00\x00\x00,\x00\x00\x00\x01d\x8f\xf6\xc4\xbf\xf1\xb3\xe3\xa0\xaa\xc3Y\xcb\xaeC\x84\xbe\xec\xf6\x9d\x13\x17\xf0P{\x19\xd5\xc7\xa6\xdbO>a'\x01\x1d\x00\x00\xaaU" DEBUG:pytuya:result='d\x8f\xf6\xc4\xbf\xf1\xb3\xe3\xa0\xaa\xc3Y\xcb\xaeC\x84\xbe\xec\xf6\x9d\x13\x17\xf0P{\x19\xd5\xc7\xa6\xdbO>' DEBUG:pytuya:decrypted result=u'json obj data unvalid' DEBUG:pytuya:status() entry DEBUG:pytuya:json_payload='{"devId":"bfb50067e2c0b15c28udin","gwId":"bfb50067e2c0b15c28udin"}' DEBUG:pytuya:status received data="\x00\x00U\xaa\x00\x00\x00\x00\x00\x00\x00\n\x00\x00\x00,\x00\x00\x00\x01d\x8f\xf6\xc4\xbf\xf1\xb3\xe3\xa0\xaa\xc3Y\xcb\xaeC\x84\xbe\xec\xf6\x9d\x13\x17\xf0P{\x19\xd5\xc7\xa6\xdbO>a'\x01\x1d\x00\x00\xaaU" DEBUG:pytuya:result='d\x8f\xf6\xc4\xbf\xf1\xb3\xe3\xa0\xaa\xc3Y\xcb\xaeC\x84\xbe\xec\xf6\x9d\x13\x17\xf0P{\x19\xd5\xc7\xa6\xdbO>' DEBUG:pytuya:decrypted result=u'json obj data unvalid' DEBUG:pytuya:status() entry DEBUG:pytuya:json_payload='{"devId":"bfb50067e2c0b15c28udin","gwId":"bfb50067e2c0b15c28udin"}' DEBUG:pytuya:status received data="\x00\x00U\xaa\x00\x00\x00\x00\x00\x00\x00\n\x00\x00\x00,\x00\x00\x00\x01d\x8f\xf6\xc4\xbf\xf1\xb3\xe3\xa0\xaa\xc3Y\xcb\xaeC\x84\xbe\xec\xf6\x9d\x13\x17\xf0P{\x19\xd5\xc7\xa6\xdbO>a'\x01\x1d\x00\x00\xaaU" DEBUG:pytuya:result='d\x8f\xf6\xc4\xbf\xf1\xb3\xe3\xa0\xaa\xc3Y\xcb\xaeC\x84\xbe\xec\xf6\x9d\x13\x17\xf0P{\x19\xd5\xc7\xa6\xdbO>' DEBUG:pytuya:decrypted result=u'json obj data unvalid' DEBUG:pytuya:status() entry DEBUG:pytuya:json_payload='{"devId":"bfb50067e2c0b15c28udin","gwId":"bfb50067e2c0b15c28udin"}' DEBUG:pytuya:status received data="\x00\x00U\xaa\x00\x00\x00\x00\x00\x00\x00\n\x00\x00\x00,\x00\x00\x00\x01d\x8f\xf6\xc4\xbf\xf1\xb3\xe3\xa0\xaa\xc3Y\xcb\xaeC\x84\xbe\xec\xf6\x9d\x13\x17\xf0P{\x19\xd5\xc7\xa6\xdbO>a'\x01\x1d\x00\x00\xaaU" DEBUG:pytuya:result='d\x8f\xf6\xc4\xbf\xf1\xb3\xe3\xa0\xaa\xc3Y\xcb\xaeC\x84\xbe\xec\xf6\x9d\x13\x17\xf0P{\x19\xd5\xc7\xa6\xdbO>' DEBUG:pytuya:decrypted result=u'json obj data unvalid' DEBUG:pytuya:status() entry DEBUG:pytuya:json_payload='{"devId":"bfb50067e2c0b15c28udin","gwId":"bfb50067e2c0b15c28udin"}' DEBUG:pytuya:status received data="\x00\x00U\xaa\x00\x00\x00\x00\x00\x00\x00\n\x00\x00\x00,\x00\x00\x00\x01d\x8f\xf6\xc4\xbf\xf1\xb3\xe3\xa0\xaa\xc3Y\xcb\xaeC\x84\xbe\xec\xf6\x9d\x13\x17\xf0P{\x19\xd5\xc7\xa6\xdbO>a'\x01\x1d\x00\x00\xaaU" DEBUG:pytuya:result='d\x8f\xf6\xc4\xbf\xf1\xb3\xe3\xa0\xaa\xc3Y\xcb\xaeC\x84\xbe\xec\xf6\x9d\x13\x17\xf0P{\x19\xd5\xc7\xa6\xdbO>' DEBUG:pytuya:decrypted result=u'json obj data unvalid'

If there is something I can do, try it somehow or anything, just tell me :)

Thanks you so much for your hard work.

codeclinic commented 4 years ago

Try this from the cli

$ python

import pytuya d = pytuya.OutletDevice('bfb50067e2c0b15c28udin', '192.168.1.158', '{device key}') d.set_version(3.3) d.status()

dferrandizmont commented 4 years ago

This is the result:

Traceback (most recent call last): File "", line 1, in File "/home/pi/.local/lib/python2.7/site-packages/pytuya/init.py", line 311, in status result = json.loads(result) File "/usr/lib/python2.7/json/init.py", line 339, in loads return _default_decoder.decode(s) File "/usr/lib/python2.7/json/decoder.py", line 364, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) File "/usr/lib/python2.7/json/decoder.py", line 382, in raw_decode raise ValueError("No JSON object could be decoded") ValueError: No JSON object could be decoded

pesor commented 4 years ago

I tried the same, here is my response:

d.status() Unexpected status() payload=b':h\x9f\xe4\xce\xc1\xa4H\'CE\xd3\xee":H\xc8\xa7\xf0\x1c\xdboR\x96>KB\t\xf1+\xad\x15' b':h\x9f\xe4\xce\xc1\xa4H\'CE\xd3\xee":H\xc8\xa7\xf0\x1c\xdboR\x96>KB\t\xf1+\xad\x15'

matthewmarra commented 4 years ago

I am having this issue as of yesterday as well.

{"result": "Incomplete response from plug02200199dc4f22143c54 [192.168.0.68].", "deviceid": "02200199dc4f22143c54", "datetime": "2020-02-14T16:00:01Z"}

codeclinic commented 4 years ago

@matthewmarra Ok, well the script hasn't changed so that suggests that the issue lies at you end. The most likely reason is that your devices got an update and now don't work. How are you calling the script?

matthewmarra commented 4 years ago

/usr/bin/python /usr/local/lib/python2.7/dist-packages/tuyapower2mqtt/getstats.py "02200199dc4f22143c54" "192.168.0.68" "08052ce682a9c4e6a9c4e6" "3.3"

matthewmarra commented 4 years ago

I believe my IP addresses may have been re-assigned for whichever reason... let me continue troubleshooting on my end. Apologies and thanks for the prompt response.

matthewmarra commented 4 years ago

I have four switches and they all stopped working. Thinking it's IP related.

matthewmarra commented 4 years ago

It was due to falling off the network, everything is working great thank you!

codeclinic commented 4 years ago

Glad you worked it out.

qntris commented 4 years ago

Hello, I am getting the same error, and when I tried d.status() it shows exactly the same response as the one posted by dferrandizmont. The IP address, the id and the key are correct. Can you give some tips?

stevoh6 commented 3 years ago

@qntris I have same issue. All configs are correct, but Im getting "Incomplete response from plugbf9f8c18b624104b8bxgik [192.168.0.131]."