From dd801636afdf07d92f8cd9187ebb81073cb23852 Mon Sep 17 00:00:00 2001 From: Otto Winter Date: Wed, 2 Jan 2019 16:49:26 +0100 Subject: [PATCH] Fix Interval Trigger --- esphomeyaml/components/interval.py | 5 +++-- esphomeyaml/const.py | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/esphomeyaml/components/interval.py b/esphomeyaml/components/interval.py index 591ed6ff29..e41656ebb0 100644 --- a/esphomeyaml/components/interval.py +++ b/esphomeyaml/components/interval.py @@ -2,7 +2,7 @@ import voluptuous as vol from esphomeyaml import automation import esphomeyaml.config_validation as cv -from esphomeyaml.const import CONF_ID +from esphomeyaml.const import CONF_ID, CONF_INTERVAL from esphomeyaml.cpp_generator import Pvariable from esphomeyaml.cpp_helpers import setup_component from esphomeyaml.cpp_types import App, NoArg, PollingComponent, Trigger, esphomelib_ns @@ -11,12 +11,13 @@ IntervalTrigger = esphomelib_ns.class_('IntervalTrigger', Trigger.template(NoArg CONFIG_SCHEMA = automation.validate_automation(vol.Schema({ vol.Required(CONF_ID): cv.declare_variable_id(IntervalTrigger), + vol.Required(CONF_INTERVAL): cv.positive_time_period_milliseconds, }).extend(cv.COMPONENT_SCHEMA.schema)) def to_code(config): for conf in config: - rhs = App.register_component(IntervalTrigger.new()) + rhs = App.register_component(IntervalTrigger.new(config[CONF_INTERVAL])) trigger = Pvariable(conf[CONF_ID], rhs) setup_component(trigger, conf) diff --git a/esphomeyaml/const.py b/esphomeyaml/const.py index 76831a36f9..a0f7361522 100644 --- a/esphomeyaml/const.py +++ b/esphomeyaml/const.py @@ -394,6 +394,7 @@ CONF_VARIABLES = 'variables' CONF_SERVICE = 'service' CONF_ENTITY_ID = 'entity_id' CONF_RESTORE_MODE = 'restore_mode' +CONF_INTERVAL = 'interval' ALLOWED_NAME_CHARS = u'abcdefghijklmnopqrstuvwxyz0123456789_' ARDUINO_VERSION_ESP32_DEV = 'https://github.com/platformio/platform-espressif32.git#feature/stage'