diff --git a/esphome/components/api/api_connection.cpp b/esphome/components/api/api_connection.cpp index 5eb9d64dad..5128998716 100644 --- a/esphome/components/api/api_connection.cpp +++ b/esphome/components/api/api_connection.cpp @@ -1838,10 +1838,9 @@ void APIConnection::process_batch_() { // Handle remaining items more efficiently if (items_processed < this->deferred_batch_.items.size()) { - // Move unprocessed items to the beginning using std::move - std::move(this->deferred_batch_.items.begin() + items_processed, this->deferred_batch_.items.end(), - this->deferred_batch_.items.begin()); - this->deferred_batch_.items.resize(this->deferred_batch_.items.size() - items_processed); + // Remove processed items from the beginning + this->deferred_batch_.items.erase(this->deferred_batch_.items.begin(), + this->deferred_batch_.items.begin() + items_processed); // Reschedule for remaining items this->schedule_batch_(); diff --git a/esphome/components/api/api_connection.h b/esphome/components/api/api_connection.h index a6da2fbeeb..447983a888 100644 --- a/esphome/components/api/api_connection.h +++ b/esphome/components/api/api_connection.h @@ -487,9 +487,6 @@ class APIConnection : public APIServerConnection { uint32_t timestamp; // When this update was queued uint16_t message_type; // Message type for overhead calculation - // Default constructor - BatchItem() : entity(nullptr), timestamp(0), message_type(0) {} - // Constructor for creating BatchItem BatchItem(EntityBase *entity, std::function creator,