python-broadlink icon indicating copy to clipboard operation
python-broadlink copied to clipboard

UnicodeDecodeError: 'utf-8' codec can't decode byte 0xea

Open dev4i opened this issue 3 years ago • 0 comments

Getting this error occurring sometimes with the S3 Hub. It seems to resolve on it's own sometimes, but can also be resolved by rebooting the hub.

Error stack trace shows hub.py line 42 - return self._decode(response) and also hub.py line 82 - state = json.loads(payload[0x0C : 0x0C + js_len])

I couldn't figure out what was causing it, but there seems to be some of the JSON missing when i was printing 'payload' on line 80. See output below:

Payload: b'\xa5\xa5ZZ/\xcd\x03\x0b\x1f\x00\x00\x00\xea\x0e\xac\x91\x1d\x05\xf4K\xddV\x8c\x8d+\xda4,"lb_online1":0}\x00\x00\x00\x00\x00'

js_len: 31

A working example was as below:

Payload: b'\xa5\xa5ZZg\xd7\x03\x0bI\x00\x00\x00{"pwr1":0,"pwr2":0,"pwr3":0,"plugmode":0,"hb_timeout":180,"lb_online1":1}\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'

js_len: 73

dev4i avatar Nov 24 '22 14:11 dev4i