mirror of
https://github.com/esphome/esphome.git
synced 2026-07-10 17:05:36 +00:00
e174e579ed
Add max_data_length field option for string/bytes fields. When max_data_length < 128, the codegen emits constant-size length varint calculations and direct byte writes. Annotate all entity name and object_id fields with (max_data_length) = 120 and (force) = true across all 25 ListEntities*Response messages (50 fields). Generated code changes: - calculate_size: `calc_length(1, size)` -> `2 + size` (constant) - encode: `encode_string(N, ref)` -> `write_raw_byte(tag) + write_raw_byte(len) + encode_raw(data, len)` Eliminates 2 function calls per field per entity list response, removes zero-check branches, and removes varint size computation.