From b62de22175ff320844cc419ae270e465601316cc Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Fri, 6 Jun 2025 13:23:11 +0100 Subject: [PATCH] batch ListEntitiesDone --- esphome/components/api/api_connection.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/esphome/components/api/api_connection.h b/esphome/components/api/api_connection.h index 447983a888..c39c8fa7e2 100644 --- a/esphome/components/api/api_connection.h +++ b/esphome/components/api/api_connection.h @@ -29,8 +29,8 @@ class APIConnection : public APIServerConnection { void loop(); bool send_list_info_done() { - ListEntitiesDoneResponse resp; - return this->send_message(resp); + return this->schedule_message_(nullptr, &APIConnection::try_send_list_info_done, + ListEntitiesDoneResponse::MESSAGE_TYPE); } #ifdef USE_BINARY_SENSOR bool send_binary_sensor_state(binary_sensor::BinarySensor *binary_sensor, bool state); @@ -439,6 +439,10 @@ class APIConnection : public APIServerConnection { bool is_single); #endif + // Method for ListEntitiesDone batching + static EncodedMessage try_send_list_info_done(EntityBase *entity, APIConnection *conn, uint32_t remaining_size, + bool is_single); + enum class ConnectionState { WAITING_FOR_HELLO, CONNECTED,