cleanups
This commit is contained in:
parent
ad7a45288c
commit
4652dded4e
|
@ -22,6 +22,14 @@ namespace ratgdo {
|
|||
this->light_state_->publish_state();
|
||||
}
|
||||
}
|
||||
void RATGDOLightOutput::setup_state(light::LightState* state)
|
||||
{
|
||||
bool is_on = this->parent_->isLightOn();
|
||||
this->light_state_ = state;
|
||||
state->current_values.set_state(is_on);
|
||||
state->remote_values.set_state(is_on);
|
||||
state->publish_state();
|
||||
}
|
||||
LightTraits RATGDOLightOutput::get_traits()
|
||||
{
|
||||
auto traits = LightTraits();
|
||||
|
|
|
@ -14,7 +14,7 @@ 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->light_state_ = state; }
|
||||
void setup_state(light::LightState* state) override;
|
||||
light::LightState* get_state() { return this->light_state_; }
|
||||
|
||||
void on_light_state(esphome::ratgdo::LightState state) override;
|
||||
|
|
|
@ -583,6 +583,11 @@ namespace ratgdo {
|
|||
sendCommandAndSaveCounter(Commands::DOOR2);
|
||||
}
|
||||
|
||||
bool RATGDOComonent::isLightOn()
|
||||
{
|
||||
return this->lightState == LightState::LIGHT_STATE_ON;
|
||||
}
|
||||
|
||||
void RATGDOComponent::lightOn()
|
||||
{
|
||||
if (this->lightState == LightState::LIGHT_STATE_ON) {
|
||||
|
|
|
@ -115,6 +115,7 @@ namespace ratgdo {
|
|||
void toggleLight();
|
||||
void lightOn();
|
||||
void lightOff();
|
||||
bool isLightOn();
|
||||
void sendLightStatus();
|
||||
|
||||
void toggleLock();
|
||||
|
|
Loading…
Reference in New Issue