Closed milandzuris closed 4 months ago
I think this already been handled in master.
I think this already been handled in master.
I'm not sure. The buffer:
b'\x00\x00U\xaa\x00\x00\x16x\x00\x00\x00\x10\x00\x00\x00\xe8\x00\x00\x00\x00\xdf\x1b\x1f\x0c\x1d\x19\'\xe2\x89\xcbj\x07Z.\xaez@f\xfc\x17i\tt\xf8\xe3\xb8C\xe9}"\xb3\x13I\xbdj-\xa0\xaf\x04\x18\xb2C\xc8\xf2\xc4Cg\x84\x97:\xb6\xda|\xcd`N\x7f\xc3\xc4!\x08\xc5\xf4\x98\x81%\t.\x02\x0e\xa4=\xd0\x8f\xd4\xa5\x95\x12\xa0]\xfa\x0b\x8dX\xd4\x93mE\x8c\xd1Y\x0b\xbf\xfc*B= v\x02v\\rNW\xdc\'\xee\xac&\x13f\xe4m\x17[J^)_\x1c\xb7\xba\x81\xad\x8cT\x8c\xac\xd7\xe6\xd5\xfe\xa2\xce\t\xf2y6\xf3\r\xd4\x14\x9dg\x81\x94PYM.\\\xf8p\xa6c\x82\xec\xd8{\x17\x92\x87\xdeOQEY\xefv\xcb\xf1;\x07\x19`\x86B\xbe\x1cL\x0erP<n\x8d\xc5:t\xaf\x1d\xa5\x0f\x91\x86\xe1M\x99a'
looks like a valid 55AA message without a tail. Its length is 0xe8=232, then retcode=0. The trailing bytes are not 9966, as they would be if it was a tail of 6699 message ('a'=0x61).
My point of view that this is the example that messages may come fragmented! To work it out, another check should be implemented in add_data
, like this:
header = parse_header(self.buffer, logger=self)
if header.total_length < len(self.buffer):
break # waiting for the tail of the message
hmac_key = self.local_key if self.version >= 3.4 else None
"Header claims the packet size is over" exceptions were results of the wrong parser, which is already fixed.
This a a CMD 16 with the total length 248
so it bigger then the length of buffer it won't break.
The check should be the opposite right?
header = parse_header(self.buffer, logger=self)
if len(self.buffer) < header.total_length:
break # waiting for the tail of the message
hmac_key = self.local_key if self.version >= 3.4 else None
The check should be the opposite right?
My bad š You are right!
This issue was closed because it was resolved on the release: []()
LocalTuya Version
No response
Home Assistant Version
2024.5.0b1
Environment
What happened?
A bug happened!
Steps to reproduce.
*
Relevant log output
Diagnostics information.
No response