[climate] Add zero-copy support for API custom fan mode and preset commands (#12402)

This commit is contained in:
J. Nick Koston
2025-12-19 11:18:50 -10:00
committed by GitHub
parent 81e91c2a8f
commit 940afdbb12
8 changed files with 80 additions and 31 deletions
+10 -4
View File
@@ -1392,12 +1392,18 @@ bool ClimateCommandRequest::decode_varint(uint32_t field_id, ProtoVarInt value)
}
bool ClimateCommandRequest::decode_length(uint32_t field_id, ProtoLengthDelimited value) {
switch (field_id) {
case 17:
this->custom_fan_mode = value.as_string();
case 17: {
// Use raw data directly to avoid allocation
this->custom_fan_mode = value.data();
this->custom_fan_mode_len = value.size();
break;
case 21:
this->custom_preset = value.as_string();
}
case 21: {
// Use raw data directly to avoid allocation
this->custom_preset = value.data();
this->custom_preset_len = value.size();
break;
}
default:
return false;
}