mirror of
https://github.com/esphome/esphome.git
synced 2024-11-23 15:38:11 +01:00
Fix scripts circular dependency (#591)
Fixes https://github.com/esphome/issues/issues/370
This commit is contained in:
parent
2fb3970027
commit
e5899ff717
1 changed files with 5 additions and 0 deletions
|
@ -16,8 +16,13 @@ CONFIG_SCHEMA = automation.validate_automation({
|
||||||
|
|
||||||
|
|
||||||
def to_code(config):
|
def to_code(config):
|
||||||
|
# Register all variables first, so that scripts can use other scripts
|
||||||
|
triggers = []
|
||||||
for conf in config:
|
for conf in config:
|
||||||
trigger = cg.new_Pvariable(conf[CONF_ID])
|
trigger = cg.new_Pvariable(conf[CONF_ID])
|
||||||
|
triggers.append((trigger, conf))
|
||||||
|
|
||||||
|
for trigger, conf in triggers:
|
||||||
yield automation.build_automation(trigger, [], conf)
|
yield automation.build_automation(trigger, [], conf)
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue