This commit is contained in:
J. Nick Koston 2023-06-07 20:46:44 -05:00
parent ad7a45288c
commit 4652dded4e
No known key found for this signature in database
4 changed files with 15 additions and 1 deletions

View File

@ -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();

View File

@ -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;

View File

@ -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) {

View File

@ -115,6 +115,7 @@ namespace ratgdo {
void toggleLight();
void lightOn();
void lightOff();
bool isLightOn();
void sendLightStatus();
void toggleLock();