fix light state
This commit is contained in:
parent
d5b7fd25fd
commit
4363a25119
|
@ -16,7 +16,15 @@ namespace ratgdo {
|
||||||
void RATGDOLightOutput::on_motion_state(MotionState state) { }
|
void RATGDOLightOutput::on_motion_state(MotionState state) { }
|
||||||
void RATGDOLightOutput::on_obstruction_state(ObstructionState state) { }
|
void RATGDOLightOutput::on_obstruction_state(ObstructionState state) { }
|
||||||
void RATGDOLightOutput::on_door_state(DoorState 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) { }
|
void RATGDOLightOutput::on_lock_state(LockState state) { }
|
||||||
|
|
||||||
LightTraits RATGDOLightOutput::get_traits()
|
LightTraits RATGDOLightOutput::get_traits()
|
||||||
|
|
|
@ -14,8 +14,8 @@ namespace ratgdo {
|
||||||
void dump_config() override;
|
void dump_config() override;
|
||||||
light::LightTraits get_traits() override;
|
light::LightTraits get_traits() override;
|
||||||
void write_state(light::LightState* state) override;
|
void write_state(light::LightState* state) override;
|
||||||
void setup_state(light::LightState* state) override { this->state_ = state; }
|
void setup_state(light::LightState* state) override { this->light_state_ = state; }
|
||||||
light::LightState* get_state() { return this->state_; }
|
light::LightState* get_state() { return this->light_state_; }
|
||||||
|
|
||||||
void on_motion_state(MotionState state) override;
|
void on_motion_state(MotionState state) override;
|
||||||
void on_obstruction_state(ObstructionState state) override;
|
void on_obstruction_state(ObstructionState state) override;
|
||||||
|
@ -25,7 +25,7 @@ namespace ratgdo {
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool _is_on;
|
bool _is_on;
|
||||||
light::LightState* state_;
|
light::LightState* light_state_;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace ratgdo
|
} // namespace ratgdo
|
||||||
|
|
Loading…
Reference in New Issue