diff --git a/esphome/components/api/api_pb2_service.h b/esphome/components/api/api_pb2_service.h index dd6b335d7d..42abe45ad2 100644 --- a/esphome/components/api/api_pb2_service.h +++ b/esphome/components/api/api_pb2_service.h @@ -14,7 +14,7 @@ class APIServerConnectionBase : public ProtoService { #ifdef HAS_PROTO_MESSAGE_DUMP ESP_LOGVV(TAG, "send_message %s: %s", T::message_name(), msg.dump().c_str()); #endif - return this->send_message_(msg, msg.get_message_type()); + return this->send_message_(msg, T::message_type); } virtual void on_hello_request(const HelloRequest &value){}; diff --git a/script/api_protobuf/api_protobuf.py b/script/api_protobuf/api_protobuf.py index 38547a583e..c8eb2e5b4e 100755 --- a/script/api_protobuf/api_protobuf.py +++ b/script/api_protobuf/api_protobuf.py @@ -1096,7 +1096,7 @@ def main() -> None: hpp += "#ifdef HAS_PROTO_MESSAGE_DUMP\n" hpp += ' ESP_LOGVV(TAG, "send_message %s: %s", T::message_name(), msg.dump().c_str());\n' hpp += "#endif\n" - hpp += " return this->send_message_(msg, msg.get_message_type());\n" + hpp += " return this->send_message_(msg, T::message_type);\n" hpp += " }\n\n" for mt in file.message_type: