mirror of
https://github.com/esphome/esphome.git
synced 2025-10-28 05:33:53 +00:00
Remove last_reset_type and convert all those sensors to TOTAL_INCREASING (#2233)
This commit is contained in:
@@ -473,7 +473,8 @@ message ListEntitiesSensorResponse {
|
||||
bool force_update = 8;
|
||||
string device_class = 9;
|
||||
SensorStateClass state_class = 10;
|
||||
SensorLastResetType last_reset_type = 11;
|
||||
// Last reset type removed in 2021.9.0
|
||||
SensorLastResetType legacy_last_reset_type = 11;
|
||||
bool disabled_by_default = 12;
|
||||
}
|
||||
message SensorStateResponse {
|
||||
|
||||
@@ -418,7 +418,6 @@ bool APIConnection::send_sensor_info(sensor::Sensor *sensor) {
|
||||
msg.force_update = sensor->get_force_update();
|
||||
msg.device_class = sensor->get_device_class();
|
||||
msg.state_class = static_cast<enums::SensorStateClass>(sensor->state_class);
|
||||
msg.last_reset_type = static_cast<enums::SensorLastResetType>(sensor->last_reset_type);
|
||||
msg.disabled_by_default = sensor->is_disabled_by_default();
|
||||
|
||||
return this->send_list_entities_sensor_response(msg);
|
||||
|
||||
@@ -1817,7 +1817,7 @@ bool ListEntitiesSensorResponse::decode_varint(uint32_t field_id, ProtoVarInt va
|
||||
return true;
|
||||
}
|
||||
case 11: {
|
||||
this->last_reset_type = value.as_enum<enums::SensorLastResetType>();
|
||||
this->legacy_last_reset_type = value.as_enum<enums::SensorLastResetType>();
|
||||
return true;
|
||||
}
|
||||
case 12: {
|
||||
@@ -1879,7 +1879,7 @@ void ListEntitiesSensorResponse::encode(ProtoWriteBuffer buffer) const {
|
||||
buffer.encode_bool(8, this->force_update);
|
||||
buffer.encode_string(9, this->device_class);
|
||||
buffer.encode_enum<enums::SensorStateClass>(10, this->state_class);
|
||||
buffer.encode_enum<enums::SensorLastResetType>(11, this->last_reset_type);
|
||||
buffer.encode_enum<enums::SensorLastResetType>(11, this->legacy_last_reset_type);
|
||||
buffer.encode_bool(12, this->disabled_by_default);
|
||||
}
|
||||
#ifdef HAS_PROTO_MESSAGE_DUMP
|
||||
@@ -1928,8 +1928,8 @@ void ListEntitiesSensorResponse::dump_to(std::string &out) const {
|
||||
out.append(proto_enum_to_string<enums::SensorStateClass>(this->state_class));
|
||||
out.append("\n");
|
||||
|
||||
out.append(" last_reset_type: ");
|
||||
out.append(proto_enum_to_string<enums::SensorLastResetType>(this->last_reset_type));
|
||||
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: ");
|
||||
|
||||
@@ -510,7 +510,7 @@ class ListEntitiesSensorResponse : public ProtoMessage {
|
||||
bool force_update{false};
|
||||
std::string device_class{};
|
||||
enums::SensorStateClass state_class{};
|
||||
enums::SensorLastResetType last_reset_type{};
|
||||
enums::SensorLastResetType legacy_last_reset_type{};
|
||||
bool disabled_by_default{false};
|
||||
void encode(ProtoWriteBuffer buffer) const override;
|
||||
#ifdef HAS_PROTO_MESSAGE_DUMP
|
||||
|
||||
Reference in New Issue
Block a user