From 4e0e7796ded16e118bb95ff63fc956850d9b3e7f Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Mon, 19 Jan 2026 17:37:19 -1000 Subject: [PATCH] [mqtt] Remove unnecessary defer in ESP8266 on_message callback (#13373) --- esphome/components/mqtt/mqtt_client.cpp | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/esphome/components/mqtt/mqtt_client.cpp b/esphome/components/mqtt/mqtt_client.cpp index 7d4050284f..f8517c4f89 100644 --- a/esphome/components/mqtt/mqtt_client.cpp +++ b/esphome/components/mqtt/mqtt_client.cpp @@ -610,18 +610,10 @@ static bool topic_match(const char *message, const char *subscription) { } void MQTTClientComponent::on_message(const std::string &topic, const std::string &payload) { -#ifdef USE_ESP8266 - // on ESP8266, this is called in lwIP/AsyncTCP task; some components do not like running - // from a different task. - this->defer([this, topic, payload]() { -#endif - for (auto &subscription : this->subscriptions_) { - if (topic_match(topic.c_str(), subscription.topic.c_str())) - subscription.callback(topic, payload); - } -#ifdef USE_ESP8266 - }); -#endif + for (auto &subscription : this->subscriptions_) { + if (topic_match(topic.c_str(), subscription.topic.c_str())) + subscription.callback(topic, payload); + } } // Setters