mirror of
https://github.com/esphome/esphome.git
synced 2024-12-22 13:34:54 +01:00
[light] Add transition_length to strobe effect. (#6595)
This commit is contained in:
parent
8334934e08
commit
5142d294f5
2 changed files with 6 additions and 1 deletions
|
@ -150,6 +150,7 @@ class AutomationLightEffect : public LightEffect {
|
|||
struct StrobeLightEffectColor {
|
||||
LightColorValues color;
|
||||
uint32_t duration;
|
||||
uint32_t transition_length;
|
||||
};
|
||||
|
||||
class StrobeLightEffect : public LightEffect {
|
||||
|
@ -174,7 +175,7 @@ class StrobeLightEffect : public LightEffect {
|
|||
}
|
||||
call.set_publish(false);
|
||||
call.set_save(false);
|
||||
call.set_transition_length_if_supported(0);
|
||||
call.set_transition_length_if_supported(this->colors_[this->at_color_].transition_length);
|
||||
call.perform();
|
||||
this->last_switch_ = now;
|
||||
}
|
||||
|
|
|
@ -266,6 +266,9 @@ async def random_effect_to_code(config, effect_id):
|
|||
cv.Required(
|
||||
CONF_DURATION
|
||||
): cv.positive_time_period_milliseconds,
|
||||
cv.Optional(
|
||||
CONF_TRANSITION_LENGTH, default="0s"
|
||||
): cv.positive_time_period_milliseconds,
|
||||
}
|
||||
),
|
||||
cv.has_at_least_one_key(
|
||||
|
@ -310,6 +313,7 @@ async def strobe_effect_to_code(config, effect_id):
|
|||
),
|
||||
),
|
||||
("duration", color[CONF_DURATION]),
|
||||
("transition_length", color[CONF_TRANSITION_LENGTH]),
|
||||
)
|
||||
)
|
||||
cg.add(var.set_colors(colors))
|
||||
|
|
Loading…
Reference in a new issue