mirror of
https://github.com/esphome/esphome.git
synced 2025-09-10 07:12:21 +01:00
[api] Remove deprecated protobuf fields to reduce flash usage (#9679)
This commit is contained in:
@@ -23,16 +23,6 @@ template<> const char *proto_enum_to_string<enums::EntityCategory>(enums::Entity
|
||||
}
|
||||
}
|
||||
#ifdef USE_COVER
|
||||
template<> const char *proto_enum_to_string<enums::LegacyCoverState>(enums::LegacyCoverState value) {
|
||||
switch (value) {
|
||||
case enums::LEGACY_COVER_STATE_OPEN:
|
||||
return "LEGACY_COVER_STATE_OPEN";
|
||||
case enums::LEGACY_COVER_STATE_CLOSED:
|
||||
return "LEGACY_COVER_STATE_CLOSED";
|
||||
default:
|
||||
return "UNKNOWN";
|
||||
}
|
||||
}
|
||||
template<> const char *proto_enum_to_string<enums::CoverOperation>(enums::CoverOperation value) {
|
||||
switch (value) {
|
||||
case enums::COVER_OPERATION_IDLE:
|
||||
@@ -45,32 +35,8 @@ template<> const char *proto_enum_to_string<enums::CoverOperation>(enums::CoverO
|
||||
return "UNKNOWN";
|
||||
}
|
||||
}
|
||||
template<> const char *proto_enum_to_string<enums::LegacyCoverCommand>(enums::LegacyCoverCommand value) {
|
||||
switch (value) {
|
||||
case enums::LEGACY_COVER_COMMAND_OPEN:
|
||||
return "LEGACY_COVER_COMMAND_OPEN";
|
||||
case enums::LEGACY_COVER_COMMAND_CLOSE:
|
||||
return "LEGACY_COVER_COMMAND_CLOSE";
|
||||
case enums::LEGACY_COVER_COMMAND_STOP:
|
||||
return "LEGACY_COVER_COMMAND_STOP";
|
||||
default:
|
||||
return "UNKNOWN";
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#ifdef USE_FAN
|
||||
template<> const char *proto_enum_to_string<enums::FanSpeed>(enums::FanSpeed value) {
|
||||
switch (value) {
|
||||
case enums::FAN_SPEED_LOW:
|
||||
return "FAN_SPEED_LOW";
|
||||
case enums::FAN_SPEED_MEDIUM:
|
||||
return "FAN_SPEED_MEDIUM";
|
||||
case enums::FAN_SPEED_HIGH:
|
||||
return "FAN_SPEED_HIGH";
|
||||
default:
|
||||
return "UNKNOWN";
|
||||
}
|
||||
}
|
||||
template<> const char *proto_enum_to_string<enums::FanDirection>(enums::FanDirection value) {
|
||||
switch (value) {
|
||||
case enums::FAN_DIRECTION_FORWARD:
|
||||
@@ -127,18 +93,6 @@ template<> const char *proto_enum_to_string<enums::SensorStateClass>(enums::Sens
|
||||
return "UNKNOWN";
|
||||
}
|
||||
}
|
||||
template<> const char *proto_enum_to_string<enums::SensorLastResetType>(enums::SensorLastResetType value) {
|
||||
switch (value) {
|
||||
case enums::LAST_RESET_NONE:
|
||||
return "LAST_RESET_NONE";
|
||||
case enums::LAST_RESET_NEVER:
|
||||
return "LAST_RESET_NEVER";
|
||||
case enums::LAST_RESET_AUTO:
|
||||
return "LAST_RESET_AUTO";
|
||||
default:
|
||||
return "UNKNOWN";
|
||||
}
|
||||
}
|
||||
#endif
|
||||
template<> const char *proto_enum_to_string<enums::LogLevel>(enums::LogLevel value) {
|
||||
switch (value) {
|
||||
@@ -737,13 +691,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 +707,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 +901,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 +932,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 +1043,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 +1081,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 +1147,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 +1437,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 +2003,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 +2115,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 +2201,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");
|
||||
@@ -3053,66 +2933,6 @@ void SubscribeBluetoothLEAdvertisementsRequest::dump_to(std::string &out) const
|
||||
out.append("\n");
|
||||
out.append("}");
|
||||
}
|
||||
void BluetoothServiceData::dump_to(std::string &out) const {
|
||||
__attribute__((unused)) char buffer[64];
|
||||
out.append("BluetoothServiceData {\n");
|
||||
out.append(" uuid: ");
|
||||
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");
|
||||
out.append("}");
|
||||
}
|
||||
void BluetoothLEAdvertisementResponse::dump_to(std::string &out) const {
|
||||
__attribute__((unused)) char buffer[64];
|
||||
out.append("BluetoothLEAdvertisementResponse {\n");
|
||||
out.append(" address: ");
|
||||
snprintf(buffer, sizeof(buffer), "%llu", this->address);
|
||||
out.append(buffer);
|
||||
out.append("\n");
|
||||
|
||||
out.append(" name: ");
|
||||
out.append(format_hex_pretty(this->name));
|
||||
out.append("\n");
|
||||
|
||||
out.append(" rssi: ");
|
||||
snprintf(buffer, sizeof(buffer), "%" PRId32, this->rssi);
|
||||
out.append(buffer);
|
||||
out.append("\n");
|
||||
|
||||
for (const auto &it : this->service_uuids) {
|
||||
out.append(" service_uuids: ");
|
||||
out.append("'").append(it).append("'");
|
||||
out.append("\n");
|
||||
}
|
||||
|
||||
for (const auto &it : this->service_data) {
|
||||
out.append(" service_data: ");
|
||||
it.dump_to(out);
|
||||
out.append("\n");
|
||||
}
|
||||
|
||||
for (const auto &it : this->manufacturer_data) {
|
||||
out.append(" manufacturer_data: ");
|
||||
it.dump_to(out);
|
||||
out.append("\n");
|
||||
}
|
||||
|
||||
out.append(" address_type: ");
|
||||
snprintf(buffer, sizeof(buffer), "%" PRIu32, this->address_type);
|
||||
out.append(buffer);
|
||||
out.append("\n");
|
||||
out.append("}");
|
||||
}
|
||||
void BluetoothLERawAdvertisement::dump_to(std::string &out) const {
|
||||
__attribute__((unused)) char buffer[64];
|
||||
out.append("BluetoothLERawAdvertisement {\n");
|
||||
|
Reference in New Issue
Block a user