diff --git a/components/ratgdo/light/ratgdo_light_output.cpp b/components/ratgdo/light/ratgdo_light_output.cpp index f80b7ca..fea828e 100644 --- a/components/ratgdo/light/ratgdo_light_output.cpp +++ b/components/ratgdo/light/ratgdo_light_output.cpp @@ -16,10 +16,9 @@ namespace ratgdo { void RATGDOLightOutput::on_light_state(esphome::ratgdo::LightState state) { ESP_LOGD(TAG, "on_light_state: %d", state); - this->_is_on = state == LightState::LIGHT_STATE_ON; if (this->light_state_) { auto call = this->light_state_->make_call(); - call.set_state(this->_is_on); + call.set_state(state == LightState::LIGHT_STATE_ON); call.perform(); } } @@ -34,14 +33,15 @@ namespace ratgdo { { bool binary; state->current_values_as_binary(&binary); - if (binary == this->_is_on) + if (binary == state == LightState::LIGHT_STATE_ON) return; if (binary) { + ESP_LOGD(TAG, "output call lightOn"); this->parent_->lightOn(); } else { + ESP_LOGD(TAG, "output call lightOff"); this->parent_->lightOff(); } - this->_is_on = binary; } } // namespace ratgdo diff --git a/components/ratgdo/light/ratgdo_light_output.h b/components/ratgdo/light/ratgdo_light_output.h index dce816f..06c74b0 100644 --- a/components/ratgdo/light/ratgdo_light_output.h +++ b/components/ratgdo/light/ratgdo_light_output.h @@ -17,10 +17,9 @@ namespace ratgdo { void setup_state(light::LightState* state) override { this->light_state_ = state; } light::LightState* get_state() { return this->light_state_; } - void on_light_state(LightState state) override; + void on_light_state(esphome::ratgdo::LightState state) override; protected: - bool _is_on; light::LightState* light_state_; };