1
0
mirror of https://github.com/esphome/esphome.git synced 2025-10-28 05:33:53 +00:00

Allow transforms and flashes to not update remote_values (#2313)

This commit is contained in:
Matthew Mazzanti
2021-09-15 13:59:58 -04:00
committed by GitHub
parent aed140d802
commit 8f3a739da7
3 changed files with 14 additions and 8 deletions

View File

@@ -228,13 +228,16 @@ void LightState::stop_effect_() {
this->active_effect_index_ = 0;
}
void LightState::start_transition_(const LightColorValues &target, uint32_t length) {
void LightState::start_transition_(const LightColorValues &target, uint32_t length, bool set_remote_values) {
this->transformer_ = this->output_->create_default_transition();
this->transformer_->setup(this->current_values, target, length);
this->remote_values = target;
if (set_remote_values) {
this->remote_values = target;
}
}
void LightState::start_flash_(const LightColorValues &target, uint32_t length) {
void LightState::start_flash_(const LightColorValues &target, uint32_t length, bool set_remote_values) {
LightColorValues end_colors = this->remote_values;
// If starting a flash if one is already happening, set end values to end values of current flash
// Hacky but works
@@ -243,7 +246,10 @@ void LightState::start_flash_(const LightColorValues &target, uint32_t length) {
this->transformer_ = make_unique<LightFlashTransformer>(*this);
this->transformer_->setup(end_colors, target, length);
this->remote_values = target;
if (set_remote_values) {
this->remote_values = target;
};
}
void LightState::set_immediately_(const LightColorValues &target, bool set_remote_values) {