diff --git a/components/ratgdo/light/ratgdo_light_output.cpp b/components/ratgdo/light/ratgdo_light_output.cpp index 0c12172..f420c33 100644 --- a/components/ratgdo/light/ratgdo_light_output.cpp +++ b/components/ratgdo/light/ratgdo_light_output.cpp @@ -16,7 +16,15 @@ namespace ratgdo { void RATGDOLightOutput::on_motion_state(MotionState state) { } void RATGDOLightOutput::on_obstruction_state(ObstructionState state) { } void RATGDOLightOutput::on_door_state(DoorState state) { } - void RATGDOLightOutput::on_light_state(LightState state) { } + void RATGDOLightOutput::on_light_state(LightState state) + { + ESP_LOGD(TAG, "name: %s on_light_state: %d", this->get_name(), state); + if (this->light_state_) { + auto call = this->light_state_->make_call(); + call.set_state(state == LightState::LIGHT_STATE_ON); + call.perform(); + } + } void RATGDOLightOutput::on_lock_state(LockState state) { } LightTraits RATGDOLightOutput::get_traits() diff --git a/components/ratgdo/light/ratgdo_light_output.h b/components/ratgdo/light/ratgdo_light_output.h index 40bdce2..5a039b7 100644 --- a/components/ratgdo/light/ratgdo_light_output.h +++ b/components/ratgdo/light/ratgdo_light_output.h @@ -14,8 +14,8 @@ namespace ratgdo { void dump_config() override; light::LightTraits get_traits() override; void write_state(light::LightState* state) override; - void setup_state(light::LightState* state) override { this->state_ = state; } - light::LightState* get_state() { return this->state_; } + void setup_state(light::LightState* state) override { this->light_state_ = state; } + light::LightState* get_state() { return this->light_state_; } void on_motion_state(MotionState state) override; void on_obstruction_state(ObstructionState state) override; @@ -25,7 +25,7 @@ namespace ratgdo { protected: bool _is_on; - light::LightState* state_; + light::LightState* light_state_; }; } // namespace ratgdo