mirror of
https://github.com/home-assistant/core.git
synced 2025-07-24 21:57:51 +00:00
Make Automation.reload_service_handler async
This commit is contained in:
parent
56fdc2a625
commit
8f3e12c9b8
@ -164,13 +164,14 @@ def setup(hass, config):
|
|||||||
for entity in component.extract_from_service(service_call):
|
for entity in component.extract_from_service(service_call):
|
||||||
yield from getattr(entity, method)()
|
yield from getattr(entity, method)()
|
||||||
|
|
||||||
|
@asyncio.coroutine
|
||||||
def reload_service_handler(service_call):
|
def reload_service_handler(service_call):
|
||||||
"""Remove all automations and load new ones from config."""
|
"""Remove all automations and load new ones from config."""
|
||||||
conf = component.prepare_reload()
|
conf = yield from hass.loop.run_in_executor(
|
||||||
|
None, component.prepare_reload)
|
||||||
if conf is None:
|
if conf is None:
|
||||||
return
|
return
|
||||||
run_coroutine_threadsafe(
|
yield from _async_process_config(hass, conf, component)
|
||||||
_async_process_config(hass, conf, component), hass.loop).result()
|
|
||||||
|
|
||||||
hass.services.register(DOMAIN, SERVICE_TRIGGER, trigger_service_handler,
|
hass.services.register(DOMAIN, SERVICE_TRIGGER, trigger_service_handler,
|
||||||
descriptions.get(SERVICE_TRIGGER),
|
descriptions.get(SERVICE_TRIGGER),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user