mirror of
https://github.com/esphome/esphome.git
synced 2024-11-10 09:17:46 +01:00
Send manufacturer name via API (#3938)
This commit is contained in:
parent
702b60ce66
commit
d93f35701f
4 changed files with 17 additions and 0 deletions
|
@ -204,6 +204,8 @@ message DeviceInfoResponse {
|
||||||
uint32 webserver_port = 10;
|
uint32 webserver_port = 10;
|
||||||
|
|
||||||
uint32 bluetooth_proxy_version = 11;
|
uint32 bluetooth_proxy_version = 11;
|
||||||
|
|
||||||
|
string manufacturer = 12;
|
||||||
}
|
}
|
||||||
|
|
||||||
message ListEntitiesRequest {
|
message ListEntitiesRequest {
|
||||||
|
|
|
@ -932,6 +932,11 @@ DeviceInfoResponse APIConnection::device_info(const DeviceInfoRequest &msg) {
|
||||||
resp.mac_address = get_mac_address_pretty();
|
resp.mac_address = get_mac_address_pretty();
|
||||||
resp.esphome_version = ESPHOME_VERSION;
|
resp.esphome_version = ESPHOME_VERSION;
|
||||||
resp.compilation_time = App.get_compilation_time();
|
resp.compilation_time = App.get_compilation_time();
|
||||||
|
#if defined(USE_ESP8266) || defined(USE_ESP32)
|
||||||
|
resp.manufacturer = "Espressif";
|
||||||
|
#elif defined(USE_RP2040)
|
||||||
|
resp.manufacturer = "Raspberry Pi";
|
||||||
|
#endif
|
||||||
resp.model = ESPHOME_BOARD;
|
resp.model = ESPHOME_BOARD;
|
||||||
#ifdef USE_DEEP_SLEEP
|
#ifdef USE_DEEP_SLEEP
|
||||||
resp.has_deep_sleep = deep_sleep::global_has_deep_sleep;
|
resp.has_deep_sleep = deep_sleep::global_has_deep_sleep;
|
||||||
|
|
|
@ -576,6 +576,10 @@ bool DeviceInfoResponse::decode_length(uint32_t field_id, ProtoLengthDelimited v
|
||||||
this->project_version = value.as_string();
|
this->project_version = value.as_string();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
case 12: {
|
||||||
|
this->manufacturer = value.as_string();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -592,6 +596,7 @@ void DeviceInfoResponse::encode(ProtoWriteBuffer buffer) const {
|
||||||
buffer.encode_string(9, this->project_version);
|
buffer.encode_string(9, this->project_version);
|
||||||
buffer.encode_uint32(10, this->webserver_port);
|
buffer.encode_uint32(10, this->webserver_port);
|
||||||
buffer.encode_uint32(11, this->bluetooth_proxy_version);
|
buffer.encode_uint32(11, this->bluetooth_proxy_version);
|
||||||
|
buffer.encode_string(12, this->manufacturer);
|
||||||
}
|
}
|
||||||
#ifdef HAS_PROTO_MESSAGE_DUMP
|
#ifdef HAS_PROTO_MESSAGE_DUMP
|
||||||
void DeviceInfoResponse::dump_to(std::string &out) const {
|
void DeviceInfoResponse::dump_to(std::string &out) const {
|
||||||
|
@ -642,6 +647,10 @@ void DeviceInfoResponse::dump_to(std::string &out) const {
|
||||||
sprintf(buffer, "%u", this->bluetooth_proxy_version);
|
sprintf(buffer, "%u", this->bluetooth_proxy_version);
|
||||||
out.append(buffer);
|
out.append(buffer);
|
||||||
out.append("\n");
|
out.append("\n");
|
||||||
|
|
||||||
|
out.append(" manufacturer: ");
|
||||||
|
out.append("'").append(this->manufacturer).append("'");
|
||||||
|
out.append("\n");
|
||||||
out.append("}");
|
out.append("}");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -273,6 +273,7 @@ class DeviceInfoResponse : public ProtoMessage {
|
||||||
std::string project_version{};
|
std::string project_version{};
|
||||||
uint32_t webserver_port{0};
|
uint32_t webserver_port{0};
|
||||||
uint32_t bluetooth_proxy_version{0};
|
uint32_t bluetooth_proxy_version{0};
|
||||||
|
std::string manufacturer{};
|
||||||
void encode(ProtoWriteBuffer buffer) const override;
|
void encode(ProtoWriteBuffer buffer) const override;
|
||||||
#ifdef HAS_PROTO_MESSAGE_DUMP
|
#ifdef HAS_PROTO_MESSAGE_DUMP
|
||||||
void dump_to(std::string &out) const override;
|
void dump_to(std::string &out) const override;
|
||||||
|
|
Loading…
Reference in a new issue