1
0
mirror of https://github.com/esphome/esphome.git synced 2025-09-07 05:42:20 +01:00

Add number device class support (#4042)

This commit is contained in:
Franck Nijhof
2022-11-17 20:01:28 +01:00
committed by GitHub
parent eead72333e
commit d874626662
10 changed files with 112 additions and 0 deletions

View File

@@ -3942,6 +3942,10 @@ bool ListEntitiesNumberResponse::decode_length(uint32_t field_id, ProtoLengthDel
this->unit_of_measurement = value.as_string();
return true;
}
case 13: {
this->device_class = value.as_string();
return true;
}
default:
return false;
}
@@ -3981,6 +3985,7 @@ void ListEntitiesNumberResponse::encode(ProtoWriteBuffer buffer) const {
buffer.encode_enum<enums::EntityCategory>(10, this->entity_category);
buffer.encode_string(11, this->unit_of_measurement);
buffer.encode_enum<enums::NumberMode>(12, this->mode);
buffer.encode_string(13, this->device_class);
}
#ifdef HAS_PROTO_MESSAGE_DUMP
void ListEntitiesNumberResponse::dump_to(std::string &out) const {
@@ -4037,6 +4042,10 @@ void ListEntitiesNumberResponse::dump_to(std::string &out) const {
out.append(" mode: ");
out.append(proto_enum_to_string<enums::NumberMode>(this->mode));
out.append("\n");
out.append(" device_class: ");
out.append("'").append(this->device_class).append("'");
out.append("\n");
out.append("}");
}
#endif