mirror of
https://github.com/Threnklyn/esphome-dev.git
synced 2026-05-27 00:17:22 +02:00
Add monochromatic effects: Pulse, Random (#1616)
This commit is contained in:
@@ -26,6 +26,7 @@ from esphome.const import (
|
||||
from esphome.util import Registry
|
||||
from .types import (
|
||||
LambdaLightEffect,
|
||||
PulseLightEffect,
|
||||
RandomLightEffect,
|
||||
StrobeLightEffect,
|
||||
StrobeLightEffectColor,
|
||||
@@ -152,7 +153,27 @@ def automation_effect_to_code(config, effect_id):
|
||||
yield var
|
||||
|
||||
|
||||
@register_rgb_effect(
|
||||
@register_monochromatic_effect(
|
||||
"pulse",
|
||||
PulseLightEffect,
|
||||
"Pulse",
|
||||
{
|
||||
cv.Optional(
|
||||
CONF_TRANSITION_LENGTH, default="1s"
|
||||
): cv.positive_time_period_milliseconds,
|
||||
cv.Optional(
|
||||
CONF_UPDATE_INTERVAL, default="1s"
|
||||
): cv.positive_time_period_milliseconds,
|
||||
},
|
||||
)
|
||||
def pulse_effect_to_code(config, effect_id):
|
||||
effect = cg.new_Pvariable(effect_id, config[CONF_NAME])
|
||||
cg.add(effect.set_transition_length(config[CONF_TRANSITION_LENGTH]))
|
||||
cg.add(effect.set_update_interval(config[CONF_UPDATE_INTERVAL]))
|
||||
yield effect
|
||||
|
||||
|
||||
@register_monochromatic_effect(
|
||||
"random",
|
||||
RandomLightEffect,
|
||||
"Random",
|
||||
|
||||
Reference in New Issue
Block a user