mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 05:07:41 +00:00
Bugfix wait in automation (#4984)
This commit is contained in:
parent
f8af6e7863
commit
a6d995e394
@ -166,7 +166,9 @@ def async_setup(hass, config):
|
|||||||
for entity in component.async_extract_from_service(service_call):
|
for entity in component.async_extract_from_service(service_call):
|
||||||
tasks.append(entity.async_trigger(
|
tasks.append(entity.async_trigger(
|
||||||
service_call.data.get(ATTR_VARIABLES), True))
|
service_call.data.get(ATTR_VARIABLES), True))
|
||||||
yield from asyncio.wait(tasks, loop=hass.loop)
|
|
||||||
|
if tasks:
|
||||||
|
yield from asyncio.wait(tasks, loop=hass.loop)
|
||||||
|
|
||||||
@asyncio.coroutine
|
@asyncio.coroutine
|
||||||
def turn_onoff_service_handler(service_call):
|
def turn_onoff_service_handler(service_call):
|
||||||
@ -175,7 +177,9 @@ def async_setup(hass, config):
|
|||||||
method = 'async_{}'.format(service_call.service)
|
method = 'async_{}'.format(service_call.service)
|
||||||
for entity in component.async_extract_from_service(service_call):
|
for entity in component.async_extract_from_service(service_call):
|
||||||
tasks.append(getattr(entity, method)())
|
tasks.append(getattr(entity, method)())
|
||||||
yield from asyncio.wait(tasks, loop=hass.loop)
|
|
||||||
|
if tasks:
|
||||||
|
yield from asyncio.wait(tasks, loop=hass.loop)
|
||||||
|
|
||||||
@asyncio.coroutine
|
@asyncio.coroutine
|
||||||
def toggle_service_handler(service_call):
|
def toggle_service_handler(service_call):
|
||||||
@ -186,7 +190,9 @@ def async_setup(hass, config):
|
|||||||
tasks.append(entity.async_turn_off())
|
tasks.append(entity.async_turn_off())
|
||||||
else:
|
else:
|
||||||
tasks.append(entity.async_turn_on())
|
tasks.append(entity.async_turn_on())
|
||||||
yield from asyncio.wait(tasks, loop=hass.loop)
|
|
||||||
|
if tasks:
|
||||||
|
yield from asyncio.wait(tasks, loop=hass.loop)
|
||||||
|
|
||||||
@asyncio.coroutine
|
@asyncio.coroutine
|
||||||
def reload_service_handler(service_call):
|
def reload_service_handler(service_call):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user