mirror of
https://github.com/esphome/esphome.git
synced 2024-12-22 13:34:54 +01:00
Fix Interval Trigger
This commit is contained in:
parent
a110911371
commit
dd801636af
2 changed files with 4 additions and 2 deletions
|
@ -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)
|
||||
|
||||
|
|
|
@ -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'
|
||||
|
|
Loading…
Reference in a new issue