mirror of
				https://github.com/esphome/esphome.git
				synced 2025-10-31 15:12:06 +00:00 
			
		
		
		
	Fix Interval Trigger
This commit is contained in:
		| @@ -2,7 +2,7 @@ import voluptuous as vol | |||||||
|  |  | ||||||
| from esphomeyaml import automation | from esphomeyaml import automation | ||||||
| import esphomeyaml.config_validation as cv | 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_generator import Pvariable | ||||||
| from esphomeyaml.cpp_helpers import setup_component | from esphomeyaml.cpp_helpers import setup_component | ||||||
| from esphomeyaml.cpp_types import App, NoArg, PollingComponent, Trigger, esphomelib_ns | 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({ | CONFIG_SCHEMA = automation.validate_automation(vol.Schema({ | ||||||
|     vol.Required(CONF_ID): cv.declare_variable_id(IntervalTrigger), |     vol.Required(CONF_ID): cv.declare_variable_id(IntervalTrigger), | ||||||
|  |     vol.Required(CONF_INTERVAL): cv.positive_time_period_milliseconds, | ||||||
| }).extend(cv.COMPONENT_SCHEMA.schema)) | }).extend(cv.COMPONENT_SCHEMA.schema)) | ||||||
|  |  | ||||||
|  |  | ||||||
| def to_code(config): | def to_code(config): | ||||||
|     for conf in 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) |         trigger = Pvariable(conf[CONF_ID], rhs) | ||||||
|         setup_component(trigger, conf) |         setup_component(trigger, conf) | ||||||
|  |  | ||||||
|   | |||||||
| @@ -394,6 +394,7 @@ CONF_VARIABLES = 'variables' | |||||||
| CONF_SERVICE = 'service' | CONF_SERVICE = 'service' | ||||||
| CONF_ENTITY_ID = 'entity_id' | CONF_ENTITY_ID = 'entity_id' | ||||||
| CONF_RESTORE_MODE = 'restore_mode' | CONF_RESTORE_MODE = 'restore_mode' | ||||||
|  | CONF_INTERVAL = 'interval' | ||||||
|  |  | ||||||
| ALLOWED_NAME_CHARS = u'abcdefghijklmnopqrstuvwxyz0123456789_' | ALLOWED_NAME_CHARS = u'abcdefghijklmnopqrstuvwxyz0123456789_' | ||||||
| ARDUINO_VERSION_ESP32_DEV = 'https://github.com/platformio/platform-espressif32.git#feature/stage' | ARDUINO_VERSION_ESP32_DEV = 'https://github.com/platformio/platform-espressif32.git#feature/stage' | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user