Fix calling empty script turn off (#24827)

This commit is contained in:
Paulus Schoutsen committed 2019-06-28 08:50:16 -07:00
1 parent fafc68673a
commit 2886b217ab
2 files changed
+16 -1

No files matched your search

+6 -1
View File
@@ -79,9 +79,14 @@ async def async_setup(hass, config):
async def turn_off_service(service):
"""Cancel a script."""
# Stopping a script is ok to be done in parallel
scripts = await component.async_extract_from_service(service)
if not scripts:
return
await asyncio.wait([
script.async_turn_off() for script
in await component.async_extract_from_service(service)
in scripts
])
async def toggle_service(service):