mirror of
https://github.com/Threnklyn/esphome-dev.git
synced 2026-05-28 08:48:27 +02:00
Update PulseLightEffect with range brightness (#4820)
Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com>
This commit is contained in:
@@ -28,6 +28,8 @@ from esphome.const import (
|
||||
CONF_NUM_LEDS,
|
||||
CONF_RANDOM,
|
||||
CONF_SEQUENCE,
|
||||
CONF_MAX_BRIGHTNESS,
|
||||
CONF_MIN_BRIGHTNESS,
|
||||
)
|
||||
from esphome.util import Registry
|
||||
from .types import (
|
||||
@@ -174,12 +176,19 @@ async def automation_effect_to_code(config, effect_id):
|
||||
cv.Optional(
|
||||
CONF_UPDATE_INTERVAL, default="1s"
|
||||
): cv.positive_time_period_milliseconds,
|
||||
cv.Optional(CONF_MIN_BRIGHTNESS, default="0%"): cv.percentage,
|
||||
cv.Optional(CONF_MAX_BRIGHTNESS, default="100%"): cv.percentage,
|
||||
},
|
||||
)
|
||||
async 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]))
|
||||
cg.add(
|
||||
effect.set_min_max_brightness(
|
||||
config[CONF_MIN_BRIGHTNESS], config[CONF_MAX_BRIGHTNESS]
|
||||
)
|
||||
)
|
||||
return effect
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user