Only turn on scripts that are not currently running.

Prevents an errant API call from advancing a currently executing delay
step before it should.
This commit is contained in:
Andrew Thigpen committed 2016-02-21 11:11:35 -06:00
1 parent ff9568ad26
commit b961b5037f
2 files changed
+43 -2

No files matched your search

+6 -2
View File
@@ -70,8 +70,12 @@ def setup(hass, config):
""" Execute a service call to script.<script name>. """
entity_id = ENTITY_ID_FORMAT.format(service.service)
script = component.entities.get(entity_id)
if script:
script.turn_on()
if not script:
return
if script.is_on:
_LOGGER.warning("Script %s already running.", entity_id)
return
script.turn_on()
for object_id, cfg in config[DOMAIN].items():
if object_id != slugify(object_id):