[light] Fix schedule_show not enabling loop for idle addressable lights (#12302)

This commit is contained in:
J. Nick Koston
2025-12-05 11:47:54 -06:00
committed by GitHub
parent 1a308583b3
commit 7f7c913a85
3 changed files with 8 additions and 3 deletions

View File

@@ -70,7 +70,7 @@ class AddressableLight : public LightOutput, public Component {
this->state_parent_ = state;
}
void update_state(LightState *state) override;
void schedule_show() { this->state_parent_->next_write_ = true; }
void schedule_show() { this->state_parent_->schedule_write_(); }
#ifdef USE_POWER_SUPPLY
void set_power_supply(power_supply::PowerSupply *power_supply) { this->power_.set_parent(power_supply); }

View File

@@ -305,8 +305,7 @@ void LightState::set_immediately_(const LightColorValues &target, bool set_remot
this->remote_values = target;
}
this->output_->update_state(this);
this->next_write_ = true;
this->enable_loop();
this->schedule_write_();
}
void LightState::disable_loop_if_idle_() {

View File

@@ -277,6 +277,12 @@ class LightState : public EntityBase, public Component {
/// Disable loop if neither transformer nor effect is active
void disable_loop_if_idle_();
/// Schedule a write to the light output and enable the loop to process it
void schedule_write_() {
this->next_write_ = true;
this->enable_loop();
}
/// Store the output to allow effects to have more access.
LightOutput *output_;
/// The currently active transformer for this light (transition/flash).