From 5a765915955958ca304b2885324bc83979640a6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=96mer=20Faruk=20ARAN?= Date: Fri, 1 Nov 2024 03:20:53 +0300 Subject: [PATCH] Added dynamic delay mechanism for Non-NASA protocol registration --- components/samsung_ac/protocol_non_nasa.cpp | 4 ++++ components/samsung_ac/protocol_non_nasa.h | 3 +++ 2 files changed, 7 insertions(+) diff --git a/components/samsung_ac/protocol_non_nasa.cpp b/components/samsung_ac/protocol_non_nasa.cpp index 3d9740ef..42e2389a 100644 --- a/components/samsung_ac/protocol_non_nasa.cpp +++ b/components/samsung_ac/protocol_non_nasa.cpp @@ -693,6 +693,10 @@ namespace esphome { // Get the current time const uint32_t now = millis(); + if (start_millis == 0) + { + start_millis = millis(); + } // Dynamic delay on startup static uint32_t dynamic_delay_interval = 10000; // Initial delay: 10 seconds diff --git a/components/samsung_ac/protocol_non_nasa.h b/components/samsung_ac/protocol_non_nasa.h index aeeba595..39b482d2 100644 --- a/components/samsung_ac/protocol_non_nasa.h +++ b/components/samsung_ac/protocol_non_nasa.h @@ -214,6 +214,9 @@ namespace esphome void publish_request(MessageTarget *target, const std::string &address, ProtocolRequest &request) override; void protocol_update(MessageTarget *target) override; + + private: + uint32_t start_millis; }; } // namespace samsung_ac } // namespace esphome