From bd6c3504fe917b3cc841ea4971a4ed3ea8fc7c91 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Fri, 9 Jun 2023 16:51:34 -0500 Subject: [PATCH] loop --- components/ratgdo/light/ratgdo_light_output.cpp | 3 +++ components/ratgdo/light/ratgdo_light_output.h | 1 + 2 files changed, 4 insertions(+) diff --git a/components/ratgdo/light/ratgdo_light_output.cpp b/components/ratgdo/light/ratgdo_light_output.cpp index 4994d08..efcdab6 100644 --- a/components/ratgdo/light/ratgdo_light_output.cpp +++ b/components/ratgdo/light/ratgdo_light_output.cpp @@ -17,6 +17,7 @@ namespace ratgdo { { ESP_LOGD(TAG, "on_light_state: %d", state); if (this->light_state_) { + this->has_initial_state_ = true; set_state(state); } } @@ -44,6 +45,8 @@ namespace ratgdo { void RATGDOLightOutput::write_state(light::LightState* state) { + if (!this->has_initial_state_) + return; bool binary; state->current_values_as_binary(&binary); if (binary) { diff --git a/components/ratgdo/light/ratgdo_light_output.h b/components/ratgdo/light/ratgdo_light_output.h index 4dee47c..9404ac9 100644 --- a/components/ratgdo/light/ratgdo_light_output.h +++ b/components/ratgdo/light/ratgdo_light_output.h @@ -22,6 +22,7 @@ namespace ratgdo { protected: light::LightState* light_state_; + bool has_initial_state_ = false; }; } // namespace ratgdo