diff --git a/esphome/components/http_request/update/http_request_update.cpp b/esphome/components/http_request/update/http_request_update.cpp index 0eb6eb6c2c..43aef0d57a 100644 --- a/esphome/components/http_request/update/http_request_update.cpp +++ b/esphome/components/http_request/update/http_request_update.cpp @@ -49,7 +49,7 @@ void HttpRequestUpdate::update_task(void *params) { auto container = this_update->request_parent_->get(this_update->source_url_); if (container == nullptr || container->status_code != HTTP_STATUS_OK) { - ESP_LOGE(TAG, "Failed to fetch manifest from %s", this_update->source_url_.c_str()); + std::string msg = str_sprintf("Failed to fetch manifest from %s", this_update->source_url_.c_str()); // Defer to main loop to avoid race condition on component_state_ read-modify-write this_update->defer([this_update, msg]() { this_update->status_set_error(msg); }); UPDATE_RETURN; @@ -58,7 +58,7 @@ void HttpRequestUpdate::update_task(void *params) { RAMAllocator allocator; uint8_t *data = allocator.allocate(container->content_length); if (data == nullptr) { - ESP_LOGE(TAG, "Failed to allocate %zu bytes for manifest", container->content_length); + std::string msg = str_sprintf("Failed to allocate %zu bytes for manifest", container->content_length); // Defer to main loop to avoid race condition on component_state_ read-modify-write this_update->defer([this_update, msg]() { this_update->status_set_error(msg); }); container->end(); @@ -121,7 +121,7 @@ void HttpRequestUpdate::update_task(void *params) { } if (!valid) { - ESP_LOGE(TAG, "Failed to parse JSON from %s", this_update->source_url_.c_str()); + std::string msg = str_sprintf("Failed to parse JSON from %s", this_update->source_url_.c_str()); // Defer to main loop to avoid race condition on component_state_ read-modify-write this_update->defer([this_update, msg]() { this_update->status_set_error(msg); }); UPDATE_RETURN;