From 114476d8b15f173aac926ec653c69fccc2dccdc7 Mon Sep 17 00:00:00 2001 From: Z3LIFF Date: Thu, 11 Jul 2024 00:01:14 -0400 Subject: [PATCH] Fix pmsa003i cold boot marked as failed on ESP32 et al (#7064) --- esphome/components/pmsa003i/pmsa003i.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/esphome/components/pmsa003i/pmsa003i.cpp b/esphome/components/pmsa003i/pmsa003i.cpp index ca3d28367a..a9665c6a5a 100644 --- a/esphome/components/pmsa003i/pmsa003i.cpp +++ b/esphome/components/pmsa003i/pmsa003i.cpp @@ -13,6 +13,15 @@ void PMSA003IComponent::setup() { PM25AQIData data; bool successful_read = this->read_data_(&data); + if (!successful_read) { + for (int i = 0; i < 3; i++) { + successful_read = this->read_data_(&data); + if (successful_read) { + break; + } + } + } + if (!successful_read) { this->mark_failed(); return;