mirror of
https://github.com/esphome/esphome.git
synced 2026-07-10 17:05:36 +00:00
87622c9a74
Add a max_data_length field option to api_options.proto for string/bytes fields. When max_data_length < 128 and force = true, the code generator uses encode_short_string_force() — a single call that writes the tag byte, 1-byte length varint, and raw string data with no branching. Size calculation simplifies from calc_length(1, size) to 2 + size. Annotate entity fields across all 25 ListEntities*Response messages: - name and object_id: max_data_length = 120, force = true (50 fields) - icon: max_data_length = 63 (25 fields) The 120 and 63 values match NAME_MAX_LENGTH and ICON_MAX_LENGTH in esphome/core/config.py, validated at config time.