diff --git a/esphome/components/api/api_connection.cpp b/esphome/components/api/api_connection.cpp index d9ce6cd79e..b998ef5929 100644 --- a/esphome/components/api/api_connection.cpp +++ b/esphome/components/api/api_connection.cpp @@ -105,6 +105,7 @@ void APIConnection::loop() { ESP_LOGW(TAG, "%s didn't respond to ping request in time. Disconnecting...", this->client_info_.c_str()); } } else if (now - this->last_traffic_ > keepalive) { + ESP_LOGVV(TAG, "Sending keepalive PING..."); this->sent_ping_ = true; this->send_ping_request(PingRequest()); } @@ -908,7 +909,7 @@ bool APIConnection::send_buffer(ProtoWriteBuffer buffer, uint32_t message_type) } return false; } - this->last_traffic_ = millis(); + // Do not set last_traffic_ on send return true; } void APIConnection::on_unauthenticated_access() {