loop
This commit is contained in:
parent
32f76632c7
commit
bd6c3504fe
|
@ -17,6 +17,7 @@ namespace ratgdo {
|
||||||
{
|
{
|
||||||
ESP_LOGD(TAG, "on_light_state: %d", state);
|
ESP_LOGD(TAG, "on_light_state: %d", state);
|
||||||
if (this->light_state_) {
|
if (this->light_state_) {
|
||||||
|
this->has_initial_state_ = true;
|
||||||
set_state(state);
|
set_state(state);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -44,6 +45,8 @@ namespace ratgdo {
|
||||||
|
|
||||||
void RATGDOLightOutput::write_state(light::LightState* state)
|
void RATGDOLightOutput::write_state(light::LightState* state)
|
||||||
{
|
{
|
||||||
|
if (!this->has_initial_state_)
|
||||||
|
return;
|
||||||
bool binary;
|
bool binary;
|
||||||
state->current_values_as_binary(&binary);
|
state->current_values_as_binary(&binary);
|
||||||
if (binary) {
|
if (binary) {
|
||||||
|
|
|
@ -22,6 +22,7 @@ namespace ratgdo {
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
light::LightState* light_state_;
|
light::LightState* light_state_;
|
||||||
|
bool has_initial_state_ = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace ratgdo
|
} // namespace ratgdo
|
||||||
|
|
Loading…
Reference in New Issue