diff --git a/esphome/components/api/api_pb2.cpp b/esphome/components/api/api_pb2.cpp index f31c36f97e..ae2906d342 100644 --- a/esphome/components/api/api_pb2.cpp +++ b/esphome/components/api/api_pb2.cpp @@ -1,31 +1,35 @@ // This file was automatically generated with a tool. // See script/api_protobuf/api_protobuf.py - #include "api_pb2.h" - #include "esphome/core/log.h" - #include "esphome/core/helpers.h" - #include +#include "api_pb2.h" +#include "esphome/core/log.h" +#include "esphome/core/helpers.h" +#include namespace esphome::api { - - bool HelloRequest::decode_varint(uint32_t field_id, ProtoVarInt value) { switch (field_id) { - case 2: this->api_version_major = value.as_uint32(); break; - case 3: this->api_version_minor = value.as_uint32(); break; - default: return false; + case 2: + this->api_version_major = value.as_uint32(); + break; + case 3: + this->api_version_minor = value.as_uint32(); + break; + default: + return false; } return true; } bool HelloRequest::decode_length(uint32_t field_id, ProtoLengthDelimited value) { switch (field_id) { case 1: { - // Use raw data directly to avoid allocation - this->client_info = value.data(); - this->client_info_len = value.size(); - break; - } - default: return false; + // Use raw data directly to avoid allocation + this->client_info = value.data(); + this->client_info_len = value.size(); + break; + } + default: + return false; } return true; } @@ -45,12 +49,13 @@ void HelloResponse::calculate_size(ProtoSize &size) const { bool AuthenticationRequest::decode_length(uint32_t field_id, ProtoLengthDelimited value) { switch (field_id) { case 1: { - // Use raw data directly to avoid allocation - this->password = value.data(); - this->password_len = value.size(); - break; - } - default: return false; + // Use raw data directly to avoid allocation + this->password = value.data(); + this->password_len = value.size(); + break; + } + default: + return false; } return true; } @@ -300,22 +305,38 @@ void CoverStateResponse::calculate_size(ProtoSize &size) const { } bool CoverCommandRequest::decode_varint(uint32_t field_id, ProtoVarInt value) { switch (field_id) { - case 4: this->has_position = value.as_bool(); break; - case 6: this->has_tilt = value.as_bool(); break; - case 8: this->stop = value.as_bool(); break; + case 4: + this->has_position = value.as_bool(); + break; + case 6: + this->has_tilt = value.as_bool(); + break; + case 8: + this->stop = value.as_bool(); + break; #ifdef USE_DEVICES - case 9: this->device_id = value.as_uint32(); break; + case 9: + this->device_id = value.as_uint32(); + break; #endif - default: return false; + default: + return false; } return true; } bool CoverCommandRequest::decode_32bit(uint32_t field_id, Proto32Bit value) { switch (field_id) { - case 1: this->key = value.as_fixed32(); break; - case 5: this->position = value.as_float(); break; - case 7: this->tilt = value.as_float(); break; - default: return false; + case 1: + this->key = value.as_fixed32(); + break; + case 5: + this->position = value.as_float(); + break; + case 7: + this->tilt = value.as_float(); + break; + default: + return false; } return true; } @@ -387,33 +408,60 @@ void FanStateResponse::calculate_size(ProtoSize &size) const { } bool FanCommandRequest::decode_varint(uint32_t field_id, ProtoVarInt value) { switch (field_id) { - case 2: this->has_state = value.as_bool(); break; - case 3: this->state = value.as_bool(); break; - case 6: this->has_oscillating = value.as_bool(); break; - case 7: this->oscillating = value.as_bool(); break; - case 8: this->has_direction = value.as_bool(); break; - case 9: this->direction = static_cast(value.as_uint32()); break; - case 10: this->has_speed_level = value.as_bool(); break; - case 11: this->speed_level = value.as_int32(); break; - case 12: this->has_preset_mode = value.as_bool(); break; + case 2: + this->has_state = value.as_bool(); + break; + case 3: + this->state = value.as_bool(); + break; + case 6: + this->has_oscillating = value.as_bool(); + break; + case 7: + this->oscillating = value.as_bool(); + break; + case 8: + this->has_direction = value.as_bool(); + break; + case 9: + this->direction = static_cast(value.as_uint32()); + break; + case 10: + this->has_speed_level = value.as_bool(); + break; + case 11: + this->speed_level = value.as_int32(); + break; + case 12: + this->has_preset_mode = value.as_bool(); + break; #ifdef USE_DEVICES - case 14: this->device_id = value.as_uint32(); break; + case 14: + this->device_id = value.as_uint32(); + break; #endif - default: return false; + default: + return false; } return true; } bool FanCommandRequest::decode_length(uint32_t field_id, ProtoLengthDelimited value) { switch (field_id) { - case 13: this->preset_mode = value.as_string(); break; - default: return false; + case 13: + this->preset_mode = value.as_string(); + break; + default: + return false; } return true; } bool FanCommandRequest::decode_32bit(uint32_t field_id, Proto32Bit value) { switch (field_id) { - case 1: this->key = value.as_fixed32(); break; - default: return false; + case 1: + this->key = value.as_fixed32(); + break; + default: + return false; } return true; } @@ -503,49 +551,108 @@ void LightStateResponse::calculate_size(ProtoSize &size) const { } bool LightCommandRequest::decode_varint(uint32_t field_id, ProtoVarInt value) { switch (field_id) { - case 2: this->has_state = value.as_bool(); break; - case 3: this->state = value.as_bool(); break; - case 4: this->has_brightness = value.as_bool(); break; - case 22: this->has_color_mode = value.as_bool(); break; - case 23: this->color_mode = static_cast(value.as_uint32()); break; - case 20: this->has_color_brightness = value.as_bool(); break; - case 6: this->has_rgb = value.as_bool(); break; - case 10: this->has_white = value.as_bool(); break; - case 12: this->has_color_temperature = value.as_bool(); break; - case 24: this->has_cold_white = value.as_bool(); break; - case 26: this->has_warm_white = value.as_bool(); break; - case 14: this->has_transition_length = value.as_bool(); break; - case 15: this->transition_length = value.as_uint32(); break; - case 16: this->has_flash_length = value.as_bool(); break; - case 17: this->flash_length = value.as_uint32(); break; - case 18: this->has_effect = value.as_bool(); break; + case 2: + this->has_state = value.as_bool(); + break; + case 3: + this->state = value.as_bool(); + break; + case 4: + this->has_brightness = value.as_bool(); + break; + case 22: + this->has_color_mode = value.as_bool(); + break; + case 23: + this->color_mode = static_cast(value.as_uint32()); + break; + case 20: + this->has_color_brightness = value.as_bool(); + break; + case 6: + this->has_rgb = value.as_bool(); + break; + case 10: + this->has_white = value.as_bool(); + break; + case 12: + this->has_color_temperature = value.as_bool(); + break; + case 24: + this->has_cold_white = value.as_bool(); + break; + case 26: + this->has_warm_white = value.as_bool(); + break; + case 14: + this->has_transition_length = value.as_bool(); + break; + case 15: + this->transition_length = value.as_uint32(); + break; + case 16: + this->has_flash_length = value.as_bool(); + break; + case 17: + this->flash_length = value.as_uint32(); + break; + case 18: + this->has_effect = value.as_bool(); + break; #ifdef USE_DEVICES - case 28: this->device_id = value.as_uint32(); break; + case 28: + this->device_id = value.as_uint32(); + break; #endif - default: return false; + default: + return false; } return true; } bool LightCommandRequest::decode_length(uint32_t field_id, ProtoLengthDelimited value) { switch (field_id) { - case 19: this->effect = value.as_string(); break; - default: return false; + case 19: + this->effect = value.as_string(); + break; + default: + return false; } return true; } bool LightCommandRequest::decode_32bit(uint32_t field_id, Proto32Bit value) { switch (field_id) { - case 1: this->key = value.as_fixed32(); break; - case 5: this->brightness = value.as_float(); break; - case 21: this->color_brightness = value.as_float(); break; - case 7: this->red = value.as_float(); break; - case 8: this->green = value.as_float(); break; - case 9: this->blue = value.as_float(); break; - case 11: this->white = value.as_float(); break; - case 13: this->color_temperature = value.as_float(); break; - case 25: this->cold_white = value.as_float(); break; - case 27: this->warm_white = value.as_float(); break; - default: return false; + case 1: + this->key = value.as_fixed32(); + break; + case 5: + this->brightness = value.as_float(); + break; + case 21: + this->color_brightness = value.as_float(); + break; + case 7: + this->red = value.as_float(); + break; + case 8: + this->green = value.as_float(); + break; + case 9: + this->blue = value.as_float(); + break; + case 11: + this->white = value.as_float(); + break; + case 13: + this->color_temperature = value.as_float(); + break; + case 25: + this->cold_white = value.as_float(); + break; + case 27: + this->warm_white = value.as_float(); + break; + default: + return false; } return true; } @@ -651,18 +758,26 @@ void SwitchStateResponse::calculate_size(ProtoSize &size) const { } bool SwitchCommandRequest::decode_varint(uint32_t field_id, ProtoVarInt value) { switch (field_id) { - case 2: this->state = value.as_bool(); break; + case 2: + this->state = value.as_bool(); + break; #ifdef USE_DEVICES - case 3: this->device_id = value.as_uint32(); break; + case 3: + this->device_id = value.as_uint32(); + break; #endif - default: return false; + default: + return false; } return true; } bool SwitchCommandRequest::decode_32bit(uint32_t field_id, Proto32Bit value) { switch (field_id) { - case 1: this->key = value.as_fixed32(); break; - default: return false; + case 1: + this->key = value.as_fixed32(); + break; + default: + return false; } return true; } @@ -715,9 +830,14 @@ void TextSensorStateResponse::calculate_size(ProtoSize &size) const { #endif bool SubscribeLogsRequest::decode_varint(uint32_t field_id, ProtoVarInt value) { switch (field_id) { - case 1: this->level = static_cast(value.as_uint32()); break; - case 2: this->dump_config = value.as_bool(); break; - default: return false; + case 1: + this->level = static_cast(value.as_uint32()); + break; + case 2: + this->dump_config = value.as_bool(); + break; + default: + return false; } return true; } @@ -732,8 +852,11 @@ void SubscribeLogsResponse::calculate_size(ProtoSize &size) const { #ifdef USE_API_NOISE bool NoiseEncryptionSetKeyRequest::decode_length(uint32_t field_id, ProtoLengthDelimited value) { switch (field_id) { - case 1: this->key = value.as_string(); break; - default: return false; + case 1: + this->key = value.as_string(); + break; + default: + return false; } return true; } @@ -791,24 +914,32 @@ void HomeassistantActionRequest::calculate_size(ProtoSize &size) const { #ifdef USE_API_HOMEASSISTANT_ACTION_RESPONSES bool HomeassistantActionResponse::decode_varint(uint32_t field_id, ProtoVarInt value) { switch (field_id) { - case 1: this->call_id = value.as_uint32(); break; - case 2: this->success = value.as_bool(); break; - default: return false; + case 1: + this->call_id = value.as_uint32(); + break; + case 2: + this->success = value.as_bool(); + break; + default: + return false; } return true; } bool HomeassistantActionResponse::decode_length(uint32_t field_id, ProtoLengthDelimited value) { switch (field_id) { - case 3: this->error_message = value.as_string(); break; + case 3: + this->error_message = value.as_string(); + break; #ifdef USE_API_HOMEASSISTANT_ACTION_RESPONSES_JSON case 4: { - // Use raw data directly to avoid allocation - this->response_data = value.data(); - this->response_data_len = value.size(); - break; - } + // Use raw data directly to avoid allocation + this->response_data = value.data(); + this->response_data_len = value.size(); + break; + } #endif - default: return false; + default: + return false; } return true; } @@ -826,10 +957,17 @@ void SubscribeHomeAssistantStateResponse::calculate_size(ProtoSize &size) const } bool HomeAssistantStateResponse::decode_length(uint32_t field_id, ProtoLengthDelimited value) { switch (field_id) { - case 1: this->entity_id = value.as_string(); break; - case 2: this->state = value.as_string(); break; - case 3: this->attribute = value.as_string(); break; - default: return false; + case 1: + this->entity_id = value.as_string(); + break; + case 2: + this->state = value.as_string(); + break; + case 3: + this->attribute = value.as_string(); + break; + default: + return false; } return true; } @@ -837,19 +975,23 @@ bool HomeAssistantStateResponse::decode_length(uint32_t field_id, ProtoLengthDel bool GetTimeResponse::decode_length(uint32_t field_id, ProtoLengthDelimited value) { switch (field_id) { case 2: { - // Use raw data directly to avoid allocation - this->timezone = value.data(); - this->timezone_len = value.size(); - break; - } - default: return false; + // Use raw data directly to avoid allocation + this->timezone = value.data(); + this->timezone_len = value.size(); + break; + } + default: + return false; } return true; } bool GetTimeResponse::decode_32bit(uint32_t field_id, Proto32Bit value) { switch (field_id) { - case 1: this->epoch_seconds = value.as_fixed32(); break; - default: return false; + case 1: + this->epoch_seconds = value.as_fixed32(); + break; + default: + return false; } return true; } @@ -876,28 +1018,49 @@ void ListEntitiesServicesResponse::calculate_size(ProtoSize &size) const { } bool ExecuteServiceArgument::decode_varint(uint32_t field_id, ProtoVarInt value) { switch (field_id) { - case 1: this->bool_ = value.as_bool(); break; - case 2: this->legacy_int = value.as_int32(); break; - case 5: this->int_ = value.as_sint32(); break; - case 6: this->bool_array.push_back(value.as_bool()); break; - case 7: this->int_array.push_back(value.as_sint32()); break; - default: return false; + case 1: + this->bool_ = value.as_bool(); + break; + case 2: + this->legacy_int = value.as_int32(); + break; + case 5: + this->int_ = value.as_sint32(); + break; + case 6: + this->bool_array.push_back(value.as_bool()); + break; + case 7: + this->int_array.push_back(value.as_sint32()); + break; + default: + return false; } return true; } bool ExecuteServiceArgument::decode_length(uint32_t field_id, ProtoLengthDelimited value) { switch (field_id) { - case 4: this->string_ = value.as_string(); break; - case 9: this->string_array.push_back(value.as_string()); break; - default: return false; + case 4: + this->string_ = value.as_string(); + break; + case 9: + this->string_array.push_back(value.as_string()); + break; + default: + return false; } return true; } bool ExecuteServiceArgument::decode_32bit(uint32_t field_id, Proto32Bit value) { switch (field_id) { - case 3: this->float_ = value.as_float(); break; - case 8: this->float_array.push_back(value.as_float()); break; - default: return false; + case 3: + this->float_ = value.as_float(); + break; + case 8: + this->float_array.push_back(value.as_float()); + break; + default: + return false; } return true; } @@ -915,23 +1078,33 @@ void ExecuteServiceArgument::decode(const uint8_t *buffer, size_t length) { bool ExecuteServiceRequest::decode_varint(uint32_t field_id, ProtoVarInt value) { switch (field_id) { #ifdef USE_API_SERVICE_RESPONSES - case 3: this->call_id = value.as_uint32(); break; + case 3: + this->call_id = value.as_uint32(); + break; #endif - default: return false; + default: + return false; } return true; } bool ExecuteServiceRequest::decode_length(uint32_t field_id, ProtoLengthDelimited value) { switch (field_id) { - case 2: this->args.emplace_back(); value.decode_to_message(this->args.back()); break; - default: return false; + case 2: + this->args.emplace_back(); + value.decode_to_message(this->args.back()); + break; + default: + return false; } return true; } bool ExecuteServiceRequest::decode_32bit(uint32_t field_id, Proto32Bit value) { switch (field_id) { - case 1: this->key = value.as_fixed32(); break; - default: return false; + case 1: + this->key = value.as_fixed32(); + break; + default: + return false; } return true; } @@ -1004,9 +1177,14 @@ void CameraImageResponse::calculate_size(ProtoSize &size) const { } bool CameraImageRequest::decode_varint(uint32_t field_id, ProtoVarInt value) { switch (field_id) { - case 1: this->single = value.as_bool(); break; - case 2: this->stream = value.as_bool(); break; - default: return false; + case 1: + this->single = value.as_bool(); + break; + case 2: + this->stream = value.as_bool(); + break; + default: + return false; } return true; } @@ -1150,43 +1328,90 @@ void ClimateStateResponse::calculate_size(ProtoSize &size) const { } bool ClimateCommandRequest::decode_varint(uint32_t field_id, ProtoVarInt value) { switch (field_id) { - case 2: this->has_mode = value.as_bool(); break; - case 3: this->mode = static_cast(value.as_uint32()); break; - case 4: this->has_target_temperature = value.as_bool(); break; - case 6: this->has_target_temperature_low = value.as_bool(); break; - case 8: this->has_target_temperature_high = value.as_bool(); break; - case 12: this->has_fan_mode = value.as_bool(); break; - case 13: this->fan_mode = static_cast(value.as_uint32()); break; - case 14: this->has_swing_mode = value.as_bool(); break; - case 15: this->swing_mode = static_cast(value.as_uint32()); break; - case 16: this->has_custom_fan_mode = value.as_bool(); break; - case 18: this->has_preset = value.as_bool(); break; - case 19: this->preset = static_cast(value.as_uint32()); break; - case 20: this->has_custom_preset = value.as_bool(); break; - case 22: this->has_target_humidity = value.as_bool(); break; + case 2: + this->has_mode = value.as_bool(); + break; + case 3: + this->mode = static_cast(value.as_uint32()); + break; + case 4: + this->has_target_temperature = value.as_bool(); + break; + case 6: + this->has_target_temperature_low = value.as_bool(); + break; + case 8: + this->has_target_temperature_high = value.as_bool(); + break; + case 12: + this->has_fan_mode = value.as_bool(); + break; + case 13: + this->fan_mode = static_cast(value.as_uint32()); + break; + case 14: + this->has_swing_mode = value.as_bool(); + break; + case 15: + this->swing_mode = static_cast(value.as_uint32()); + break; + case 16: + this->has_custom_fan_mode = value.as_bool(); + break; + case 18: + this->has_preset = value.as_bool(); + break; + case 19: + this->preset = static_cast(value.as_uint32()); + break; + case 20: + this->has_custom_preset = value.as_bool(); + break; + case 22: + this->has_target_humidity = value.as_bool(); + break; #ifdef USE_DEVICES - case 24: this->device_id = value.as_uint32(); break; + case 24: + this->device_id = value.as_uint32(); + break; #endif - default: return false; + default: + return false; } return true; } bool ClimateCommandRequest::decode_length(uint32_t field_id, ProtoLengthDelimited value) { switch (field_id) { - case 17: this->custom_fan_mode = value.as_string(); break; - case 21: this->custom_preset = value.as_string(); break; - default: return false; + case 17: + this->custom_fan_mode = value.as_string(); + break; + case 21: + this->custom_preset = value.as_string(); + break; + default: + return false; } return true; } bool ClimateCommandRequest::decode_32bit(uint32_t field_id, Proto32Bit value) { switch (field_id) { - case 1: this->key = value.as_fixed32(); break; - case 5: this->target_temperature = value.as_float(); break; - case 7: this->target_temperature_low = value.as_float(); break; - case 9: this->target_temperature_high = value.as_float(); break; - case 23: this->target_humidity = value.as_float(); break; - default: return false; + case 1: + this->key = value.as_fixed32(); + break; + case 5: + this->target_temperature = value.as_float(); + break; + case 7: + this->target_temperature_low = value.as_float(); + break; + case 9: + this->target_temperature_high = value.as_float(); + break; + case 23: + this->target_humidity = value.as_float(); + break; + default: + return false; } return true; } @@ -1249,17 +1474,25 @@ void NumberStateResponse::calculate_size(ProtoSize &size) const { bool NumberCommandRequest::decode_varint(uint32_t field_id, ProtoVarInt value) { switch (field_id) { #ifdef USE_DEVICES - case 3: this->device_id = value.as_uint32(); break; + case 3: + this->device_id = value.as_uint32(); + break; #endif - default: return false; + default: + return false; } return true; } bool NumberCommandRequest::decode_32bit(uint32_t field_id, Proto32Bit value) { switch (field_id) { - case 1: this->key = value.as_fixed32(); break; - case 2: this->state = value.as_float(); break; - default: return false; + case 1: + this->key = value.as_fixed32(); + break; + case 2: + this->state = value.as_float(); + break; + default: + return false; } return true; } @@ -1318,23 +1551,32 @@ void SelectStateResponse::calculate_size(ProtoSize &size) const { bool SelectCommandRequest::decode_varint(uint32_t field_id, ProtoVarInt value) { switch (field_id) { #ifdef USE_DEVICES - case 3: this->device_id = value.as_uint32(); break; + case 3: + this->device_id = value.as_uint32(); + break; #endif - default: return false; + default: + return false; } return true; } bool SelectCommandRequest::decode_length(uint32_t field_id, ProtoLengthDelimited value) { switch (field_id) { - case 2: this->state = value.as_string(); break; - default: return false; + case 2: + this->state = value.as_string(); + break; + default: + return false; } return true; } bool SelectCommandRequest::decode_32bit(uint32_t field_id, Proto32Bit value) { switch (field_id) { - case 1: this->key = value.as_fixed32(); break; - default: return false; + case 1: + this->key = value.as_fixed32(); + break; + default: + return false; } return true; } @@ -1394,31 +1636,54 @@ void SirenStateResponse::calculate_size(ProtoSize &size) const { } bool SirenCommandRequest::decode_varint(uint32_t field_id, ProtoVarInt value) { switch (field_id) { - case 2: this->has_state = value.as_bool(); break; - case 3: this->state = value.as_bool(); break; - case 4: this->has_tone = value.as_bool(); break; - case 6: this->has_duration = value.as_bool(); break; - case 7: this->duration = value.as_uint32(); break; - case 8: this->has_volume = value.as_bool(); break; + case 2: + this->has_state = value.as_bool(); + break; + case 3: + this->state = value.as_bool(); + break; + case 4: + this->has_tone = value.as_bool(); + break; + case 6: + this->has_duration = value.as_bool(); + break; + case 7: + this->duration = value.as_uint32(); + break; + case 8: + this->has_volume = value.as_bool(); + break; #ifdef USE_DEVICES - case 10: this->device_id = value.as_uint32(); break; + case 10: + this->device_id = value.as_uint32(); + break; #endif - default: return false; + default: + return false; } return true; } bool SirenCommandRequest::decode_length(uint32_t field_id, ProtoLengthDelimited value) { switch (field_id) { - case 5: this->tone = value.as_string(); break; - default: return false; + case 5: + this->tone = value.as_string(); + break; + default: + return false; } return true; } bool SirenCommandRequest::decode_32bit(uint32_t field_id, Proto32Bit value) { switch (field_id) { - case 1: this->key = value.as_fixed32(); break; - case 9: this->volume = value.as_float(); break; - default: return false; + case 1: + this->key = value.as_fixed32(); + break; + case 9: + this->volume = value.as_float(); + break; + default: + return false; } return true; } @@ -1474,26 +1739,39 @@ void LockStateResponse::calculate_size(ProtoSize &size) const { } bool LockCommandRequest::decode_varint(uint32_t field_id, ProtoVarInt value) { switch (field_id) { - case 2: this->command = static_cast(value.as_uint32()); break; - case 3: this->has_code = value.as_bool(); break; + case 2: + this->command = static_cast(value.as_uint32()); + break; + case 3: + this->has_code = value.as_bool(); + break; #ifdef USE_DEVICES - case 5: this->device_id = value.as_uint32(); break; + case 5: + this->device_id = value.as_uint32(); + break; #endif - default: return false; + default: + return false; } return true; } bool LockCommandRequest::decode_length(uint32_t field_id, ProtoLengthDelimited value) { switch (field_id) { - case 4: this->code = value.as_string(); break; - default: return false; + case 4: + this->code = value.as_string(); + break; + default: + return false; } return true; } bool LockCommandRequest::decode_32bit(uint32_t field_id, Proto32Bit value) { switch (field_id) { - case 1: this->key = value.as_fixed32(); break; - default: return false; + case 1: + this->key = value.as_fixed32(); + break; + default: + return false; } return true; } @@ -1530,16 +1808,22 @@ void ListEntitiesButtonResponse::calculate_size(ProtoSize &size) const { bool ButtonCommandRequest::decode_varint(uint32_t field_id, ProtoVarInt value) { switch (field_id) { #ifdef USE_DEVICES - case 2: this->device_id = value.as_uint32(); break; + case 2: + this->device_id = value.as_uint32(); + break; #endif - default: return false; + default: + return false; } return true; } bool ButtonCommandRequest::decode_32bit(uint32_t field_id, Proto32Bit value) { switch (field_id) { - case 1: this->key = value.as_fixed32(); break; - default: return false; + case 1: + this->key = value.as_fixed32(); + break; + default: + return false; } return true; } @@ -1613,31 +1897,54 @@ void MediaPlayerStateResponse::calculate_size(ProtoSize &size) const { } bool MediaPlayerCommandRequest::decode_varint(uint32_t field_id, ProtoVarInt value) { switch (field_id) { - case 2: this->has_command = value.as_bool(); break; - case 3: this->command = static_cast(value.as_uint32()); break; - case 4: this->has_volume = value.as_bool(); break; - case 6: this->has_media_url = value.as_bool(); break; - case 8: this->has_announcement = value.as_bool(); break; - case 9: this->announcement = value.as_bool(); break; + case 2: + this->has_command = value.as_bool(); + break; + case 3: + this->command = static_cast(value.as_uint32()); + break; + case 4: + this->has_volume = value.as_bool(); + break; + case 6: + this->has_media_url = value.as_bool(); + break; + case 8: + this->has_announcement = value.as_bool(); + break; + case 9: + this->announcement = value.as_bool(); + break; #ifdef USE_DEVICES - case 10: this->device_id = value.as_uint32(); break; + case 10: + this->device_id = value.as_uint32(); + break; #endif - default: return false; + default: + return false; } return true; } bool MediaPlayerCommandRequest::decode_length(uint32_t field_id, ProtoLengthDelimited value) { switch (field_id) { - case 7: this->media_url = value.as_string(); break; - default: return false; + case 7: + this->media_url = value.as_string(); + break; + default: + return false; } return true; } bool MediaPlayerCommandRequest::decode_32bit(uint32_t field_id, Proto32Bit value) { switch (field_id) { - case 1: this->key = value.as_fixed32(); break; - case 5: this->volume = value.as_float(); break; - default: return false; + case 1: + this->key = value.as_fixed32(); + break; + case 5: + this->volume = value.as_float(); + break; + default: + return false; } return true; } @@ -1645,8 +1952,11 @@ bool MediaPlayerCommandRequest::decode_32bit(uint32_t field_id, Proto32Bit value #ifdef USE_BLUETOOTH_PROXY bool SubscribeBluetoothLEAdvertisementsRequest::decode_varint(uint32_t field_id, ProtoVarInt value) { switch (field_id) { - case 1: this->flags = value.as_uint32(); break; - default: return false; + case 1: + this->flags = value.as_uint32(); + break; + default: + return false; } return true; } @@ -1674,11 +1984,20 @@ void BluetoothLERawAdvertisementsResponse::calculate_size(ProtoSize &size) const } bool BluetoothDeviceRequest::decode_varint(uint32_t field_id, ProtoVarInt value) { switch (field_id) { - case 1: this->address = value.as_uint64(); break; - case 2: this->request_type = static_cast(value.as_uint32()); break; - case 3: this->has_address_type = value.as_bool(); break; - case 4: this->address_type = value.as_uint32(); break; - default: return false; + case 1: + this->address = value.as_uint64(); + break; + case 2: + this->request_type = static_cast(value.as_uint32()); + break; + case 3: + this->has_address_type = value.as_bool(); + break; + case 4: + this->address_type = value.as_uint32(); + break; + default: + return false; } return true; } @@ -1696,8 +2015,11 @@ void BluetoothDeviceConnectionResponse::calculate_size(ProtoSize &size) const { } bool BluetoothGATTGetServicesRequest::decode_varint(uint32_t field_id, ProtoVarInt value) { switch (field_id) { - case 1: this->address = value.as_uint64(); break; - default: return false; + case 1: + this->address = value.as_uint64(); + break; + default: + return false; } return true; } @@ -1775,9 +2097,14 @@ void BluetoothGATTGetServicesDoneResponse::encode(ProtoWriteBuffer buffer) const void BluetoothGATTGetServicesDoneResponse::calculate_size(ProtoSize &size) const { size.add_uint64(1, this->address); } bool BluetoothGATTReadRequest::decode_varint(uint32_t field_id, ProtoVarInt value) { switch (field_id) { - case 1: this->address = value.as_uint64(); break; - case 2: this->handle = value.as_uint32(); break; - default: return false; + case 1: + this->address = value.as_uint64(); + break; + case 2: + this->handle = value.as_uint32(); + break; + default: + return false; } return true; } @@ -1793,59 +2120,85 @@ void BluetoothGATTReadResponse::calculate_size(ProtoSize &size) const { } bool BluetoothGATTWriteRequest::decode_varint(uint32_t field_id, ProtoVarInt value) { switch (field_id) { - case 1: this->address = value.as_uint64(); break; - case 2: this->handle = value.as_uint32(); break; - case 3: this->response = value.as_bool(); break; - default: return false; + case 1: + this->address = value.as_uint64(); + break; + case 2: + this->handle = value.as_uint32(); + break; + case 3: + this->response = value.as_bool(); + break; + default: + return false; } return true; } bool BluetoothGATTWriteRequest::decode_length(uint32_t field_id, ProtoLengthDelimited value) { switch (field_id) { case 4: { - // Use raw data directly to avoid allocation - this->data = value.data(); - this->data_len = value.size(); - break; - } - default: return false; + // Use raw data directly to avoid allocation + this->data = value.data(); + this->data_len = value.size(); + break; + } + default: + return false; } return true; } bool BluetoothGATTReadDescriptorRequest::decode_varint(uint32_t field_id, ProtoVarInt value) { switch (field_id) { - case 1: this->address = value.as_uint64(); break; - case 2: this->handle = value.as_uint32(); break; - default: return false; + case 1: + this->address = value.as_uint64(); + break; + case 2: + this->handle = value.as_uint32(); + break; + default: + return false; } return true; } bool BluetoothGATTWriteDescriptorRequest::decode_varint(uint32_t field_id, ProtoVarInt value) { switch (field_id) { - case 1: this->address = value.as_uint64(); break; - case 2: this->handle = value.as_uint32(); break; - default: return false; + case 1: + this->address = value.as_uint64(); + break; + case 2: + this->handle = value.as_uint32(); + break; + default: + return false; } return true; } bool BluetoothGATTWriteDescriptorRequest::decode_length(uint32_t field_id, ProtoLengthDelimited value) { switch (field_id) { case 3: { - // Use raw data directly to avoid allocation - this->data = value.data(); - this->data_len = value.size(); - break; - } - default: return false; + // Use raw data directly to avoid allocation + this->data = value.data(); + this->data_len = value.size(); + break; + } + default: + return false; } return true; } bool BluetoothGATTNotifyRequest::decode_varint(uint32_t field_id, ProtoVarInt value) { switch (field_id) { - case 1: this->address = value.as_uint64(); break; - case 2: this->handle = value.as_uint32(); break; - case 3: this->enable = value.as_bool(); break; - default: return false; + case 1: + this->address = value.as_uint64(); + break; + case 2: + this->handle = value.as_uint32(); + break; + case 3: + this->enable = value.as_bool(); + break; + default: + return false; } return true; } @@ -1945,8 +2298,11 @@ void BluetoothScannerStateResponse::calculate_size(ProtoSize &size) const { } bool BluetoothScannerSetModeRequest::decode_varint(uint32_t field_id, ProtoVarInt value) { switch (field_id) { - case 1: this->mode = static_cast(value.as_uint32()); break; - default: return false; + case 1: + this->mode = static_cast(value.as_uint32()); + break; + default: + return false; } return true; } @@ -1954,9 +2310,14 @@ bool BluetoothScannerSetModeRequest::decode_varint(uint32_t field_id, ProtoVarIn #ifdef USE_VOICE_ASSISTANT bool SubscribeVoiceAssistantRequest::decode_varint(uint32_t field_id, ProtoVarInt value) { switch (field_id) { - case 1: this->subscribe = value.as_bool(); break; - case 2: this->flags = value.as_uint32(); break; - default: return false; + case 1: + this->subscribe = value.as_bool(); + break; + case 2: + this->flags = value.as_uint32(); + break; + default: + return false; } return true; } @@ -1986,45 +2347,68 @@ void VoiceAssistantRequest::calculate_size(ProtoSize &size) const { } bool VoiceAssistantResponse::decode_varint(uint32_t field_id, ProtoVarInt value) { switch (field_id) { - case 1: this->port = value.as_uint32(); break; - case 2: this->error = value.as_bool(); break; - default: return false; + case 1: + this->port = value.as_uint32(); + break; + case 2: + this->error = value.as_bool(); + break; + default: + return false; } return true; } bool VoiceAssistantEventData::decode_length(uint32_t field_id, ProtoLengthDelimited value) { switch (field_id) { - case 1: this->name = value.as_string(); break; - case 2: this->value = value.as_string(); break; - default: return false; + case 1: + this->name = value.as_string(); + break; + case 2: + this->value = value.as_string(); + break; + default: + return false; } return true; } bool VoiceAssistantEventResponse::decode_varint(uint32_t field_id, ProtoVarInt value) { switch (field_id) { - case 1: this->event_type = static_cast(value.as_uint32()); break; - default: return false; + case 1: + this->event_type = static_cast(value.as_uint32()); + break; + default: + return false; } return true; } bool VoiceAssistantEventResponse::decode_length(uint32_t field_id, ProtoLengthDelimited value) { switch (field_id) { - case 2: this->data.emplace_back(); value.decode_to_message(this->data.back()); break; - default: return false; + case 2: + this->data.emplace_back(); + value.decode_to_message(this->data.back()); + break; + default: + return false; } return true; } bool VoiceAssistantAudio::decode_varint(uint32_t field_id, ProtoVarInt value) { switch (field_id) { - case 2: this->end = value.as_bool(); break; - default: return false; + case 2: + this->end = value.as_bool(); + break; + default: + return false; } return true; } bool VoiceAssistantAudio::decode_length(uint32_t field_id, ProtoLengthDelimited value) { switch (field_id) { - case 1: this->data = value.as_string(); break; - default: return false; + case 1: + this->data = value.as_string(); + break; + default: + return false; } return true; } @@ -2038,35 +2422,59 @@ void VoiceAssistantAudio::calculate_size(ProtoSize &size) const { } bool VoiceAssistantTimerEventResponse::decode_varint(uint32_t field_id, ProtoVarInt value) { switch (field_id) { - case 1: this->event_type = static_cast(value.as_uint32()); break; - case 4: this->total_seconds = value.as_uint32(); break; - case 5: this->seconds_left = value.as_uint32(); break; - case 6: this->is_active = value.as_bool(); break; - default: return false; + case 1: + this->event_type = static_cast(value.as_uint32()); + break; + case 4: + this->total_seconds = value.as_uint32(); + break; + case 5: + this->seconds_left = value.as_uint32(); + break; + case 6: + this->is_active = value.as_bool(); + break; + default: + return false; } return true; } bool VoiceAssistantTimerEventResponse::decode_length(uint32_t field_id, ProtoLengthDelimited value) { switch (field_id) { - case 2: this->timer_id = value.as_string(); break; - case 3: this->name = value.as_string(); break; - default: return false; + case 2: + this->timer_id = value.as_string(); + break; + case 3: + this->name = value.as_string(); + break; + default: + return false; } return true; } bool VoiceAssistantAnnounceRequest::decode_varint(uint32_t field_id, ProtoVarInt value) { switch (field_id) { - case 4: this->start_conversation = value.as_bool(); break; - default: return false; + case 4: + this->start_conversation = value.as_bool(); + break; + default: + return false; } return true; } bool VoiceAssistantAnnounceRequest::decode_length(uint32_t field_id, ProtoLengthDelimited value) { switch (field_id) { - case 1: this->media_id = value.as_string(); break; - case 2: this->text = value.as_string(); break; - case 3: this->preannounce_media_id = value.as_string(); break; - default: return false; + case 1: + this->media_id = value.as_string(); + break; + case 2: + this->text = value.as_string(); + break; + case 3: + this->preannounce_media_id = value.as_string(); + break; + default: + return false; } return true; } @@ -2090,27 +2498,47 @@ void VoiceAssistantWakeWord::calculate_size(ProtoSize &size) const { } bool VoiceAssistantExternalWakeWord::decode_varint(uint32_t field_id, ProtoVarInt value) { switch (field_id) { - case 5: this->model_size = value.as_uint32(); break; - default: return false; + case 5: + this->model_size = value.as_uint32(); + break; + default: + return false; } return true; } bool VoiceAssistantExternalWakeWord::decode_length(uint32_t field_id, ProtoLengthDelimited value) { switch (field_id) { - case 1: this->id = value.as_string(); break; - case 2: this->wake_word = value.as_string(); break; - case 3: this->trained_languages.push_back(value.as_string()); break; - case 4: this->model_type = value.as_string(); break; - case 6: this->model_hash = value.as_string(); break; - case 7: this->url = value.as_string(); break; - default: return false; + case 1: + this->id = value.as_string(); + break; + case 2: + this->wake_word = value.as_string(); + break; + case 3: + this->trained_languages.push_back(value.as_string()); + break; + case 4: + this->model_type = value.as_string(); + break; + case 6: + this->model_hash = value.as_string(); + break; + case 7: + this->url = value.as_string(); + break; + default: + return false; } return true; } bool VoiceAssistantConfigurationRequest::decode_length(uint32_t field_id, ProtoLengthDelimited value) { switch (field_id) { - case 1: this->external_wake_words.emplace_back(); value.decode_to_message(this->external_wake_words.back()); break; - default: return false; + case 1: + this->external_wake_words.emplace_back(); + value.decode_to_message(this->external_wake_words.back()); + break; + default: + return false; } return true; } @@ -2134,8 +2562,11 @@ void VoiceAssistantConfigurationResponse::calculate_size(ProtoSize &size) const } bool VoiceAssistantSetConfiguration::decode_length(uint32_t field_id, ProtoLengthDelimited value) { switch (field_id) { - case 1: this->active_wake_words.push_back(value.as_string()); break; - default: return false; + case 1: + this->active_wake_words.push_back(value.as_string()); + break; + default: + return false; } return true; } @@ -2189,25 +2620,36 @@ void AlarmControlPanelStateResponse::calculate_size(ProtoSize &size) const { } bool AlarmControlPanelCommandRequest::decode_varint(uint32_t field_id, ProtoVarInt value) { switch (field_id) { - case 2: this->command = static_cast(value.as_uint32()); break; + case 2: + this->command = static_cast(value.as_uint32()); + break; #ifdef USE_DEVICES - case 4: this->device_id = value.as_uint32(); break; + case 4: + this->device_id = value.as_uint32(); + break; #endif - default: return false; + default: + return false; } return true; } bool AlarmControlPanelCommandRequest::decode_length(uint32_t field_id, ProtoLengthDelimited value) { switch (field_id) { - case 3: this->code = value.as_string(); break; - default: return false; + case 3: + this->code = value.as_string(); + break; + default: + return false; } return true; } bool AlarmControlPanelCommandRequest::decode_32bit(uint32_t field_id, Proto32Bit value) { switch (field_id) { - case 1: this->key = value.as_fixed32(); break; - default: return false; + case 1: + this->key = value.as_fixed32(); + break; + default: + return false; } return true; } @@ -2266,23 +2708,32 @@ void TextStateResponse::calculate_size(ProtoSize &size) const { bool TextCommandRequest::decode_varint(uint32_t field_id, ProtoVarInt value) { switch (field_id) { #ifdef USE_DEVICES - case 3: this->device_id = value.as_uint32(); break; + case 3: + this->device_id = value.as_uint32(); + break; #endif - default: return false; + default: + return false; } return true; } bool TextCommandRequest::decode_length(uint32_t field_id, ProtoLengthDelimited value) { switch (field_id) { - case 2: this->state = value.as_string(); break; - default: return false; + case 2: + this->state = value.as_string(); + break; + default: + return false; } return true; } bool TextCommandRequest::decode_32bit(uint32_t field_id, Proto32Bit value) { switch (field_id) { - case 1: this->key = value.as_fixed32(); break; - default: return false; + case 1: + this->key = value.as_fixed32(); + break; + default: + return false; } return true; } @@ -2336,20 +2787,32 @@ void DateStateResponse::calculate_size(ProtoSize &size) const { } bool DateCommandRequest::decode_varint(uint32_t field_id, ProtoVarInt value) { switch (field_id) { - case 2: this->year = value.as_uint32(); break; - case 3: this->month = value.as_uint32(); break; - case 4: this->day = value.as_uint32(); break; + case 2: + this->year = value.as_uint32(); + break; + case 3: + this->month = value.as_uint32(); + break; + case 4: + this->day = value.as_uint32(); + break; #ifdef USE_DEVICES - case 5: this->device_id = value.as_uint32(); break; + case 5: + this->device_id = value.as_uint32(); + break; #endif - default: return false; + default: + return false; } return true; } bool DateCommandRequest::decode_32bit(uint32_t field_id, Proto32Bit value) { switch (field_id) { - case 1: this->key = value.as_fixed32(); break; - default: return false; + case 1: + this->key = value.as_fixed32(); + break; + default: + return false; } return true; } @@ -2403,20 +2866,32 @@ void TimeStateResponse::calculate_size(ProtoSize &size) const { } bool TimeCommandRequest::decode_varint(uint32_t field_id, ProtoVarInt value) { switch (field_id) { - case 2: this->hour = value.as_uint32(); break; - case 3: this->minute = value.as_uint32(); break; - case 4: this->second = value.as_uint32(); break; + case 2: + this->hour = value.as_uint32(); + break; + case 3: + this->minute = value.as_uint32(); + break; + case 4: + this->second = value.as_uint32(); + break; #ifdef USE_DEVICES - case 5: this->device_id = value.as_uint32(); break; + case 5: + this->device_id = value.as_uint32(); + break; #endif - default: return false; + default: + return false; } return true; } bool TimeCommandRequest::decode_32bit(uint32_t field_id, Proto32Bit value) { switch (field_id) { - case 1: this->key = value.as_fixed32(); break; - default: return false; + case 1: + this->key = value.as_fixed32(); + break; + default: + return false; } return true; } @@ -2526,20 +3001,32 @@ void ValveStateResponse::calculate_size(ProtoSize &size) const { } bool ValveCommandRequest::decode_varint(uint32_t field_id, ProtoVarInt value) { switch (field_id) { - case 2: this->has_position = value.as_bool(); break; - case 4: this->stop = value.as_bool(); break; + case 2: + this->has_position = value.as_bool(); + break; + case 4: + this->stop = value.as_bool(); + break; #ifdef USE_DEVICES - case 5: this->device_id = value.as_uint32(); break; + case 5: + this->device_id = value.as_uint32(); + break; #endif - default: return false; + default: + return false; } return true; } bool ValveCommandRequest::decode_32bit(uint32_t field_id, Proto32Bit value) { switch (field_id) { - case 1: this->key = value.as_fixed32(); break; - case 3: this->position = value.as_float(); break; - default: return false; + case 1: + this->key = value.as_fixed32(); + break; + case 3: + this->position = value.as_float(); + break; + default: + return false; } return true; } @@ -2590,17 +3077,25 @@ void DateTimeStateResponse::calculate_size(ProtoSize &size) const { bool DateTimeCommandRequest::decode_varint(uint32_t field_id, ProtoVarInt value) { switch (field_id) { #ifdef USE_DEVICES - case 3: this->device_id = value.as_uint32(); break; + case 3: + this->device_id = value.as_uint32(); + break; #endif - default: return false; + default: + return false; } return true; } bool DateTimeCommandRequest::decode_32bit(uint32_t field_id, Proto32Bit value) { switch (field_id) { - case 1: this->key = value.as_fixed32(); break; - case 2: this->epoch_seconds = value.as_fixed32(); break; - default: return false; + case 1: + this->key = value.as_fixed32(); + break; + case 2: + this->epoch_seconds = value.as_fixed32(); + break; + default: + return false; } return true; } @@ -2666,18 +3161,26 @@ void UpdateStateResponse::calculate_size(ProtoSize &size) const { } bool UpdateCommandRequest::decode_varint(uint32_t field_id, ProtoVarInt value) { switch (field_id) { - case 2: this->command = static_cast(value.as_uint32()); break; + case 2: + this->command = static_cast(value.as_uint32()); + break; #ifdef USE_DEVICES - case 3: this->device_id = value.as_uint32(); break; + case 3: + this->device_id = value.as_uint32(); + break; #endif - default: return false; + default: + return false; } return true; } bool UpdateCommandRequest::decode_32bit(uint32_t field_id, Proto32Bit value) { switch (field_id) { - case 1: this->key = value.as_fixed32(); break; - default: return false; + case 1: + this->key = value.as_fixed32(); + break; + default: + return false; } return true; } @@ -2686,12 +3189,13 @@ bool UpdateCommandRequest::decode_32bit(uint32_t field_id, Proto32Bit value) { bool ZWaveProxyFrame::decode_length(uint32_t field_id, ProtoLengthDelimited value) { switch (field_id) { case 1: { - // Use raw data directly to avoid allocation - this->data = value.data(); - this->data_len = value.size(); - break; - } - default: return false; + // Use raw data directly to avoid allocation + this->data = value.data(); + this->data_len = value.size(); + break; + } + default: + return false; } return true; } @@ -2699,20 +3203,24 @@ void ZWaveProxyFrame::encode(ProtoWriteBuffer buffer) const { buffer.encode_byte void ZWaveProxyFrame::calculate_size(ProtoSize &size) const { size.add_length(1, this->data_len); } bool ZWaveProxyRequest::decode_varint(uint32_t field_id, ProtoVarInt value) { switch (field_id) { - case 1: this->type = static_cast(value.as_uint32()); break; - default: return false; + case 1: + this->type = static_cast(value.as_uint32()); + break; + default: + return false; } return true; } bool ZWaveProxyRequest::decode_length(uint32_t field_id, ProtoLengthDelimited value) { switch (field_id) { case 2: { - // Use raw data directly to avoid allocation - this->data = value.data(); - this->data_len = value.size(); - break; - } - default: return false; + // Use raw data directly to avoid allocation + this->data = value.data(); + this->data_len = value.size(); + break; + } + default: + return false; } return true; } diff --git a/esphome/components/api/api_pb2.h b/esphome/components/api/api_pb2.h index da6b4599a7..c0dd547064 100644 --- a/esphome/components/api/api_pb2.h +++ b/esphome/components/api/api_pb2.h @@ -290,20 +290,14 @@ class InfoResponseProtoMessage : public ProtoMessage { public: ~InfoResponseProtoMessage() override = default; StringRef object_id_ref_{}; - void set_object_id(const StringRef &ref) { - this->object_id_ref_ = ref; - } + void set_object_id(const StringRef &ref) { this->object_id_ref_ = ref; } uint32_t key{0}; StringRef name_ref_{}; - void set_name(const StringRef &ref) { - this->name_ref_ = ref; - } + void set_name(const StringRef &ref) { this->name_ref_ = ref; } bool disabled_by_default{false}; #ifdef USE_ENTITY_ICON StringRef icon_ref_{}; - void set_icon(const StringRef &ref) { - this->icon_ref_ = ref; - } + void set_icon(const StringRef &ref) { this->icon_ref_ = ref; } #endif enums::EntityCategory entity_category{}; #ifdef USE_DEVICES @@ -341,7 +335,7 @@ class HelloRequest final : public ProtoDecodableMessage { #ifdef HAS_PROTO_MESSAGE_DUMP const char *message_name() const override { return "hello_request"; } #endif - const uint8_t* client_info{nullptr}; + const uint8_t *client_info{nullptr}; uint16_t client_info_len{0}; uint32_t api_version_major{0}; uint32_t api_version_minor{0}; @@ -363,13 +357,9 @@ class HelloResponse final : public ProtoMessage { uint32_t api_version_major{0}; uint32_t api_version_minor{0}; StringRef server_info_ref_{}; - void set_server_info(const StringRef &ref) { - this->server_info_ref_ = ref; - } + void set_server_info(const StringRef &ref) { this->server_info_ref_ = ref; } StringRef name_ref_{}; - void set_name(const StringRef &ref) { - this->name_ref_ = ref; - } + void set_name(const StringRef &ref) { this->name_ref_ = ref; } void encode(ProtoWriteBuffer buffer) const override; void calculate_size(ProtoSize &size) const override; #ifdef HAS_PROTO_MESSAGE_DUMP @@ -386,7 +376,7 @@ class AuthenticationRequest final : public ProtoDecodableMessage { #ifdef HAS_PROTO_MESSAGE_DUMP const char *message_name() const override { return "authentication_request"; } #endif - const uint8_t* password{nullptr}; + const uint8_t *password{nullptr}; uint16_t password_len{0}; #ifdef HAS_PROTO_MESSAGE_DUMP void dump_to(std::string &out) const override; @@ -482,9 +472,7 @@ class AreaInfo final : public ProtoMessage { public: uint32_t area_id{0}; StringRef name_ref_{}; - void set_name(const StringRef &ref) { - this->name_ref_ = ref; - } + void set_name(const StringRef &ref) { this->name_ref_ = ref; } void encode(ProtoWriteBuffer buffer) const override; void calculate_size(ProtoSize &size) const override; #ifdef HAS_PROTO_MESSAGE_DUMP @@ -499,9 +487,7 @@ class DeviceInfo final : public ProtoMessage { public: uint32_t device_id{0}; StringRef name_ref_{}; - void set_name(const StringRef &ref) { - this->name_ref_ = ref; - } + void set_name(const StringRef &ref) { this->name_ref_ = ref; } uint32_t area_id{0}; void encode(ProtoWriteBuffer buffer) const override; void calculate_size(ProtoSize &size) const override; @@ -523,39 +509,25 @@ class DeviceInfoResponse final : public ProtoMessage { bool uses_password{false}; #endif StringRef name_ref_{}; - void set_name(const StringRef &ref) { - this->name_ref_ = ref; - } + void set_name(const StringRef &ref) { this->name_ref_ = ref; } StringRef mac_address_ref_{}; - void set_mac_address(const StringRef &ref) { - this->mac_address_ref_ = ref; - } + void set_mac_address(const StringRef &ref) { this->mac_address_ref_ = ref; } StringRef esphome_version_ref_{}; - void set_esphome_version(const StringRef &ref) { - this->esphome_version_ref_ = ref; - } + void set_esphome_version(const StringRef &ref) { this->esphome_version_ref_ = ref; } StringRef compilation_time_ref_{}; - void set_compilation_time(const StringRef &ref) { - this->compilation_time_ref_ = ref; - } + void set_compilation_time(const StringRef &ref) { this->compilation_time_ref_ = ref; } StringRef model_ref_{}; - void set_model(const StringRef &ref) { - this->model_ref_ = ref; - } + void set_model(const StringRef &ref) { this->model_ref_ = ref; } #ifdef USE_DEEP_SLEEP bool has_deep_sleep{false}; #endif #ifdef ESPHOME_PROJECT_NAME StringRef project_name_ref_{}; - void set_project_name(const StringRef &ref) { - this->project_name_ref_ = ref; - } + void set_project_name(const StringRef &ref) { this->project_name_ref_ = ref; } #endif #ifdef ESPHOME_PROJECT_NAME StringRef project_version_ref_{}; - void set_project_version(const StringRef &ref) { - this->project_version_ref_ = ref; - } + void set_project_version(const StringRef &ref) { this->project_version_ref_ = ref; } #endif #ifdef USE_WEBSERVER uint32_t webserver_port{0}; @@ -564,27 +536,19 @@ class DeviceInfoResponse final : public ProtoMessage { uint32_t bluetooth_proxy_feature_flags{0}; #endif StringRef manufacturer_ref_{}; - void set_manufacturer(const StringRef &ref) { - this->manufacturer_ref_ = ref; - } + void set_manufacturer(const StringRef &ref) { this->manufacturer_ref_ = ref; } StringRef friendly_name_ref_{}; - void set_friendly_name(const StringRef &ref) { - this->friendly_name_ref_ = ref; - } + void set_friendly_name(const StringRef &ref) { this->friendly_name_ref_ = ref; } #ifdef USE_VOICE_ASSISTANT uint32_t voice_assistant_feature_flags{0}; #endif #ifdef USE_AREAS StringRef suggested_area_ref_{}; - void set_suggested_area(const StringRef &ref) { - this->suggested_area_ref_ = ref; - } + void set_suggested_area(const StringRef &ref) { this->suggested_area_ref_ = ref; } #endif #ifdef USE_BLUETOOTH_PROXY StringRef bluetooth_mac_address_ref_{}; - void set_bluetooth_mac_address(const StringRef &ref) { - this->bluetooth_mac_address_ref_ = ref; - } + void set_bluetooth_mac_address(const StringRef &ref) { this->bluetooth_mac_address_ref_ = ref; } #endif #ifdef USE_API_NOISE bool api_encryption_supported{false}; @@ -660,9 +624,7 @@ class ListEntitiesBinarySensorResponse final : public InfoResponseProtoMessage { const char *message_name() const override { return "list_entities_binary_sensor_response"; } #endif StringRef device_class_ref_{}; - void set_device_class(const StringRef &ref) { - this->device_class_ref_ = ref; - } + void set_device_class(const StringRef &ref) { this->device_class_ref_ = ref; } bool is_status_binary_sensor{false}; void encode(ProtoWriteBuffer buffer) const override; void calculate_size(ProtoSize &size) const override; @@ -702,9 +664,7 @@ class ListEntitiesCoverResponse final : public InfoResponseProtoMessage { bool supports_position{false}; bool supports_tilt{false}; StringRef device_class_ref_{}; - void set_device_class(const StringRef &ref) { - this->device_class_ref_ = ref; - } + void set_device_class(const StringRef &ref) { this->device_class_ref_ = ref; } bool supports_stop{false}; void encode(ProtoWriteBuffer buffer) const override; void calculate_size(ProtoSize &size) const override; @@ -765,7 +725,7 @@ class ListEntitiesFanResponse final : public InfoResponseProtoMessage { bool supports_speed{false}; bool supports_direction{false}; int32_t supported_speed_count{0}; - const std::vector* supported_preset_modes{}; + const std::vector *supported_preset_modes{}; void encode(ProtoWriteBuffer buffer) const override; void calculate_size(ProtoSize &size) const override; #ifdef HAS_PROTO_MESSAGE_DUMP @@ -786,9 +746,7 @@ class FanStateResponse final : public StateResponseProtoMessage { enums::FanDirection direction{}; int32_t speed_level{0}; StringRef preset_mode_ref_{}; - void set_preset_mode(const StringRef &ref) { - this->preset_mode_ref_ = ref; - } + void set_preset_mode(const StringRef &ref) { this->preset_mode_ref_ = ref; } void encode(ProtoWriteBuffer buffer) const override; void calculate_size(ProtoSize &size) const override; #ifdef HAS_PROTO_MESSAGE_DUMP @@ -832,7 +790,7 @@ class ListEntitiesLightResponse final : public InfoResponseProtoMessage { #ifdef HAS_PROTO_MESSAGE_DUMP const char *message_name() const override { return "list_entities_light_response"; } #endif - const light::ColorModeMask* supported_color_modes{}; + const light::ColorModeMask *supported_color_modes{}; float min_mireds{0.0f}; float max_mireds{0.0f}; std::vector effects{}; @@ -863,9 +821,7 @@ class LightStateResponse final : public StateResponseProtoMessage { float cold_white{0.0f}; float warm_white{0.0f}; StringRef effect_ref_{}; - void set_effect(const StringRef &ref) { - this->effect_ref_ = ref; - } + void set_effect(const StringRef &ref) { this->effect_ref_ = ref; } void encode(ProtoWriteBuffer buffer) const override; void calculate_size(ProtoSize &size) const override; #ifdef HAS_PROTO_MESSAGE_DUMP @@ -926,15 +882,11 @@ class ListEntitiesSensorResponse final : public InfoResponseProtoMessage { const char *message_name() const override { return "list_entities_sensor_response"; } #endif StringRef unit_of_measurement_ref_{}; - void set_unit_of_measurement(const StringRef &ref) { - this->unit_of_measurement_ref_ = ref; - } + void set_unit_of_measurement(const StringRef &ref) { this->unit_of_measurement_ref_ = ref; } int32_t accuracy_decimals{0}; bool force_update{false}; StringRef device_class_ref_{}; - void set_device_class(const StringRef &ref) { - this->device_class_ref_ = ref; - } + void set_device_class(const StringRef &ref) { this->device_class_ref_ = ref; } enums::SensorStateClass state_class{}; void encode(ProtoWriteBuffer buffer) const override; void calculate_size(ProtoSize &size) const override; @@ -972,9 +924,7 @@ class ListEntitiesSwitchResponse final : public InfoResponseProtoMessage { #endif bool assumed_state{false}; StringRef device_class_ref_{}; - void set_device_class(const StringRef &ref) { - this->device_class_ref_ = ref; - } + void set_device_class(const StringRef &ref) { this->device_class_ref_ = ref; } void encode(ProtoWriteBuffer buffer) const override; void calculate_size(ProtoSize &size) const override; #ifdef HAS_PROTO_MESSAGE_DUMP @@ -1025,9 +975,7 @@ class ListEntitiesTextSensorResponse final : public InfoResponseProtoMessage { const char *message_name() const override { return "list_entities_text_sensor_response"; } #endif StringRef device_class_ref_{}; - void set_device_class(const StringRef &ref) { - this->device_class_ref_ = ref; - } + void set_device_class(const StringRef &ref) { this->device_class_ref_ = ref; } void encode(ProtoWriteBuffer buffer) const override; void calculate_size(ProtoSize &size) const override; #ifdef HAS_PROTO_MESSAGE_DUMP @@ -1044,9 +992,7 @@ class TextSensorStateResponse final : public StateResponseProtoMessage { const char *message_name() const override { return "text_sensor_state_response"; } #endif StringRef state_ref_{}; - void set_state(const StringRef &ref) { - this->state_ref_ = ref; - } + void set_state(const StringRef &ref) { this->state_ref_ = ref; } bool missing_state{false}; void encode(ProtoWriteBuffer buffer) const override; void calculate_size(ProtoSize &size) const override; @@ -1081,9 +1027,9 @@ class SubscribeLogsResponse final : public ProtoMessage { const char *message_name() const override { return "subscribe_logs_response"; } #endif enums::LogLevel level{}; - const uint8_t* message_ptr_{nullptr}; + const uint8_t *message_ptr_{nullptr}; size_t message_len_{0}; - void set_message(const uint8_t* data, size_t len) { + void set_message(const uint8_t *data, size_t len) { this->message_ptr_ = data; this->message_len_ = len; } @@ -1145,9 +1091,7 @@ class SubscribeHomeassistantServicesRequest final : public ProtoMessage { class HomeassistantServiceMap final : public ProtoMessage { public: StringRef key_ref_{}; - void set_key(const StringRef &ref) { - this->key_ref_ = ref; - } + void set_key(const StringRef &ref) { this->key_ref_ = ref; } std::string value{}; void encode(ProtoWriteBuffer buffer) const override; void calculate_size(ProtoSize &size) const override; @@ -1165,9 +1109,7 @@ class HomeassistantActionRequest final : public ProtoMessage { const char *message_name() const override { return "homeassistant_action_request"; } #endif StringRef service_ref_{}; - void set_service(const StringRef &ref) { - this->service_ref_ = ref; - } + void set_service(const StringRef &ref) { this->service_ref_ = ref; } FixedVector data{}; FixedVector data_template{}; FixedVector variables{}; @@ -1202,7 +1144,7 @@ class HomeassistantActionResponse final : public ProtoDecodableMessage { bool success{false}; std::string error_message{}; #ifdef USE_API_HOMEASSISTANT_ACTION_RESPONSES_JSON - const uint8_t* response_data{nullptr}; + const uint8_t *response_data{nullptr}; uint16_t response_data_len{0}; #endif #ifdef HAS_PROTO_MESSAGE_DUMP @@ -1236,13 +1178,9 @@ class SubscribeHomeAssistantStateResponse final : public ProtoMessage { const char *message_name() const override { return "subscribe_home_assistant_state_response"; } #endif StringRef entity_id_ref_{}; - void set_entity_id(const StringRef &ref) { - this->entity_id_ref_ = ref; - } + void set_entity_id(const StringRef &ref) { this->entity_id_ref_ = ref; } StringRef attribute_ref_{}; - void set_attribute(const StringRef &ref) { - this->attribute_ref_ = ref; - } + void set_attribute(const StringRef &ref) { this->attribute_ref_ = ref; } bool once{false}; void encode(ProtoWriteBuffer buffer) const override; void calculate_size(ProtoSize &size) const override; @@ -1291,7 +1229,7 @@ class GetTimeResponse final : public ProtoDecodableMessage { const char *message_name() const override { return "get_time_response"; } #endif uint32_t epoch_seconds{0}; - const uint8_t* timezone{nullptr}; + const uint8_t *timezone{nullptr}; uint16_t timezone_len{0}; #ifdef HAS_PROTO_MESSAGE_DUMP void dump_to(std::string &out) const override; @@ -1305,9 +1243,7 @@ class GetTimeResponse final : public ProtoDecodableMessage { class ListEntitiesServicesArgument final : public ProtoMessage { public: StringRef name_ref_{}; - void set_name(const StringRef &ref) { - this->name_ref_ = ref; - } + void set_name(const StringRef &ref) { this->name_ref_ = ref; } enums::ServiceArgType type{}; void encode(ProtoWriteBuffer buffer) const override; void calculate_size(ProtoSize &size) const override; @@ -1325,9 +1261,7 @@ class ListEntitiesServicesResponse final : public ProtoMessage { const char *message_name() const override { return "list_entities_services_response"; } #endif StringRef name_ref_{}; - void set_name(const StringRef &ref) { - this->name_ref_ = ref; - } + void set_name(const StringRef &ref) { this->name_ref_ = ref; } uint32_t key{0}; FixedVector args{}; void encode(ProtoWriteBuffer buffer) const override; @@ -1393,11 +1327,9 @@ class ExecuteServiceResponse final : public ProtoMessage { uint32_t call_id{0}; bool success{false}; StringRef error_message_ref_{}; - void set_error_message(const StringRef &ref) { - this->error_message_ref_ = ref; - } + void set_error_message(const StringRef &ref) { this->error_message_ref_ = ref; } #ifdef USE_API_SERVICE_RESPONSE_JSON - const uint8_t* response_data{nullptr}; + const uint8_t *response_data{nullptr}; uint16_t response_data_len{0}; #endif void encode(ProtoWriteBuffer buffer) const override; @@ -1432,9 +1364,9 @@ class CameraImageResponse final : public StateResponseProtoMessage { #ifdef HAS_PROTO_MESSAGE_DUMP const char *message_name() const override { return "camera_image_response"; } #endif - const uint8_t* data_ptr_{nullptr}; + const uint8_t *data_ptr_{nullptr}; size_t data_len_{0}; - void set_data(const uint8_t* data, size_t len) { + void set_data(const uint8_t *data, size_t len) { this->data_ptr_ = data; this->data_len_ = len; } @@ -1474,16 +1406,16 @@ class ListEntitiesClimateResponse final : public InfoResponseProtoMessage { #endif bool supports_current_temperature{false}; bool supports_two_point_target_temperature{false}; - const climate::ClimateModeMask* supported_modes{}; + const climate::ClimateModeMask *supported_modes{}; float visual_min_temperature{0.0f}; float visual_max_temperature{0.0f}; float visual_target_temperature_step{0.0f}; bool supports_action{false}; - const climate::ClimateFanModeMask* supported_fan_modes{}; - const climate::ClimateSwingModeMask* supported_swing_modes{}; - const std::vector* supported_custom_fan_modes{}; - const climate::ClimatePresetMask* supported_presets{}; - const std::vector* supported_custom_presets{}; + const climate::ClimateFanModeMask *supported_fan_modes{}; + const climate::ClimateSwingModeMask *supported_swing_modes{}; + const std::vector *supported_custom_fan_modes{}; + const climate::ClimatePresetMask *supported_presets{}; + const std::vector *supported_custom_presets{}; float visual_current_temperature_step{0.0f}; bool supports_current_humidity{false}; bool supports_target_humidity{false}; @@ -1514,14 +1446,10 @@ class ClimateStateResponse final : public StateResponseProtoMessage { enums::ClimateFanMode fan_mode{}; enums::ClimateSwingMode swing_mode{}; StringRef custom_fan_mode_ref_{}; - void set_custom_fan_mode(const StringRef &ref) { - this->custom_fan_mode_ref_ = ref; - } + void set_custom_fan_mode(const StringRef &ref) { this->custom_fan_mode_ref_ = ref; } enums::ClimatePreset preset{}; StringRef custom_preset_ref_{}; - void set_custom_preset(const StringRef &ref) { - this->custom_preset_ref_ = ref; - } + void set_custom_preset(const StringRef &ref) { this->custom_preset_ref_ = ref; } float current_humidity{0.0f}; float target_humidity{0.0f}; void encode(ProtoWriteBuffer buffer) const override; @@ -1581,14 +1509,10 @@ class ListEntitiesNumberResponse final : public InfoResponseProtoMessage { float max_value{0.0f}; float step{0.0f}; StringRef unit_of_measurement_ref_{}; - void set_unit_of_measurement(const StringRef &ref) { - this->unit_of_measurement_ref_ = ref; - } + void set_unit_of_measurement(const StringRef &ref) { this->unit_of_measurement_ref_ = ref; } enums::NumberMode mode{}; StringRef device_class_ref_{}; - void set_device_class(const StringRef &ref) { - this->device_class_ref_ = ref; - } + void set_device_class(const StringRef &ref) { this->device_class_ref_ = ref; } void encode(ProtoWriteBuffer buffer) const override; void calculate_size(ProtoSize &size) const override; #ifdef HAS_PROTO_MESSAGE_DUMP @@ -1639,7 +1563,7 @@ class ListEntitiesSelectResponse final : public InfoResponseProtoMessage { #ifdef HAS_PROTO_MESSAGE_DUMP const char *message_name() const override { return "list_entities_select_response"; } #endif - const FixedVector* options{}; + const FixedVector *options{}; void encode(ProtoWriteBuffer buffer) const override; void calculate_size(ProtoSize &size) const override; #ifdef HAS_PROTO_MESSAGE_DUMP @@ -1656,9 +1580,7 @@ class SelectStateResponse final : public StateResponseProtoMessage { const char *message_name() const override { return "select_state_response"; } #endif StringRef state_ref_{}; - void set_state(const StringRef &ref) { - this->state_ref_ = ref; - } + void set_state(const StringRef &ref) { this->state_ref_ = ref; } bool missing_state{false}; void encode(ProtoWriteBuffer buffer) const override; void calculate_size(ProtoSize &size) const override; @@ -1758,9 +1680,7 @@ class ListEntitiesLockResponse final : public InfoResponseProtoMessage { bool supports_open{false}; bool requires_code{false}; StringRef code_format_ref_{}; - void set_code_format(const StringRef &ref) { - this->code_format_ref_ = ref; - } + void set_code_format(const StringRef &ref) { this->code_format_ref_ = ref; } void encode(ProtoWriteBuffer buffer) const override; void calculate_size(ProtoSize &size) const override; #ifdef HAS_PROTO_MESSAGE_DUMP @@ -1814,9 +1734,7 @@ class ListEntitiesButtonResponse final : public InfoResponseProtoMessage { const char *message_name() const override { return "list_entities_button_response"; } #endif StringRef device_class_ref_{}; - void set_device_class(const StringRef &ref) { - this->device_class_ref_ = ref; - } + void set_device_class(const StringRef &ref) { this->device_class_ref_ = ref; } void encode(ProtoWriteBuffer buffer) const override; void calculate_size(ProtoSize &size) const override; #ifdef HAS_PROTO_MESSAGE_DUMP @@ -1845,9 +1763,7 @@ class ButtonCommandRequest final : public CommandProtoMessage { class MediaPlayerSupportedFormat final : public ProtoMessage { public: StringRef format_ref_{}; - void set_format(const StringRef &ref) { - this->format_ref_ = ref; - } + void set_format(const StringRef &ref) { this->format_ref_ = ref; } uint32_t sample_rate{0}; uint32_t num_channels{0}; enums::MediaPlayerFormatPurpose purpose{}; @@ -2121,9 +2037,9 @@ class BluetoothGATTReadResponse final : public ProtoMessage { #endif uint64_t address{0}; uint32_t handle{0}; - const uint8_t* data_ptr_{nullptr}; + const uint8_t *data_ptr_{nullptr}; size_t data_len_{0}; - void set_data(const uint8_t* data, size_t len) { + void set_data(const uint8_t *data, size_t len) { this->data_ptr_ = data; this->data_len_ = len; } @@ -2145,7 +2061,7 @@ class BluetoothGATTWriteRequest final : public ProtoDecodableMessage { uint64_t address{0}; uint32_t handle{0}; bool response{false}; - const uint8_t* data{nullptr}; + const uint8_t *data{nullptr}; uint16_t data_len{0}; #ifdef HAS_PROTO_MESSAGE_DUMP void dump_to(std::string &out) const override; @@ -2180,7 +2096,7 @@ class BluetoothGATTWriteDescriptorRequest final : public ProtoDecodableMessage { #endif uint64_t address{0}; uint32_t handle{0}; - const uint8_t* data{nullptr}; + const uint8_t *data{nullptr}; uint16_t data_len{0}; #ifdef HAS_PROTO_MESSAGE_DUMP void dump_to(std::string &out) const override; @@ -2216,9 +2132,9 @@ class BluetoothGATTNotifyDataResponse final : public ProtoMessage { #endif uint64_t address{0}; uint32_t handle{0}; - const uint8_t* data_ptr_{nullptr}; + const uint8_t *data_ptr_{nullptr}; size_t data_len_{0}; - void set_data(const uint8_t* data, size_t len) { + void set_data(const uint8_t *data, size_t len) { this->data_ptr_ = data; this->data_len_ = len; } @@ -2453,15 +2369,11 @@ class VoiceAssistantRequest final : public ProtoMessage { #endif bool start{false}; StringRef conversation_id_ref_{}; - void set_conversation_id(const StringRef &ref) { - this->conversation_id_ref_ = ref; - } + void set_conversation_id(const StringRef &ref) { this->conversation_id_ref_ = ref; } uint32_t flags{0}; VoiceAssistantAudioSettings audio_settings{}; StringRef wake_word_phrase_ref_{}; - void set_wake_word_phrase(const StringRef &ref) { - this->wake_word_phrase_ref_ = ref; - } + void set_wake_word_phrase(const StringRef &ref) { this->wake_word_phrase_ref_ = ref; } void encode(ProtoWriteBuffer buffer) const override; void calculate_size(ProtoSize &size) const override; #ifdef HAS_PROTO_MESSAGE_DUMP @@ -2522,9 +2434,9 @@ class VoiceAssistantAudio final : public ProtoDecodableMessage { const char *message_name() const override { return "voice_assistant_audio"; } #endif std::string data{}; - const uint8_t* data_ptr_{nullptr}; + const uint8_t *data_ptr_{nullptr}; size_t data_len_{0}; - void set_data(const uint8_t* data, size_t len) { + void set_data(const uint8_t *data, size_t len) { this->data_ptr_ = data; this->data_len_ = len; } @@ -2598,13 +2510,9 @@ class VoiceAssistantAnnounceFinished final : public ProtoMessage { class VoiceAssistantWakeWord final : public ProtoMessage { public: StringRef id_ref_{}; - void set_id(const StringRef &ref) { - this->id_ref_ = ref; - } + void set_id(const StringRef &ref) { this->id_ref_ = ref; } StringRef wake_word_ref_{}; - void set_wake_word(const StringRef &ref) { - this->wake_word_ref_ = ref; - } + void set_wake_word(const StringRef &ref) { this->wake_word_ref_ = ref; } std::vector trained_languages{}; void encode(ProtoWriteBuffer buffer) const override; void calculate_size(ProtoSize &size) const override; @@ -2654,7 +2562,7 @@ class VoiceAssistantConfigurationResponse final : public ProtoMessage { const char *message_name() const override { return "voice_assistant_configuration_response"; } #endif std::vector available_wake_words{}; - const std::vector* active_wake_words{}; + const std::vector *active_wake_words{}; uint32_t max_active_wake_words{0}; void encode(ProtoWriteBuffer buffer) const override; void calculate_size(ProtoSize &size) const override; @@ -2745,9 +2653,7 @@ class ListEntitiesTextResponse final : public InfoResponseProtoMessage { uint32_t min_length{0}; uint32_t max_length{0}; StringRef pattern_ref_{}; - void set_pattern(const StringRef &ref) { - this->pattern_ref_ = ref; - } + void set_pattern(const StringRef &ref) { this->pattern_ref_ = ref; } enums::TextMode mode{}; void encode(ProtoWriteBuffer buffer) const override; void calculate_size(ProtoSize &size) const override; @@ -2765,9 +2671,7 @@ class TextStateResponse final : public StateResponseProtoMessage { const char *message_name() const override { return "text_state_response"; } #endif StringRef state_ref_{}; - void set_state(const StringRef &ref) { - this->state_ref_ = ref; - } + void set_state(const StringRef &ref) { this->state_ref_ = ref; } bool missing_state{false}; void encode(ProtoWriteBuffer buffer) const override; void calculate_size(ProtoSize &size) const override; @@ -2912,10 +2816,8 @@ class ListEntitiesEventResponse final : public InfoResponseProtoMessage { const char *message_name() const override { return "list_entities_event_response"; } #endif StringRef device_class_ref_{}; - void set_device_class(const StringRef &ref) { - this->device_class_ref_ = ref; - } - const FixedVector* event_types{}; + void set_device_class(const StringRef &ref) { this->device_class_ref_ = ref; } + const FixedVector *event_types{}; void encode(ProtoWriteBuffer buffer) const override; void calculate_size(ProtoSize &size) const override; #ifdef HAS_PROTO_MESSAGE_DUMP @@ -2932,9 +2834,7 @@ class EventResponse final : public StateResponseProtoMessage { const char *message_name() const override { return "event_response"; } #endif StringRef event_type_ref_{}; - void set_event_type(const StringRef &ref) { - this->event_type_ref_ = ref; - } + void set_event_type(const StringRef &ref) { this->event_type_ref_ = ref; } void encode(ProtoWriteBuffer buffer) const override; void calculate_size(ProtoSize &size) const override; #ifdef HAS_PROTO_MESSAGE_DUMP @@ -2953,9 +2853,7 @@ class ListEntitiesValveResponse final : public InfoResponseProtoMessage { const char *message_name() const override { return "list_entities_valve_response"; } #endif StringRef device_class_ref_{}; - void set_device_class(const StringRef &ref) { - this->device_class_ref_ = ref; - } + void set_device_class(const StringRef &ref) { this->device_class_ref_ = ref; } bool assumed_state{false}; bool supports_position{false}; bool supports_stop{false}; @@ -3062,9 +2960,7 @@ class ListEntitiesUpdateResponse final : public InfoResponseProtoMessage { const char *message_name() const override { return "list_entities_update_response"; } #endif StringRef device_class_ref_{}; - void set_device_class(const StringRef &ref) { - this->device_class_ref_ = ref; - } + void set_device_class(const StringRef &ref) { this->device_class_ref_ = ref; } void encode(ProtoWriteBuffer buffer) const override; void calculate_size(ProtoSize &size) const override; #ifdef HAS_PROTO_MESSAGE_DUMP @@ -3085,25 +2981,15 @@ class UpdateStateResponse final : public StateResponseProtoMessage { bool has_progress{false}; float progress{0.0f}; StringRef current_version_ref_{}; - void set_current_version(const StringRef &ref) { - this->current_version_ref_ = ref; - } + void set_current_version(const StringRef &ref) { this->current_version_ref_ = ref; } StringRef latest_version_ref_{}; - void set_latest_version(const StringRef &ref) { - this->latest_version_ref_ = ref; - } + void set_latest_version(const StringRef &ref) { this->latest_version_ref_ = ref; } StringRef title_ref_{}; - void set_title(const StringRef &ref) { - this->title_ref_ = ref; - } + void set_title(const StringRef &ref) { this->title_ref_ = ref; } StringRef release_summary_ref_{}; - void set_release_summary(const StringRef &ref) { - this->release_summary_ref_ = ref; - } + void set_release_summary(const StringRef &ref) { this->release_summary_ref_ = ref; } StringRef release_url_ref_{}; - void set_release_url(const StringRef &ref) { - this->release_url_ref_ = ref; - } + void set_release_url(const StringRef &ref) { this->release_url_ref_ = ref; } void encode(ProtoWriteBuffer buffer) const override; void calculate_size(ProtoSize &size) const override; #ifdef HAS_PROTO_MESSAGE_DUMP @@ -3137,7 +3023,7 @@ class ZWaveProxyFrame final : public ProtoDecodableMessage { #ifdef HAS_PROTO_MESSAGE_DUMP const char *message_name() const override { return "z_wave_proxy_frame"; } #endif - const uint8_t* data{nullptr}; + const uint8_t *data{nullptr}; uint16_t data_len{0}; void encode(ProtoWriteBuffer buffer) const override; void calculate_size(ProtoSize &size) const override; @@ -3156,7 +3042,7 @@ class ZWaveProxyRequest final : public ProtoDecodableMessage { const char *message_name() const override { return "z_wave_proxy_request"; } #endif enums::ZWaveProxyRequestType type{}; - const uint8_t* data{nullptr}; + const uint8_t *data{nullptr}; uint16_t data_len{0}; void encode(ProtoWriteBuffer buffer) const override; void calculate_size(ProtoSize &size) const override; diff --git a/esphome/components/api/api_pb2_dump.cpp b/esphome/components/api/api_pb2_dump.cpp index c5b6d39e0d..f783370889 100644 --- a/esphome/components/api/api_pb2_dump.cpp +++ b/esphome/components/api/api_pb2_dump.cpp @@ -94,8 +94,7 @@ static void dump_field(std::string &out, const char *field_name, const char *val out.append("\n"); } -template -static void dump_field(std::string &out, const char *field_name, T value, int indent = 2) { +template static void dump_field(std::string &out, const char *field_name, T value, int indent = 2) { append_field_prefix(out, field_name, indent); out.append(proto_enum_to_string(value)); out.append("\n"); @@ -446,7 +445,8 @@ template<> const char *proto_enum_to_string(enu } #endif #ifdef USE_BLUETOOTH_PROXY -template<> const char *proto_enum_to_string(enums::BluetoothDeviceRequestType value) { +template<> +const char *proto_enum_to_string(enums::BluetoothDeviceRequestType value) { switch (value) { case enums::BLUETOOTH_DEVICE_REQUEST_TYPE_CONNECT: return "BLUETOOTH_DEVICE_REQUEST_TYPE_CONNECT"; @@ -495,7 +495,8 @@ template<> const char *proto_enum_to_string(enums:: } } #endif -template<> const char *proto_enum_to_string(enums::VoiceAssistantSubscribeFlag value) { +template<> +const char *proto_enum_to_string(enums::VoiceAssistantSubscribeFlag value) { switch (value) { case enums::VOICE_ASSISTANT_SUBSCRIBE_NONE: return "VOICE_ASSISTANT_SUBSCRIBE_NONE"; @@ -598,7 +599,8 @@ template<> const char *proto_enum_to_string(enums return "UNKNOWN"; } } -template<> const char *proto_enum_to_string(enums::AlarmControlPanelStateCommand value) { +template<> +const char *proto_enum_to_string(enums::AlarmControlPanelStateCommand value) { switch (value) { case enums::ALARM_CONTROL_PANEL_DISARM: return "ALARM_CONTROL_PANEL_DISARM"; @@ -674,7 +676,6 @@ template<> const char *proto_enum_to_string(enums: } #endif - void HelloRequest::dump_to(std::string &out) const { MessageDumpHelper helper(out, "HelloRequest"); out.append(" client_info: "); @@ -1094,7 +1095,7 @@ void SubscribeLogsResponse::dump_to(std::string &out) const { void NoiseEncryptionSetKeyRequest::dump_to(std::string &out) const { MessageDumpHelper helper(out, "NoiseEncryptionSetKeyRequest"); out.append(" key: "); - out.append(format_hex_pretty(reinterpret_cast(this->key.data()), this->key.size())); + out.append(format_hex_pretty(reinterpret_cast(this->key.data()), this->key.size())); out.append("\n"); } void NoiseEncryptionSetKeyResponse::dump_to(std::string &out) const { dump_field(out, "success", this->success); } @@ -1838,10 +1839,10 @@ void VoiceAssistantAudio::dump_to(std::string &out) const { MessageDumpHelper helper(out, "VoiceAssistantAudio"); out.append(" data: "); if (this->data_ptr_ != nullptr) { - out.append(format_hex_pretty(this->data_ptr_, this->data_len_)); - } else { - out.append(format_hex_pretty(reinterpret_cast(this->data.data()), this->data.size())); - } + out.append(format_hex_pretty(this->data_ptr_, this->data_len_)); + } else { + out.append(format_hex_pretty(reinterpret_cast(this->data.data()), this->data.size())); + } out.append("\n"); dump_field(out, "end", this->end); } diff --git a/esphome/components/api/api_pb2_service.cpp b/esphome/components/api/api_pb2_service.cpp index c5418ef56c..9d227af0a3 100644 --- a/esphome/components/api/api_pb2_service.cpp +++ b/esphome/components/api/api_pb2_service.cpp @@ -654,17 +654,14 @@ void APIServerConnection::on_device_info_request(const DeviceInfoRequest &msg) { this->on_fatal_error(); } } -void APIServerConnection::on_list_entities_request(const ListEntitiesRequest &msg) { - this->list_entities(msg); -} +void APIServerConnection::on_list_entities_request(const ListEntitiesRequest &msg) { this->list_entities(msg); } void APIServerConnection::on_subscribe_states_request(const SubscribeStatesRequest &msg) { this->subscribe_states(msg); } -void APIServerConnection::on_subscribe_logs_request(const SubscribeLogsRequest &msg) { - this->subscribe_logs(msg); -} +void APIServerConnection::on_subscribe_logs_request(const SubscribeLogsRequest &msg) { this->subscribe_logs(msg); } #ifdef USE_API_HOMEASSISTANT_SERVICES -void APIServerConnection::on_subscribe_homeassistant_services_request(const SubscribeHomeassistantServicesRequest &msg) { +void APIServerConnection::on_subscribe_homeassistant_services_request( + const SubscribeHomeassistantServicesRequest &msg) { this->subscribe_homeassistant_services(msg); } #endif @@ -674,9 +671,7 @@ void APIServerConnection::on_subscribe_home_assistant_states_request(const Subsc } #endif #ifdef USE_API_SERVICES -void APIServerConnection::on_execute_service_request(const ExecuteServiceRequest &msg) { - this->execute_service(msg); -} +void APIServerConnection::on_execute_service_request(const ExecuteServiceRequest &msg) { this->execute_service(msg); } #endif #ifdef USE_API_NOISE void APIServerConnection::on_noise_encryption_set_key_request(const NoiseEncryptionSetKeyRequest &msg) { @@ -686,29 +681,19 @@ void APIServerConnection::on_noise_encryption_set_key_request(const NoiseEncrypt } #endif #ifdef USE_BUTTON -void APIServerConnection::on_button_command_request(const ButtonCommandRequest &msg) { - this->button_command(msg); -} +void APIServerConnection::on_button_command_request(const ButtonCommandRequest &msg) { this->button_command(msg); } #endif #ifdef USE_CAMERA -void APIServerConnection::on_camera_image_request(const CameraImageRequest &msg) { - this->camera_image(msg); -} +void APIServerConnection::on_camera_image_request(const CameraImageRequest &msg) { this->camera_image(msg); } #endif #ifdef USE_CLIMATE -void APIServerConnection::on_climate_command_request(const ClimateCommandRequest &msg) { - this->climate_command(msg); -} +void APIServerConnection::on_climate_command_request(const ClimateCommandRequest &msg) { this->climate_command(msg); } #endif #ifdef USE_COVER -void APIServerConnection::on_cover_command_request(const CoverCommandRequest &msg) { - this->cover_command(msg); -} +void APIServerConnection::on_cover_command_request(const CoverCommandRequest &msg) { this->cover_command(msg); } #endif #ifdef USE_DATETIME_DATE -void APIServerConnection::on_date_command_request(const DateCommandRequest &msg) { - this->date_command(msg); -} +void APIServerConnection::on_date_command_request(const DateCommandRequest &msg) { this->date_command(msg); } #endif #ifdef USE_DATETIME_DATETIME void APIServerConnection::on_date_time_command_request(const DateTimeCommandRequest &msg) { @@ -716,19 +701,13 @@ void APIServerConnection::on_date_time_command_request(const DateTimeCommandRequ } #endif #ifdef USE_FAN -void APIServerConnection::on_fan_command_request(const FanCommandRequest &msg) { - this->fan_command(msg); -} +void APIServerConnection::on_fan_command_request(const FanCommandRequest &msg) { this->fan_command(msg); } #endif #ifdef USE_LIGHT -void APIServerConnection::on_light_command_request(const LightCommandRequest &msg) { - this->light_command(msg); -} +void APIServerConnection::on_light_command_request(const LightCommandRequest &msg) { this->light_command(msg); } #endif #ifdef USE_LOCK -void APIServerConnection::on_lock_command_request(const LockCommandRequest &msg) { - this->lock_command(msg); -} +void APIServerConnection::on_lock_command_request(const LockCommandRequest &msg) { this->lock_command(msg); } #endif #ifdef USE_MEDIA_PLAYER void APIServerConnection::on_media_player_command_request(const MediaPlayerCommandRequest &msg) { @@ -736,47 +715,32 @@ void APIServerConnection::on_media_player_command_request(const MediaPlayerComma } #endif #ifdef USE_NUMBER -void APIServerConnection::on_number_command_request(const NumberCommandRequest &msg) { - this->number_command(msg); -} +void APIServerConnection::on_number_command_request(const NumberCommandRequest &msg) { this->number_command(msg); } #endif #ifdef USE_SELECT -void APIServerConnection::on_select_command_request(const SelectCommandRequest &msg) { - this->select_command(msg); -} +void APIServerConnection::on_select_command_request(const SelectCommandRequest &msg) { this->select_command(msg); } #endif #ifdef USE_SIREN -void APIServerConnection::on_siren_command_request(const SirenCommandRequest &msg) { - this->siren_command(msg); -} +void APIServerConnection::on_siren_command_request(const SirenCommandRequest &msg) { this->siren_command(msg); } #endif #ifdef USE_SWITCH -void APIServerConnection::on_switch_command_request(const SwitchCommandRequest &msg) { - this->switch_command(msg); -} +void APIServerConnection::on_switch_command_request(const SwitchCommandRequest &msg) { this->switch_command(msg); } #endif #ifdef USE_TEXT -void APIServerConnection::on_text_command_request(const TextCommandRequest &msg) { - this->text_command(msg); -} +void APIServerConnection::on_text_command_request(const TextCommandRequest &msg) { this->text_command(msg); } #endif #ifdef USE_DATETIME_TIME -void APIServerConnection::on_time_command_request(const TimeCommandRequest &msg) { - this->time_command(msg); -} +void APIServerConnection::on_time_command_request(const TimeCommandRequest &msg) { this->time_command(msg); } #endif #ifdef USE_UPDATE -void APIServerConnection::on_update_command_request(const UpdateCommandRequest &msg) { - this->update_command(msg); -} +void APIServerConnection::on_update_command_request(const UpdateCommandRequest &msg) { this->update_command(msg); } #endif #ifdef USE_VALVE -void APIServerConnection::on_valve_command_request(const ValveCommandRequest &msg) { - this->valve_command(msg); -} +void APIServerConnection::on_valve_command_request(const ValveCommandRequest &msg) { this->valve_command(msg); } #endif #ifdef USE_BLUETOOTH_PROXY -void APIServerConnection::on_subscribe_bluetooth_le_advertisements_request(const SubscribeBluetoothLEAdvertisementsRequest &msg) { +void APIServerConnection::on_subscribe_bluetooth_le_advertisements_request( + const SubscribeBluetoothLEAdvertisementsRequest &msg) { this->subscribe_bluetooth_le_advertisements(msg); } #endif @@ -816,14 +780,16 @@ void APIServerConnection::on_bluetooth_gatt_notify_request(const BluetoothGATTNo } #endif #ifdef USE_BLUETOOTH_PROXY -void APIServerConnection::on_subscribe_bluetooth_connections_free_request(const SubscribeBluetoothConnectionsFreeRequest &msg) { +void APIServerConnection::on_subscribe_bluetooth_connections_free_request( + const SubscribeBluetoothConnectionsFreeRequest &msg) { if (!this->send_subscribe_bluetooth_connections_free_response(msg)) { this->on_fatal_error(); } } #endif #ifdef USE_BLUETOOTH_PROXY -void APIServerConnection::on_unsubscribe_bluetooth_le_advertisements_request(const UnsubscribeBluetoothLEAdvertisementsRequest &msg) { +void APIServerConnection::on_unsubscribe_bluetooth_le_advertisements_request( + const UnsubscribeBluetoothLEAdvertisementsRequest &msg) { this->unsubscribe_bluetooth_le_advertisements(msg); } #endif @@ -855,14 +821,10 @@ void APIServerConnection::on_alarm_control_panel_command_request(const AlarmCont } #endif #ifdef USE_ZWAVE_PROXY -void APIServerConnection::on_z_wave_proxy_frame(const ZWaveProxyFrame &msg) { - this->zwave_proxy_frame(msg); -} +void APIServerConnection::on_z_wave_proxy_frame(const ZWaveProxyFrame &msg) { this->zwave_proxy_frame(msg); } #endif #ifdef USE_ZWAVE_PROXY -void APIServerConnection::on_z_wave_proxy_request(const ZWaveProxyRequest &msg) { - this->zwave_proxy_request(msg); -} +void APIServerConnection::on_z_wave_proxy_request(const ZWaveProxyRequest &msg) { this->zwave_proxy_request(msg); } #endif void APIServerConnection::read_message(uint32_t msg_size, uint32_t msg_type, uint8_t *msg_data) { @@ -873,8 +835,8 @@ void APIServerConnection::read_message(uint32_t msg_size, uint32_t msg_type, uin case AuthenticationRequest::MESSAGE_TYPE: // No setup required #endif case DisconnectRequest::MESSAGE_TYPE: // No setup required - case PingRequest::MESSAGE_TYPE: // No setup required - break; // Skip all checks for these messages + case PingRequest::MESSAGE_TYPE: // No setup required + break; // Skip all checks for these messages case DeviceInfoRequest::MESSAGE_TYPE: // Connection setup only if (!this->check_connection_setup_()) { return; // Connection not setup diff --git a/esphome/components/api/api_pb2_service.h b/esphome/components/api/api_pb2_service.h index 8ddbff7261..549b00ee6a 100644 --- a/esphome/components/api/api_pb2_service.h +++ b/esphome/components/api/api_pb2_service.h @@ -13,6 +13,7 @@ class APIServerConnectionBase : public ProtoService { #ifdef HAS_PROTO_MESSAGE_DUMP protected: void log_send_message_(const char *name, const std::string &dump); + public: #endif @@ -39,31 +40,22 @@ class APIServerConnectionBase : public ProtoService { virtual void on_subscribe_states_request(const SubscribeStatesRequest &value){}; - - - #ifdef USE_COVER virtual void on_cover_command_request(const CoverCommandRequest &value){}; #endif - #ifdef USE_FAN virtual void on_fan_command_request(const FanCommandRequest &value){}; #endif - #ifdef USE_LIGHT virtual void on_light_command_request(const LightCommandRequest &value){}; #endif - - - #ifdef USE_SWITCH virtual void on_switch_command_request(const SwitchCommandRequest &value){}; #endif - virtual void on_subscribe_logs_request(const SubscribeLogsRequest &value){}; #ifdef USE_API_NOISE @@ -91,33 +83,26 @@ class APIServerConnectionBase : public ProtoService { virtual void on_execute_service_request(const ExecuteServiceRequest &value){}; #endif - - #ifdef USE_CAMERA virtual void on_camera_image_request(const CameraImageRequest &value){}; #endif - #ifdef USE_CLIMATE virtual void on_climate_command_request(const ClimateCommandRequest &value){}; #endif - #ifdef USE_NUMBER virtual void on_number_command_request(const NumberCommandRequest &value){}; #endif - #ifdef USE_SELECT virtual void on_select_command_request(const SelectCommandRequest &value){}; #endif - #ifdef USE_SIREN virtual void on_siren_command_request(const SirenCommandRequest &value){}; #endif - #ifdef USE_LOCK virtual void on_lock_command_request(const LockCommandRequest &value){}; #endif @@ -126,12 +111,12 @@ class APIServerConnectionBase : public ProtoService { virtual void on_button_command_request(const ButtonCommandRequest &value){}; #endif - #ifdef USE_MEDIA_PLAYER virtual void on_media_player_command_request(const MediaPlayerCommandRequest &value){}; #endif #ifdef USE_BLUETOOTH_PROXY - virtual void on_subscribe_bluetooth_le_advertisements_request(const SubscribeBluetoothLEAdvertisementsRequest &value){}; + virtual void on_subscribe_bluetooth_le_advertisements_request( + const SubscribeBluetoothLEAdvertisementsRequest &value){}; #endif #ifdef USE_BLUETOOTH_PROXY @@ -142,7 +127,6 @@ class APIServerConnectionBase : public ProtoService { virtual void on_bluetooth_gatt_get_services_request(const BluetoothGATTGetServicesRequest &value){}; #endif - #ifdef USE_BLUETOOTH_PROXY virtual void on_bluetooth_gatt_read_request(const BluetoothGATTReadRequest &value){}; #endif @@ -164,16 +148,11 @@ class APIServerConnectionBase : public ProtoService { virtual void on_subscribe_bluetooth_connections_free_request(const SubscribeBluetoothConnectionsFreeRequest &value){}; #endif - - - - - #ifdef USE_BLUETOOTH_PROXY - virtual void on_unsubscribe_bluetooth_le_advertisements_request(const UnsubscribeBluetoothLEAdvertisementsRequest &value){}; + virtual void on_unsubscribe_bluetooth_le_advertisements_request( + const UnsubscribeBluetoothLEAdvertisementsRequest &value){}; #endif - #ifdef USE_BLUETOOTH_PROXY virtual void on_bluetooth_scanner_set_mode_request(const BluetoothScannerSetModeRequest &value){}; #endif @@ -205,39 +184,30 @@ class APIServerConnectionBase : public ProtoService { virtual void on_voice_assistant_set_configuration(const VoiceAssistantSetConfiguration &value){}; #endif - #ifdef USE_ALARM_CONTROL_PANEL virtual void on_alarm_control_panel_command_request(const AlarmControlPanelCommandRequest &value){}; #endif - #ifdef USE_TEXT virtual void on_text_command_request(const TextCommandRequest &value){}; #endif - #ifdef USE_DATETIME_DATE virtual void on_date_command_request(const DateCommandRequest &value){}; #endif - #ifdef USE_DATETIME_TIME virtual void on_time_command_request(const TimeCommandRequest &value){}; #endif - - - #ifdef USE_VALVE virtual void on_valve_command_request(const ValveCommandRequest &value){}; #endif - #ifdef USE_DATETIME_DATETIME virtual void on_date_time_command_request(const DateTimeCommandRequest &value){}; #endif - #ifdef USE_UPDATE virtual void on_update_command_request(const UpdateCommandRequest &value){}; #endif @@ -354,7 +324,8 @@ class APIServerConnection : public APIServerConnectionBase { virtual void bluetooth_gatt_notify(const BluetoothGATTNotifyRequest &msg) = 0; #endif #ifdef USE_BLUETOOTH_PROXY - virtual bool send_subscribe_bluetooth_connections_free_response(const SubscribeBluetoothConnectionsFreeRequest &msg) = 0; + virtual bool send_subscribe_bluetooth_connections_free_response( + const SubscribeBluetoothConnectionsFreeRequest &msg) = 0; #endif #ifdef USE_BLUETOOTH_PROXY virtual void unsubscribe_bluetooth_le_advertisements(const UnsubscribeBluetoothLEAdvertisementsRequest &msg) = 0; @@ -485,7 +456,8 @@ class APIServerConnection : public APIServerConnectionBase { void on_subscribe_bluetooth_connections_free_request(const SubscribeBluetoothConnectionsFreeRequest &msg) override; #endif #ifdef USE_BLUETOOTH_PROXY - void on_unsubscribe_bluetooth_le_advertisements_request(const UnsubscribeBluetoothLEAdvertisementsRequest &msg) override; + void on_unsubscribe_bluetooth_le_advertisements_request( + const UnsubscribeBluetoothLEAdvertisementsRequest &msg) override; #endif #ifdef USE_BLUETOOTH_PROXY void on_bluetooth_scanner_set_mode_request(const BluetoothScannerSetModeRequest &msg) override;