diff --git a/esphome/components/light/effects.py b/esphome/components/light/effects.py index 93dea2628d..72a2155a1b 100644 --- a/esphome/components/light/effects.py +++ b/esphome/components/light/effects.py @@ -4,7 +4,7 @@ from esphome import automation from esphome.const import CONF_NAME, CONF_LAMBDA, CONF_UPDATE_INTERVAL, CONF_TRANSITION_LENGTH, \ CONF_COLORS, CONF_STATE, CONF_DURATION, CONF_BRIGHTNESS, CONF_RED, CONF_GREEN, CONF_BLUE, \ CONF_WHITE, CONF_ALPHA, CONF_INTENSITY, CONF_SPEED, CONF_WIDTH, CONF_NUM_LEDS, CONF_RANDOM, \ - CONF_THEN + CONF_THEN, CONF_SEQUENCE from esphome.util import Registry from .types import LambdaLightEffect, RandomLightEffect, StrobeLightEffect, \ StrobeLightEffectColor, LightColorValues, AddressableLightRef, AddressableLambdaLightEffect, \ @@ -63,11 +63,11 @@ def lambda_effect_to_code(config, effect_id): @register_effect('automation', AutomationLightEffect, "Automation", { - cv.Required(CONF_THEN): automation.validate_automation(single=True), + cv.Required(CONF_SEQUENCE): automation.validate_automation(single=True), }) def automation_effect_to_code(config, effect_id): var = yield cg.new_Pvariable(effect_id, config[CONF_NAME]) - yield automation.build_automation(var.get_trig(), [], config[CONF_THEN]) + yield automation.build_automation(var.get_trig(), [], config[CONF_SEQUENCE]) yield var diff --git a/esphome/const.py b/esphome/const.py index d3da18448e..d285105df4 100644 --- a/esphome/const.py +++ b/esphome/const.py @@ -366,6 +366,7 @@ CONF_SERVICE = 'service' CONF_SERVICES = 'services' CONF_SETUP_MODE = 'setup_mode' CONF_SETUP_PRIORITY = 'setup_priority' +CONF_SEQUENCE = 'sequence' CONF_SHUNT_RESISTANCE = 'shunt_resistance' CONF_SHUNT_VOLTAGE = 'shunt_voltage' CONF_SHUTDOWN_MESSAGE = 'shutdown_message' diff --git a/tests/test1.yaml b/tests/test1.yaml index b9177802fa..bb692d431e 100644 --- a/tests/test1.yaml +++ b/tests/test1.yaml @@ -17,7 +17,7 @@ esphome: ESP_LOGV("main", "ON LOOP!"); - light.addressable_set: id: addr1 - range_from: 1 + range_from: 0 range_to: 100 red: 100% green: !lambda 'return 255;' @@ -839,6 +839,20 @@ light: name: Flicker Effect With Custom Values update_interval: 16ms intensity: 5% + - automation: + name: Custom Effect + sequence: + - light.addressable_set: + id: addr1 + red: 100% + green: 100% + blue: 0% + - delay: 100ms + - light.addressable_set: + id: addr1 + red: 0% + green: 100% + blue: 0% - platform: fastled_spi id: addr2 chipset: WS2801