File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1212TCPTIMEOUT = 0.4 # Seconds to wait for socket open for scanning
1313DEFAULT_NETWORK = '192.168.0.0/24'
1414
15+ # Heuristic ceiling used to reject corrupt/desynced streams. Most devices only
16+ # have ~256 KiB of RAM and need 2x-3x the payload size for buffers, plus packets
17+ # over ~1440 bytes tend to fragment, so keep the default conservative. Override
18+ # at runtime if a particular device needs larger frames.
19+ MAX_PAYLOAD_LENGTH = 1440
20+
1521# Configuration Files
1622CONFIGFILE = 'tinytuya.json'
1723DEVICEFILE = 'devices.json'
Original file line number Diff line number Diff line change 1010
1111from .crypto_helper import AESCipher
1212from .exceptions import DecodeError
13+ from .const import MAX_PAYLOAD_LENGTH
1314from . import header as H
1415
1516log = logging .getLogger (__name__ )
1617
1718
18- # Heuristic ceiling to reject corrupt/desynced streams. Large IR learn frames
19- # (e.g. air-conditioner codes) exceed 1 KB, so cap generously rather than at 1 KB.
20- MAX_PAYLOAD_LENGTH = 65535
21-
2219# Tuya Packet Format
2320TuyaHeader = namedtuple ('TuyaHeader' , 'prefix seqno cmd length total_length' )
2421MessagePayload = namedtuple ("MessagePayload" , "cmd payload" )
You can’t perform that action at this time.
0 commit comments