loop
This commit is contained in:
parent
0c3a3d0a4c
commit
8e5b65c2e6
|
@ -17,18 +17,19 @@ namespace ratgdo {
|
|||
{
|
||||
ESP_LOGD(TAG, "on_light_state: %d", state);
|
||||
if (this->light_state_) {
|
||||
this->light_state_->current_values.set_state(state == LightState::LIGHT_STATE_ON);
|
||||
this->light_state_->remote_values.set_state(state == LightState::LIGHT_STATE_ON);
|
||||
this->light_state_->publish_state();
|
||||
set_state(this->light_state_, state);
|
||||
}
|
||||
}
|
||||
void RATGDOLightOutput::set_state(light::LightState* light_state, esphome::ratgdo::LightState state)
|
||||
{
|
||||
light_state->current_values.set_state(is_on);
|
||||
light_state->remote_values.set_state(is_on);
|
||||
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();
|
||||
this->set_state(state, this->parent_->getLightState());
|
||||
}
|
||||
LightTraits RATGDOLightOutput::get_traits()
|
||||
{
|
||||
|
|
|
@ -497,6 +497,10 @@ namespace ratgdo {
|
|||
this->children_.push_back(obj);
|
||||
obj->set_parent(this);
|
||||
}
|
||||
LightState RATGDOComponent::get_light_state()
|
||||
{
|
||||
return static_cast<LightState>(this->lightState);
|
||||
}
|
||||
|
||||
} // namespace ratgdo
|
||||
} // namespace esphome
|
||||
|
|
|
@ -142,6 +142,7 @@ namespace ratgdo {
|
|||
void sendRollingCodeChanged();
|
||||
void setRollingCodeCounter(uint32_t counter);
|
||||
void sendCommandAndSaveCounter(cmd command);
|
||||
LightState RATGDOComponent::get_light_state();
|
||||
/** Register a child component. */
|
||||
void register_child(RATGDOClient* obj);
|
||||
|
||||
|
|
Loading…
Reference in New Issue