Fix calling empty script turn off (#24827)

This commit is contained in:
Paulus Schoutsen authored and GitHub committed 2019-06-28 08:49:33 -07:00
1 parent 80844ae2ee
commit 4e5b1ccde6
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):