mirror of
https://github.com/esphome/esphome.git
synced 2025-08-01 07:57:47 +00:00
Remove deprecated protobuf fields to reduce flash usage
This commit is contained in:
parent
a11c39bdc9
commit
0a45014330
@ -230,14 +230,16 @@ message DeviceInfoResponse {
|
||||
|
||||
uint32 webserver_port = 10 [(field_ifdef) = "USE_WEBSERVER"];
|
||||
|
||||
uint32 legacy_bluetooth_proxy_version = 11 [(field_ifdef) = "USE_BLUETOOTH_PROXY"];
|
||||
// Deprecated in API version 1.9
|
||||
uint32 legacy_bluetooth_proxy_version = 11 [deprecated=true, (field_ifdef) = "USE_BLUETOOTH_PROXY"];
|
||||
uint32 bluetooth_proxy_feature_flags = 15 [(field_ifdef) = "USE_BLUETOOTH_PROXY"];
|
||||
|
||||
string manufacturer = 12;
|
||||
|
||||
string friendly_name = 13;
|
||||
|
||||
uint32 legacy_voice_assistant_version = 14 [(field_ifdef) = "USE_VOICE_ASSISTANT"];
|
||||
// Deprecated in API version 1.10
|
||||
uint32 legacy_voice_assistant_version = 14 [deprecated=true, (field_ifdef) = "USE_VOICE_ASSISTANT"];
|
||||
uint32 voice_assistant_feature_flags = 17 [(field_ifdef) = "USE_VOICE_ASSISTANT"];
|
||||
|
||||
string suggested_area = 16 [(field_ifdef) = "USE_AREAS"];
|
||||
@ -337,6 +339,7 @@ message ListEntitiesCoverResponse {
|
||||
uint32 device_id = 13 [(field_ifdef) = "USE_DEVICES"];
|
||||
}
|
||||
|
||||
// Deprecated in API version 1.1
|
||||
enum LegacyCoverState {
|
||||
LEGACY_COVER_STATE_OPEN = 0;
|
||||
LEGACY_COVER_STATE_CLOSED = 1;
|
||||
@ -356,7 +359,8 @@ message CoverStateResponse {
|
||||
fixed32 key = 1;
|
||||
// legacy: state has been removed in 1.13
|
||||
// clients/servers must still send/accept it until the next protocol change
|
||||
LegacyCoverState legacy_state = 2;
|
||||
// Deprecated in API version 1.1
|
||||
LegacyCoverState legacy_state = 2 [deprecated=true];
|
||||
|
||||
float position = 3;
|
||||
float tilt = 4;
|
||||
@ -364,6 +368,7 @@ message CoverStateResponse {
|
||||
uint32 device_id = 6 [(field_ifdef) = "USE_DEVICES"];
|
||||
}
|
||||
|
||||
// Deprecated in API version 1.1
|
||||
enum LegacyCoverCommand {
|
||||
LEGACY_COVER_COMMAND_OPEN = 0;
|
||||
LEGACY_COVER_COMMAND_CLOSE = 1;
|
||||
@ -380,8 +385,10 @@ message CoverCommandRequest {
|
||||
|
||||
// legacy: command has been removed in 1.13
|
||||
// clients/servers must still send/accept it until the next protocol change
|
||||
bool has_legacy_command = 2;
|
||||
LegacyCoverCommand legacy_command = 3;
|
||||
// Deprecated in API version 1.1
|
||||
bool has_legacy_command = 2 [deprecated=true];
|
||||
// Deprecated in API version 1.1
|
||||
LegacyCoverCommand legacy_command = 3 [deprecated=true];
|
||||
|
||||
bool has_position = 4;
|
||||
float position = 5;
|
||||
@ -432,7 +439,8 @@ message FanStateResponse {
|
||||
fixed32 key = 1;
|
||||
bool state = 2;
|
||||
bool oscillating = 3;
|
||||
FanSpeed speed = 4 [deprecated = true];
|
||||
// Deprecated in API version 1.6
|
||||
FanSpeed speed = 4 [deprecated=true];
|
||||
FanDirection direction = 5;
|
||||
int32 speed_level = 6;
|
||||
string preset_mode = 7;
|
||||
@ -448,8 +456,10 @@ message FanCommandRequest {
|
||||
fixed32 key = 1;
|
||||
bool has_state = 2;
|
||||
bool state = 3;
|
||||
bool has_speed = 4 [deprecated = true];
|
||||
FanSpeed speed = 5 [deprecated = true];
|
||||
// Deprecated in API version 1.6
|
||||
bool has_speed = 4 [deprecated=true];
|
||||
// Deprecated in API version 1.6
|
||||
FanSpeed speed = 5 [deprecated=true];
|
||||
bool has_oscillating = 6;
|
||||
bool oscillating = 7;
|
||||
bool has_direction = 8;
|
||||
@ -488,9 +498,13 @@ message ListEntitiesLightResponse {
|
||||
|
||||
repeated ColorMode supported_color_modes = 12;
|
||||
// next four supports_* are for legacy clients, newer clients should use color modes
|
||||
// Deprecated in API version 1.6
|
||||
bool legacy_supports_brightness = 5 [deprecated=true];
|
||||
// Deprecated in API version 1.6
|
||||
bool legacy_supports_rgb = 6 [deprecated=true];
|
||||
// Deprecated in API version 1.6
|
||||
bool legacy_supports_white_value = 7 [deprecated=true];
|
||||
// Deprecated in API version 1.6
|
||||
bool legacy_supports_color_temperature = 8 [deprecated=true];
|
||||
float min_mireds = 9;
|
||||
float max_mireds = 10;
|
||||
@ -567,6 +581,7 @@ enum SensorStateClass {
|
||||
STATE_CLASS_TOTAL = 3;
|
||||
}
|
||||
|
||||
// Deprecated in API version 1.5
|
||||
enum SensorLastResetType {
|
||||
LAST_RESET_NONE = 0;
|
||||
LAST_RESET_NEVER = 1;
|
||||
@ -591,7 +606,8 @@ message ListEntitiesSensorResponse {
|
||||
string device_class = 9;
|
||||
SensorStateClass state_class = 10;
|
||||
// Last reset type removed in 2021.9.0
|
||||
SensorLastResetType legacy_last_reset_type = 11;
|
||||
// Deprecated in API version 1.5
|
||||
SensorLastResetType legacy_last_reset_type = 11 [deprecated=true];
|
||||
bool disabled_by_default = 12;
|
||||
EntityCategory entity_category = 13;
|
||||
uint32 device_id = 14 [(field_ifdef) = "USE_DEVICES"];
|
||||
@ -947,7 +963,8 @@ message ListEntitiesClimateResponse {
|
||||
float visual_target_temperature_step = 10;
|
||||
// for older peer versions - in new system this
|
||||
// is if CLIMATE_PRESET_AWAY exists is supported_presets
|
||||
bool legacy_supports_away = 11;
|
||||
// Deprecated in API version 1.5
|
||||
bool legacy_supports_away = 11 [deprecated=true];
|
||||
bool supports_action = 12;
|
||||
repeated ClimateFanMode supported_fan_modes = 13;
|
||||
repeated ClimateSwingMode supported_swing_modes = 14;
|
||||
@ -978,7 +995,8 @@ message ClimateStateResponse {
|
||||
float target_temperature_low = 5;
|
||||
float target_temperature_high = 6;
|
||||
// For older peers, equal to preset == CLIMATE_PRESET_AWAY
|
||||
bool unused_legacy_away = 7;
|
||||
// Deprecated in API version 1.5
|
||||
bool unused_legacy_away = 7 [deprecated=true];
|
||||
ClimateAction action = 8;
|
||||
ClimateFanMode fan_mode = 9;
|
||||
ClimateSwingMode swing_mode = 10;
|
||||
@ -1006,8 +1024,10 @@ message ClimateCommandRequest {
|
||||
bool has_target_temperature_high = 8;
|
||||
float target_temperature_high = 9;
|
||||
// legacy, for older peers, newer ones should use CLIMATE_PRESET_AWAY in preset
|
||||
bool unused_has_legacy_away = 10;
|
||||
bool unused_legacy_away = 11;
|
||||
// Deprecated in API version 1.5
|
||||
bool unused_has_legacy_away = 10 [deprecated=true];
|
||||
// Deprecated in API version 1.5
|
||||
bool unused_legacy_away = 11 [deprecated=true];
|
||||
bool has_fan_mode = 12;
|
||||
ClimateFanMode fan_mode = 13;
|
||||
bool has_swing_mode = 14;
|
||||
@ -1356,7 +1376,8 @@ message SubscribeBluetoothLEAdvertisementsRequest {
|
||||
|
||||
message BluetoothServiceData {
|
||||
string uuid = 1;
|
||||
repeated uint32 legacy_data = 2 [deprecated = true]; // Removed in api version 1.7
|
||||
// Deprecated in API version 1.7
|
||||
repeated uint32 legacy_data = 2 [deprecated=true]; // Removed in api version 1.7
|
||||
bytes data = 3; // Added in api version 1.7
|
||||
}
|
||||
message BluetoothLEAdvertisementResponse {
|
||||
|
@ -94,17 +94,11 @@ void DeviceInfoResponse::encode(ProtoWriteBuffer buffer) const {
|
||||
#ifdef USE_WEBSERVER
|
||||
buffer.encode_uint32(10, this->webserver_port);
|
||||
#endif
|
||||
#ifdef USE_BLUETOOTH_PROXY
|
||||
buffer.encode_uint32(11, this->legacy_bluetooth_proxy_version);
|
||||
#endif
|
||||
#ifdef USE_BLUETOOTH_PROXY
|
||||
buffer.encode_uint32(15, this->bluetooth_proxy_feature_flags);
|
||||
#endif
|
||||
buffer.encode_string(12, this->manufacturer);
|
||||
buffer.encode_string(13, this->friendly_name);
|
||||
#ifdef USE_VOICE_ASSISTANT
|
||||
buffer.encode_uint32(14, this->legacy_voice_assistant_version);
|
||||
#endif
|
||||
#ifdef USE_VOICE_ASSISTANT
|
||||
buffer.encode_uint32(17, this->voice_assistant_feature_flags);
|
||||
#endif
|
||||
@ -150,17 +144,11 @@ void DeviceInfoResponse::calculate_size(uint32_t &total_size) const {
|
||||
#ifdef USE_WEBSERVER
|
||||
ProtoSize::add_uint32_field(total_size, 1, this->webserver_port);
|
||||
#endif
|
||||
#ifdef USE_BLUETOOTH_PROXY
|
||||
ProtoSize::add_uint32_field(total_size, 1, this->legacy_bluetooth_proxy_version);
|
||||
#endif
|
||||
#ifdef USE_BLUETOOTH_PROXY
|
||||
ProtoSize::add_uint32_field(total_size, 1, this->bluetooth_proxy_feature_flags);
|
||||
#endif
|
||||
ProtoSize::add_string_field(total_size, 1, this->manufacturer);
|
||||
ProtoSize::add_string_field(total_size, 1, this->friendly_name);
|
||||
#ifdef USE_VOICE_ASSISTANT
|
||||
ProtoSize::add_uint32_field(total_size, 1, this->legacy_voice_assistant_version);
|
||||
#endif
|
||||
#ifdef USE_VOICE_ASSISTANT
|
||||
ProtoSize::add_uint32_field(total_size, 2, this->voice_assistant_feature_flags);
|
||||
#endif
|
||||
@ -270,7 +258,6 @@ void ListEntitiesCoverResponse::calculate_size(uint32_t &total_size) const {
|
||||
}
|
||||
void CoverStateResponse::encode(ProtoWriteBuffer buffer) const {
|
||||
buffer.encode_fixed32(1, this->key);
|
||||
buffer.encode_uint32(2, static_cast<uint32_t>(this->legacy_state));
|
||||
buffer.encode_float(3, this->position);
|
||||
buffer.encode_float(4, this->tilt);
|
||||
buffer.encode_uint32(5, static_cast<uint32_t>(this->current_operation));
|
||||
@ -280,7 +267,6 @@ void CoverStateResponse::encode(ProtoWriteBuffer buffer) const {
|
||||
}
|
||||
void CoverStateResponse::calculate_size(uint32_t &total_size) const {
|
||||
ProtoSize::add_fixed32_field(total_size, 1, this->key);
|
||||
ProtoSize::add_enum_field(total_size, 1, static_cast<uint32_t>(this->legacy_state));
|
||||
ProtoSize::add_float_field(total_size, 1, this->position);
|
||||
ProtoSize::add_float_field(total_size, 1, this->tilt);
|
||||
ProtoSize::add_enum_field(total_size, 1, static_cast<uint32_t>(this->current_operation));
|
||||
@ -290,12 +276,6 @@ void CoverStateResponse::calculate_size(uint32_t &total_size) const {
|
||||
}
|
||||
bool CoverCommandRequest::decode_varint(uint32_t field_id, ProtoVarInt value) {
|
||||
switch (field_id) {
|
||||
case 2:
|
||||
this->has_legacy_command = value.as_bool();
|
||||
break;
|
||||
case 3:
|
||||
this->legacy_command = static_cast<enums::LegacyCoverCommand>(value.as_uint32());
|
||||
break;
|
||||
case 4:
|
||||
this->has_position = value.as_bool();
|
||||
break;
|
||||
@ -379,7 +359,6 @@ void FanStateResponse::encode(ProtoWriteBuffer buffer) const {
|
||||
buffer.encode_fixed32(1, this->key);
|
||||
buffer.encode_bool(2, this->state);
|
||||
buffer.encode_bool(3, this->oscillating);
|
||||
buffer.encode_uint32(4, static_cast<uint32_t>(this->speed));
|
||||
buffer.encode_uint32(5, static_cast<uint32_t>(this->direction));
|
||||
buffer.encode_int32(6, this->speed_level);
|
||||
buffer.encode_string(7, this->preset_mode);
|
||||
@ -391,7 +370,6 @@ void FanStateResponse::calculate_size(uint32_t &total_size) const {
|
||||
ProtoSize::add_fixed32_field(total_size, 1, this->key);
|
||||
ProtoSize::add_bool_field(total_size, 1, this->state);
|
||||
ProtoSize::add_bool_field(total_size, 1, this->oscillating);
|
||||
ProtoSize::add_enum_field(total_size, 1, static_cast<uint32_t>(this->speed));
|
||||
ProtoSize::add_enum_field(total_size, 1, static_cast<uint32_t>(this->direction));
|
||||
ProtoSize::add_int32_field(total_size, 1, this->speed_level);
|
||||
ProtoSize::add_string_field(total_size, 1, this->preset_mode);
|
||||
@ -407,12 +385,6 @@ bool FanCommandRequest::decode_varint(uint32_t field_id, ProtoVarInt value) {
|
||||
case 3:
|
||||
this->state = value.as_bool();
|
||||
break;
|
||||
case 4:
|
||||
this->has_speed = value.as_bool();
|
||||
break;
|
||||
case 5:
|
||||
this->speed = static_cast<enums::FanSpeed>(value.as_uint32());
|
||||
break;
|
||||
case 6:
|
||||
this->has_oscillating = value.as_bool();
|
||||
break;
|
||||
@ -473,10 +445,6 @@ void ListEntitiesLightResponse::encode(ProtoWriteBuffer buffer) const {
|
||||
for (auto &it : this->supported_color_modes) {
|
||||
buffer.encode_uint32(12, static_cast<uint32_t>(it), true);
|
||||
}
|
||||
buffer.encode_bool(5, this->legacy_supports_brightness);
|
||||
buffer.encode_bool(6, this->legacy_supports_rgb);
|
||||
buffer.encode_bool(7, this->legacy_supports_white_value);
|
||||
buffer.encode_bool(8, this->legacy_supports_color_temperature);
|
||||
buffer.encode_float(9, this->min_mireds);
|
||||
buffer.encode_float(10, this->max_mireds);
|
||||
for (auto &it : this->effects) {
|
||||
@ -500,10 +468,6 @@ void ListEntitiesLightResponse::calculate_size(uint32_t &total_size) const {
|
||||
ProtoSize::add_enum_field_repeated(total_size, 1, static_cast<uint32_t>(it));
|
||||
}
|
||||
}
|
||||
ProtoSize::add_bool_field(total_size, 1, this->legacy_supports_brightness);
|
||||
ProtoSize::add_bool_field(total_size, 1, this->legacy_supports_rgb);
|
||||
ProtoSize::add_bool_field(total_size, 1, this->legacy_supports_white_value);
|
||||
ProtoSize::add_bool_field(total_size, 1, this->legacy_supports_color_temperature);
|
||||
ProtoSize::add_float_field(total_size, 1, this->min_mireds);
|
||||
ProtoSize::add_float_field(total_size, 1, this->max_mireds);
|
||||
if (!this->effects.empty()) {
|
||||
@ -677,7 +641,6 @@ void ListEntitiesSensorResponse::encode(ProtoWriteBuffer buffer) const {
|
||||
buffer.encode_bool(8, this->force_update);
|
||||
buffer.encode_string(9, this->device_class);
|
||||
buffer.encode_uint32(10, static_cast<uint32_t>(this->state_class));
|
||||
buffer.encode_uint32(11, static_cast<uint32_t>(this->legacy_last_reset_type));
|
||||
buffer.encode_bool(12, this->disabled_by_default);
|
||||
buffer.encode_uint32(13, static_cast<uint32_t>(this->entity_category));
|
||||
#ifdef USE_DEVICES
|
||||
@ -696,7 +659,6 @@ void ListEntitiesSensorResponse::calculate_size(uint32_t &total_size) const {
|
||||
ProtoSize::add_bool_field(total_size, 1, this->force_update);
|
||||
ProtoSize::add_string_field(total_size, 1, this->device_class);
|
||||
ProtoSize::add_enum_field(total_size, 1, static_cast<uint32_t>(this->state_class));
|
||||
ProtoSize::add_enum_field(total_size, 1, static_cast<uint32_t>(this->legacy_last_reset_type));
|
||||
ProtoSize::add_bool_field(total_size, 1, this->disabled_by_default);
|
||||
ProtoSize::add_enum_field(total_size, 1, static_cast<uint32_t>(this->entity_category));
|
||||
#ifdef USE_DEVICES
|
||||
@ -1105,7 +1067,6 @@ void ListEntitiesClimateResponse::encode(ProtoWriteBuffer buffer) const {
|
||||
buffer.encode_float(8, this->visual_min_temperature);
|
||||
buffer.encode_float(9, this->visual_max_temperature);
|
||||
buffer.encode_float(10, this->visual_target_temperature_step);
|
||||
buffer.encode_bool(11, this->legacy_supports_away);
|
||||
buffer.encode_bool(12, this->supports_action);
|
||||
for (auto &it : this->supported_fan_modes) {
|
||||
buffer.encode_uint32(13, static_cast<uint32_t>(it), true);
|
||||
@ -1150,7 +1111,6 @@ void ListEntitiesClimateResponse::calculate_size(uint32_t &total_size) const {
|
||||
ProtoSize::add_float_field(total_size, 1, this->visual_min_temperature);
|
||||
ProtoSize::add_float_field(total_size, 1, this->visual_max_temperature);
|
||||
ProtoSize::add_float_field(total_size, 1, this->visual_target_temperature_step);
|
||||
ProtoSize::add_bool_field(total_size, 1, this->legacy_supports_away);
|
||||
ProtoSize::add_bool_field(total_size, 1, this->supports_action);
|
||||
if (!this->supported_fan_modes.empty()) {
|
||||
for (const auto &it : this->supported_fan_modes) {
|
||||
@ -1198,7 +1158,6 @@ void ClimateStateResponse::encode(ProtoWriteBuffer buffer) const {
|
||||
buffer.encode_float(4, this->target_temperature);
|
||||
buffer.encode_float(5, this->target_temperature_low);
|
||||
buffer.encode_float(6, this->target_temperature_high);
|
||||
buffer.encode_bool(7, this->unused_legacy_away);
|
||||
buffer.encode_uint32(8, static_cast<uint32_t>(this->action));
|
||||
buffer.encode_uint32(9, static_cast<uint32_t>(this->fan_mode));
|
||||
buffer.encode_uint32(10, static_cast<uint32_t>(this->swing_mode));
|
||||
@ -1218,7 +1177,6 @@ void ClimateStateResponse::calculate_size(uint32_t &total_size) const {
|
||||
ProtoSize::add_float_field(total_size, 1, this->target_temperature);
|
||||
ProtoSize::add_float_field(total_size, 1, this->target_temperature_low);
|
||||
ProtoSize::add_float_field(total_size, 1, this->target_temperature_high);
|
||||
ProtoSize::add_bool_field(total_size, 1, this->unused_legacy_away);
|
||||
ProtoSize::add_enum_field(total_size, 1, static_cast<uint32_t>(this->action));
|
||||
ProtoSize::add_enum_field(total_size, 1, static_cast<uint32_t>(this->fan_mode));
|
||||
ProtoSize::add_enum_field(total_size, 1, static_cast<uint32_t>(this->swing_mode));
|
||||
@ -1248,12 +1206,6 @@ bool ClimateCommandRequest::decode_varint(uint32_t field_id, ProtoVarInt value)
|
||||
case 8:
|
||||
this->has_target_temperature_high = value.as_bool();
|
||||
break;
|
||||
case 10:
|
||||
this->unused_has_legacy_away = value.as_bool();
|
||||
break;
|
||||
case 11:
|
||||
this->unused_legacy_away = value.as_bool();
|
||||
break;
|
||||
case 12:
|
||||
this->has_fan_mode = value.as_bool();
|
||||
break;
|
||||
@ -1871,18 +1823,10 @@ bool SubscribeBluetoothLEAdvertisementsRequest::decode_varint(uint32_t field_id,
|
||||
}
|
||||
void BluetoothServiceData::encode(ProtoWriteBuffer buffer) const {
|
||||
buffer.encode_string(1, this->uuid);
|
||||
for (auto &it : this->legacy_data) {
|
||||
buffer.encode_uint32(2, it, true);
|
||||
}
|
||||
buffer.encode_bytes(3, reinterpret_cast<const uint8_t *>(this->data.data()), this->data.size());
|
||||
}
|
||||
void BluetoothServiceData::calculate_size(uint32_t &total_size) const {
|
||||
ProtoSize::add_string_field(total_size, 1, this->uuid);
|
||||
if (!this->legacy_data.empty()) {
|
||||
for (const auto &it : this->legacy_data) {
|
||||
ProtoSize::add_uint32_field_repeated(total_size, 1, it);
|
||||
}
|
||||
}
|
||||
ProtoSize::add_string_field(total_size, 1, this->data);
|
||||
}
|
||||
void BluetoothLEAdvertisementResponse::encode(ProtoWriteBuffer buffer) const {
|
||||
|
@ -477,7 +477,7 @@ class DeviceInfo : public ProtoMessage {
|
||||
class DeviceInfoResponse : public ProtoMessage {
|
||||
public:
|
||||
static constexpr uint8_t MESSAGE_TYPE = 10;
|
||||
static constexpr uint8_t ESTIMATED_SIZE = 219;
|
||||
static constexpr uint8_t ESTIMATED_SIZE = 211;
|
||||
#ifdef HAS_PROTO_MESSAGE_DUMP
|
||||
const char *message_name() const override { return "device_info_response"; }
|
||||
#endif
|
||||
@ -499,17 +499,11 @@ class DeviceInfoResponse : public ProtoMessage {
|
||||
#ifdef USE_WEBSERVER
|
||||
uint32_t webserver_port{0};
|
||||
#endif
|
||||
#ifdef USE_BLUETOOTH_PROXY
|
||||
uint32_t legacy_bluetooth_proxy_version{0};
|
||||
#endif
|
||||
#ifdef USE_BLUETOOTH_PROXY
|
||||
uint32_t bluetooth_proxy_feature_flags{0};
|
||||
#endif
|
||||
std::string manufacturer{};
|
||||
std::string friendly_name{};
|
||||
#ifdef USE_VOICE_ASSISTANT
|
||||
uint32_t legacy_voice_assistant_version{0};
|
||||
#endif
|
||||
#ifdef USE_VOICE_ASSISTANT
|
||||
uint32_t voice_assistant_feature_flags{0};
|
||||
#endif
|
||||
@ -638,11 +632,10 @@ class ListEntitiesCoverResponse : public InfoResponseProtoMessage {
|
||||
class CoverStateResponse : public StateResponseProtoMessage {
|
||||
public:
|
||||
static constexpr uint8_t MESSAGE_TYPE = 22;
|
||||
static constexpr uint8_t ESTIMATED_SIZE = 23;
|
||||
static constexpr uint8_t ESTIMATED_SIZE = 21;
|
||||
#ifdef HAS_PROTO_MESSAGE_DUMP
|
||||
const char *message_name() const override { return "cover_state_response"; }
|
||||
#endif
|
||||
enums::LegacyCoverState legacy_state{};
|
||||
float position{0.0f};
|
||||
float tilt{0.0f};
|
||||
enums::CoverOperation current_operation{};
|
||||
@ -657,12 +650,10 @@ class CoverStateResponse : public StateResponseProtoMessage {
|
||||
class CoverCommandRequest : public CommandProtoMessage {
|
||||
public:
|
||||
static constexpr uint8_t MESSAGE_TYPE = 30;
|
||||
static constexpr uint8_t ESTIMATED_SIZE = 29;
|
||||
static constexpr uint8_t ESTIMATED_SIZE = 25;
|
||||
#ifdef HAS_PROTO_MESSAGE_DUMP
|
||||
const char *message_name() const override { return "cover_command_request"; }
|
||||
#endif
|
||||
bool has_legacy_command{false};
|
||||
enums::LegacyCoverCommand legacy_command{};
|
||||
bool has_position{false};
|
||||
float position{0.0f};
|
||||
bool has_tilt{false};
|
||||
@ -701,13 +692,12 @@ class ListEntitiesFanResponse : public InfoResponseProtoMessage {
|
||||
class FanStateResponse : public StateResponseProtoMessage {
|
||||
public:
|
||||
static constexpr uint8_t MESSAGE_TYPE = 23;
|
||||
static constexpr uint8_t ESTIMATED_SIZE = 30;
|
||||
static constexpr uint8_t ESTIMATED_SIZE = 28;
|
||||
#ifdef HAS_PROTO_MESSAGE_DUMP
|
||||
const char *message_name() const override { return "fan_state_response"; }
|
||||
#endif
|
||||
bool state{false};
|
||||
bool oscillating{false};
|
||||
enums::FanSpeed speed{};
|
||||
enums::FanDirection direction{};
|
||||
int32_t speed_level{0};
|
||||
std::string preset_mode{};
|
||||
@ -722,14 +712,12 @@ class FanStateResponse : public StateResponseProtoMessage {
|
||||
class FanCommandRequest : public CommandProtoMessage {
|
||||
public:
|
||||
static constexpr uint8_t MESSAGE_TYPE = 31;
|
||||
static constexpr uint8_t ESTIMATED_SIZE = 42;
|
||||
static constexpr uint8_t ESTIMATED_SIZE = 38;
|
||||
#ifdef HAS_PROTO_MESSAGE_DUMP
|
||||
const char *message_name() const override { return "fan_command_request"; }
|
||||
#endif
|
||||
bool has_state{false};
|
||||
bool state{false};
|
||||
bool has_speed{false};
|
||||
enums::FanSpeed speed{};
|
||||
bool has_oscillating{false};
|
||||
bool oscillating{false};
|
||||
bool has_direction{false};
|
||||
@ -752,15 +740,11 @@ class FanCommandRequest : public CommandProtoMessage {
|
||||
class ListEntitiesLightResponse : public InfoResponseProtoMessage {
|
||||
public:
|
||||
static constexpr uint8_t MESSAGE_TYPE = 15;
|
||||
static constexpr uint8_t ESTIMATED_SIZE = 81;
|
||||
static constexpr uint8_t ESTIMATED_SIZE = 73;
|
||||
#ifdef HAS_PROTO_MESSAGE_DUMP
|
||||
const char *message_name() const override { return "list_entities_light_response"; }
|
||||
#endif
|
||||
std::vector<enums::ColorMode> supported_color_modes{};
|
||||
bool legacy_supports_brightness{false};
|
||||
bool legacy_supports_rgb{false};
|
||||
bool legacy_supports_white_value{false};
|
||||
bool legacy_supports_color_temperature{false};
|
||||
float min_mireds{0.0f};
|
||||
float max_mireds{0.0f};
|
||||
std::vector<std::string> effects{};
|
||||
@ -846,7 +830,7 @@ class LightCommandRequest : public CommandProtoMessage {
|
||||
class ListEntitiesSensorResponse : public InfoResponseProtoMessage {
|
||||
public:
|
||||
static constexpr uint8_t MESSAGE_TYPE = 16;
|
||||
static constexpr uint8_t ESTIMATED_SIZE = 68;
|
||||
static constexpr uint8_t ESTIMATED_SIZE = 66;
|
||||
#ifdef HAS_PROTO_MESSAGE_DUMP
|
||||
const char *message_name() const override { return "list_entities_sensor_response"; }
|
||||
#endif
|
||||
@ -855,7 +839,6 @@ class ListEntitiesSensorResponse : public InfoResponseProtoMessage {
|
||||
bool force_update{false};
|
||||
std::string device_class{};
|
||||
enums::SensorStateClass state_class{};
|
||||
enums::SensorLastResetType legacy_last_reset_type{};
|
||||
void encode(ProtoWriteBuffer buffer) const override;
|
||||
void calculate_size(uint32_t &total_size) const override;
|
||||
#ifdef HAS_PROTO_MESSAGE_DUMP
|
||||
@ -1281,7 +1264,7 @@ class CameraImageRequest : public ProtoDecodableMessage {
|
||||
class ListEntitiesClimateResponse : public InfoResponseProtoMessage {
|
||||
public:
|
||||
static constexpr uint8_t MESSAGE_TYPE = 46;
|
||||
static constexpr uint8_t ESTIMATED_SIZE = 147;
|
||||
static constexpr uint8_t ESTIMATED_SIZE = 145;
|
||||
#ifdef HAS_PROTO_MESSAGE_DUMP
|
||||
const char *message_name() const override { return "list_entities_climate_response"; }
|
||||
#endif
|
||||
@ -1291,7 +1274,6 @@ class ListEntitiesClimateResponse : public InfoResponseProtoMessage {
|
||||
float visual_min_temperature{0.0f};
|
||||
float visual_max_temperature{0.0f};
|
||||
float visual_target_temperature_step{0.0f};
|
||||
bool legacy_supports_away{false};
|
||||
bool supports_action{false};
|
||||
std::vector<enums::ClimateFanMode> supported_fan_modes{};
|
||||
std::vector<enums::ClimateSwingMode> supported_swing_modes{};
|
||||
@ -1314,7 +1296,7 @@ class ListEntitiesClimateResponse : public InfoResponseProtoMessage {
|
||||
class ClimateStateResponse : public StateResponseProtoMessage {
|
||||
public:
|
||||
static constexpr uint8_t MESSAGE_TYPE = 47;
|
||||
static constexpr uint8_t ESTIMATED_SIZE = 70;
|
||||
static constexpr uint8_t ESTIMATED_SIZE = 68;
|
||||
#ifdef HAS_PROTO_MESSAGE_DUMP
|
||||
const char *message_name() const override { return "climate_state_response"; }
|
||||
#endif
|
||||
@ -1323,7 +1305,6 @@ class ClimateStateResponse : public StateResponseProtoMessage {
|
||||
float target_temperature{0.0f};
|
||||
float target_temperature_low{0.0f};
|
||||
float target_temperature_high{0.0f};
|
||||
bool unused_legacy_away{false};
|
||||
enums::ClimateAction action{};
|
||||
enums::ClimateFanMode fan_mode{};
|
||||
enums::ClimateSwingMode swing_mode{};
|
||||
@ -1343,7 +1324,7 @@ class ClimateStateResponse : public StateResponseProtoMessage {
|
||||
class ClimateCommandRequest : public CommandProtoMessage {
|
||||
public:
|
||||
static constexpr uint8_t MESSAGE_TYPE = 48;
|
||||
static constexpr uint8_t ESTIMATED_SIZE = 88;
|
||||
static constexpr uint8_t ESTIMATED_SIZE = 84;
|
||||
#ifdef HAS_PROTO_MESSAGE_DUMP
|
||||
const char *message_name() const override { return "climate_command_request"; }
|
||||
#endif
|
||||
@ -1355,8 +1336,6 @@ class ClimateCommandRequest : public CommandProtoMessage {
|
||||
float target_temperature_low{0.0f};
|
||||
bool has_target_temperature_high{false};
|
||||
float target_temperature_high{0.0f};
|
||||
bool unused_has_legacy_away{false};
|
||||
bool unused_legacy_away{false};
|
||||
bool has_fan_mode{false};
|
||||
enums::ClimateFanMode fan_mode{};
|
||||
bool has_swing_mode{false};
|
||||
@ -1731,7 +1710,6 @@ class SubscribeBluetoothLEAdvertisementsRequest : public ProtoDecodableMessage {
|
||||
class BluetoothServiceData : public ProtoMessage {
|
||||
public:
|
||||
std::string uuid{};
|
||||
std::vector<uint32_t> legacy_data{};
|
||||
std::string data{};
|
||||
void encode(ProtoWriteBuffer buffer) const override;
|
||||
void calculate_size(uint32_t &total_size) const override;
|
||||
|
@ -737,13 +737,6 @@ void DeviceInfoResponse::dump_to(std::string &out) const {
|
||||
out.append(buffer);
|
||||
out.append("\n");
|
||||
|
||||
#endif
|
||||
#ifdef USE_BLUETOOTH_PROXY
|
||||
out.append(" legacy_bluetooth_proxy_version: ");
|
||||
snprintf(buffer, sizeof(buffer), "%" PRIu32, this->legacy_bluetooth_proxy_version);
|
||||
out.append(buffer);
|
||||
out.append("\n");
|
||||
|
||||
#endif
|
||||
#ifdef USE_BLUETOOTH_PROXY
|
||||
out.append(" bluetooth_proxy_feature_flags: ");
|
||||
@ -760,13 +753,6 @@ void DeviceInfoResponse::dump_to(std::string &out) const {
|
||||
out.append("'").append(this->friendly_name).append("'");
|
||||
out.append("\n");
|
||||
|
||||
#ifdef USE_VOICE_ASSISTANT
|
||||
out.append(" legacy_voice_assistant_version: ");
|
||||
snprintf(buffer, sizeof(buffer), "%" PRIu32, this->legacy_voice_assistant_version);
|
||||
out.append(buffer);
|
||||
out.append("\n");
|
||||
|
||||
#endif
|
||||
#ifdef USE_VOICE_ASSISTANT
|
||||
out.append(" voice_assistant_feature_flags: ");
|
||||
snprintf(buffer, sizeof(buffer), "%" PRIu32, this->voice_assistant_feature_flags);
|
||||
@ -961,10 +947,6 @@ void CoverStateResponse::dump_to(std::string &out) const {
|
||||
out.append(buffer);
|
||||
out.append("\n");
|
||||
|
||||
out.append(" legacy_state: ");
|
||||
out.append(proto_enum_to_string<enums::LegacyCoverState>(this->legacy_state));
|
||||
out.append("\n");
|
||||
|
||||
out.append(" position: ");
|
||||
snprintf(buffer, sizeof(buffer), "%g", this->position);
|
||||
out.append(buffer);
|
||||
@ -996,14 +978,6 @@ void CoverCommandRequest::dump_to(std::string &out) const {
|
||||
out.append(buffer);
|
||||
out.append("\n");
|
||||
|
||||
out.append(" has_legacy_command: ");
|
||||
out.append(YESNO(this->has_legacy_command));
|
||||
out.append("\n");
|
||||
|
||||
out.append(" legacy_command: ");
|
||||
out.append(proto_enum_to_string<enums::LegacyCoverCommand>(this->legacy_command));
|
||||
out.append("\n");
|
||||
|
||||
out.append(" has_position: ");
|
||||
out.append(YESNO(this->has_position));
|
||||
out.append("\n");
|
||||
@ -1115,10 +1089,6 @@ void FanStateResponse::dump_to(std::string &out) const {
|
||||
out.append(YESNO(this->oscillating));
|
||||
out.append("\n");
|
||||
|
||||
out.append(" speed: ");
|
||||
out.append(proto_enum_to_string<enums::FanSpeed>(this->speed));
|
||||
out.append("\n");
|
||||
|
||||
out.append(" direction: ");
|
||||
out.append(proto_enum_to_string<enums::FanDirection>(this->direction));
|
||||
out.append("\n");
|
||||
@ -1157,14 +1127,6 @@ void FanCommandRequest::dump_to(std::string &out) const {
|
||||
out.append(YESNO(this->state));
|
||||
out.append("\n");
|
||||
|
||||
out.append(" has_speed: ");
|
||||
out.append(YESNO(this->has_speed));
|
||||
out.append("\n");
|
||||
|
||||
out.append(" speed: ");
|
||||
out.append(proto_enum_to_string<enums::FanSpeed>(this->speed));
|
||||
out.append("\n");
|
||||
|
||||
out.append(" has_oscillating: ");
|
||||
out.append(YESNO(this->has_oscillating));
|
||||
out.append("\n");
|
||||
@ -1231,22 +1193,6 @@ void ListEntitiesLightResponse::dump_to(std::string &out) const {
|
||||
out.append("\n");
|
||||
}
|
||||
|
||||
out.append(" legacy_supports_brightness: ");
|
||||
out.append(YESNO(this->legacy_supports_brightness));
|
||||
out.append("\n");
|
||||
|
||||
out.append(" legacy_supports_rgb: ");
|
||||
out.append(YESNO(this->legacy_supports_rgb));
|
||||
out.append("\n");
|
||||
|
||||
out.append(" legacy_supports_white_value: ");
|
||||
out.append(YESNO(this->legacy_supports_white_value));
|
||||
out.append("\n");
|
||||
|
||||
out.append(" legacy_supports_color_temperature: ");
|
||||
out.append(YESNO(this->legacy_supports_color_temperature));
|
||||
out.append("\n");
|
||||
|
||||
out.append(" min_mireds: ");
|
||||
snprintf(buffer, sizeof(buffer), "%g", this->min_mireds);
|
||||
out.append(buffer);
|
||||
@ -1537,10 +1483,6 @@ void ListEntitiesSensorResponse::dump_to(std::string &out) const {
|
||||
out.append(proto_enum_to_string<enums::SensorStateClass>(this->state_class));
|
||||
out.append("\n");
|
||||
|
||||
out.append(" legacy_last_reset_type: ");
|
||||
out.append(proto_enum_to_string<enums::SensorLastResetType>(this->legacy_last_reset_type));
|
||||
out.append("\n");
|
||||
|
||||
out.append(" disabled_by_default: ");
|
||||
out.append(YESNO(this->disabled_by_default));
|
||||
out.append("\n");
|
||||
@ -2107,10 +2049,6 @@ void ListEntitiesClimateResponse::dump_to(std::string &out) const {
|
||||
out.append(buffer);
|
||||
out.append("\n");
|
||||
|
||||
out.append(" legacy_supports_away: ");
|
||||
out.append(YESNO(this->legacy_supports_away));
|
||||
out.append("\n");
|
||||
|
||||
out.append(" supports_action: ");
|
||||
out.append(YESNO(this->supports_action));
|
||||
out.append("\n");
|
||||
@ -2223,10 +2161,6 @@ void ClimateStateResponse::dump_to(std::string &out) const {
|
||||
out.append(buffer);
|
||||
out.append("\n");
|
||||
|
||||
out.append(" unused_legacy_away: ");
|
||||
out.append(YESNO(this->unused_legacy_away));
|
||||
out.append("\n");
|
||||
|
||||
out.append(" action: ");
|
||||
out.append(proto_enum_to_string<enums::ClimateAction>(this->action));
|
||||
out.append("\n");
|
||||
@ -2313,14 +2247,6 @@ void ClimateCommandRequest::dump_to(std::string &out) const {
|
||||
out.append(buffer);
|
||||
out.append("\n");
|
||||
|
||||
out.append(" unused_has_legacy_away: ");
|
||||
out.append(YESNO(this->unused_has_legacy_away));
|
||||
out.append("\n");
|
||||
|
||||
out.append(" unused_legacy_away: ");
|
||||
out.append(YESNO(this->unused_legacy_away));
|
||||
out.append("\n");
|
||||
|
||||
out.append(" has_fan_mode: ");
|
||||
out.append(YESNO(this->has_fan_mode));
|
||||
out.append("\n");
|
||||
@ -3060,13 +2986,6 @@ void BluetoothServiceData::dump_to(std::string &out) const {
|
||||
out.append("'").append(this->uuid).append("'");
|
||||
out.append("\n");
|
||||
|
||||
for (const auto &it : this->legacy_data) {
|
||||
out.append(" legacy_data: ");
|
||||
snprintf(buffer, sizeof(buffer), "%" PRIu32, it);
|
||||
out.append(buffer);
|
||||
out.append("\n");
|
||||
}
|
||||
|
||||
out.append(" data: ");
|
||||
out.append(format_hex_pretty(this->data));
|
||||
out.append("\n");
|
||||
|
@ -1145,6 +1145,10 @@ def calculate_message_estimated_size(desc: descriptor.DescriptorProto) -> int:
|
||||
total_size = 0
|
||||
|
||||
for field in desc.field:
|
||||
# Skip deprecated fields
|
||||
if field.options.deprecated:
|
||||
continue
|
||||
|
||||
ti = create_field_type_info(field)
|
||||
|
||||
# Add estimated size for this field
|
||||
@ -1213,6 +1217,10 @@ def build_message_type(
|
||||
public_content.append("#endif")
|
||||
|
||||
for field in desc.field:
|
||||
# Skip deprecated fields completely
|
||||
if field.options.deprecated:
|
||||
continue
|
||||
|
||||
ti = create_field_type_info(field)
|
||||
|
||||
# Skip field declarations for fields that are in the base class
|
||||
@ -1459,8 +1467,10 @@ def find_common_fields(
|
||||
if not messages:
|
||||
return []
|
||||
|
||||
# Start with fields from the first message
|
||||
first_msg_fields = {field.name: field for field in messages[0].field}
|
||||
# Start with fields from the first message (excluding deprecated fields)
|
||||
first_msg_fields = {
|
||||
field.name: field for field in messages[0].field if not field.options.deprecated
|
||||
}
|
||||
common_fields = []
|
||||
|
||||
# Check each field to see if it exists in all messages with same type
|
||||
@ -1471,6 +1481,9 @@ def find_common_fields(
|
||||
for msg in messages[1:]:
|
||||
found = False
|
||||
for other_field in msg.field:
|
||||
# Skip deprecated fields
|
||||
if other_field.options.deprecated:
|
||||
continue
|
||||
if (
|
||||
other_field.name == field_name
|
||||
and other_field.type == field.type
|
||||
|
Loading…
x
Reference in New Issue
Block a user