mirror of
https://github.com/esphome/esphome.git
synced 2026-02-27 17:34:22 -07:00
The batch UART read change in #13818 exposed a latent bug where the UART parser could start accumulating bytes mid-frame after module restart, causing an infinite cycle of "Max command length exceeded" warnings that prevented initialization. Add header validation for the first 4 bytes of each frame, ensuring the parser only accumulates data starting from a valid DATA_FRAME_HEADER (AA FF 03 00) or CMD_FRAME_HEADER (FD FC FB FA). Non-matching bytes are discarded until a valid frame start is found. Fixes #14131 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>