diff --git a/esphome/components/api/api_connection.cpp b/esphome/components/api/api_connection.cpp index ef791d462c..8f814f9f42 100644 --- a/esphome/components/api/api_connection.cpp +++ b/esphome/components/api/api_connection.cpp @@ -158,7 +158,7 @@ void APIConnection::loop() { if (!this->list_entities_iterator_.completed()) this->list_entities_iterator_.advance(); - if (!this->initial_state_iterator_.completed() && this->list_entities_iterator_.completed()) + else if (!this->initial_state_iterator_.completed()) this->initial_state_iterator_.advance(); static uint8_t max_ping_retries = 60; diff --git a/esphome/components/api/api_server.cpp b/esphome/components/api/api_server.cpp index ae732fc234..8f7add646c 100644 --- a/esphome/components/api/api_server.cpp +++ b/esphome/components/api/api_server.cpp @@ -136,7 +136,7 @@ void APIServer::schedule_reboot_timeout_() { void APIServer::loop() { // Accept new clients only if the socket exists and has incoming connections - if (this->socket_ && this->socket_->ready()) { + if (this->socket_->ready()) { while (true) { struct sockaddr_storage source_addr; socklen_t addr_len = sizeof(source_addr);