mirror of
https://github.com/esphome/esphome.git
synced 2024-11-27 09:18:00 +01:00
Fix flicker light effect turning itself off (#594)
Fixes https://github.com/esphome/issues/issues/382
This commit is contained in:
parent
f3fc9e4142
commit
570843150d
1 changed files with 2 additions and 1 deletions
|
@ -129,7 +129,7 @@ class FlickerLightEffect : public LightEffect {
|
||||||
LightColorValues out;
|
LightColorValues out;
|
||||||
const float alpha = this->alpha_;
|
const float alpha = this->alpha_;
|
||||||
const float beta = 1.0f - alpha;
|
const float beta = 1.0f - alpha;
|
||||||
out.set_state(remote.get_state());
|
out.set_state(true);
|
||||||
out.set_brightness(remote.get_brightness() * beta + current.get_brightness() * alpha +
|
out.set_brightness(remote.get_brightness() * beta + current.get_brightness() * alpha +
|
||||||
(random_cubic_float() * this->intensity_));
|
(random_cubic_float() * this->intensity_));
|
||||||
out.set_red(remote.get_red() * beta + current.get_red() * alpha + (random_cubic_float() * this->intensity_));
|
out.set_red(remote.get_red() * beta + current.get_red() * alpha + (random_cubic_float() * this->intensity_));
|
||||||
|
@ -144,6 +144,7 @@ class FlickerLightEffect : public LightEffect {
|
||||||
if (traits.get_supports_brightness())
|
if (traits.get_supports_brightness())
|
||||||
call.set_transition_length(0);
|
call.set_transition_length(0);
|
||||||
call.from_light_color_values(out);
|
call.from_light_color_values(out);
|
||||||
|
call.set_state(true);
|
||||||
call.perform();
|
call.perform();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue