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

Allow setting creator project name and version into code (#1872)

This commit is contained in:
Jesse Hills
2021-06-09 13:04:00 +12:00
committed by GitHub
parent b80f3fdec9
commit 5cf18235e3
9 changed files with 113 additions and 51 deletions

View File

@@ -360,6 +360,14 @@ bool DeviceInfoResponse::decode_length(uint32_t field_id, ProtoLengthDelimited v
this->model = value.as_string();
return true;
}
case 8: {
this->project_name = value.as_string();
return true;
}
case 9: {
this->project_version = value.as_string();
return true;
}
default:
return false;
}
@@ -372,6 +380,8 @@ void DeviceInfoResponse::encode(ProtoWriteBuffer buffer) const {
buffer.encode_string(5, this->compilation_time);
buffer.encode_string(6, this->model);
buffer.encode_bool(7, this->has_deep_sleep);
buffer.encode_string(8, this->project_name);
buffer.encode_string(9, this->project_version);
}
void DeviceInfoResponse::dump_to(std::string &out) const {
char buffer[64];
@@ -403,6 +413,14 @@ void DeviceInfoResponse::dump_to(std::string &out) const {
out.append(" has_deep_sleep: ");
out.append(YESNO(this->has_deep_sleep));
out.append("\n");
out.append(" project_name: ");
out.append("'").append(this->project_name).append("'");
out.append("\n");
out.append(" project_version: ");
out.append("'").append(this->project_version).append("'");
out.append("\n");
out.append("}");
}
void ListEntitiesRequest::encode(ProtoWriteBuffer buffer) const {}