Fix race between script delay and turn_off (#16923)

This commit is contained in:
Anders Melchiorsen 2018-09-28 06:08:09 +02:00 committed by Aaron Bach
parent c9b6567265
commit 720b05c301

View file

@ -95,7 +95,7 @@ class Script():
def async_script_delay(now):
"""Handle delay."""
# pylint: disable=cell-var-from-loop
self._async_listener.remove(unsub)
self._async_remove_listener()
self.hass.async_create_task(
self.async_run(variables, context))
@ -240,7 +240,7 @@ class Script():
@callback
def async_script_timeout(now):
"""Call after timeout is retrieve."""
self._async_listener.remove(unsub)
self._async_remove_listener()
# Check if we want to continue to execute
# the script after the timeout