1
0
mirror of https://github.com/esphome/esphome.git synced 2025-09-04 12:22:20 +01:00

[api] Sync uses_password field_ifdef optimization from aioesphomeapi (#9756)

This commit is contained in:
J. Nick Koston
2025-07-20 18:59:48 -10:00
committed by GitHub
parent fc286c8bf4
commit 305667b06d
5 changed files with 9 additions and 3 deletions

View File

@@ -80,7 +80,9 @@ void DeviceInfo::calculate_size(uint32_t &total_size) const {
}
#endif
void DeviceInfoResponse::encode(ProtoWriteBuffer buffer) const {
#ifdef USE_API_PASSWORD
buffer.encode_bool(1, this->uses_password);
#endif
buffer.encode_string(2, this->name);
buffer.encode_string(3, this->mac_address);
buffer.encode_string(4, this->esphome_version);
@@ -130,7 +132,9 @@ void DeviceInfoResponse::encode(ProtoWriteBuffer buffer) const {
#endif
}
void DeviceInfoResponse::calculate_size(uint32_t &total_size) const {
#ifdef USE_API_PASSWORD
ProtoSize::add_bool_field(total_size, 1, this->uses_password);
#endif
ProtoSize::add_string_field(total_size, 1, this->name);
ProtoSize::add_string_field(total_size, 1, this->mac_address);
ProtoSize::add_string_field(total_size, 1, this->esphome_version);