[light] Add transition_length to strobe effect. (#6595)

This commit is contained in:
Lucas Hartmann 2024-04-28 16:47:15 -03:00 committed by GitHub
parent 8334934e08
commit 5142d294f5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 6 additions and 1 deletions

View file

@ -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;
}

View file

@ -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))