From 12e69202f845ea92b57c0741dc2c01675a2f8c6e Mon Sep 17 00:00:00 2001 From: Jason Hu Date: Mon, 6 Aug 2018 01:25:37 -0700 Subject: [PATCH] Change to call_service async_stop non-blocking to allow service call finish (#15803) * Call later sync_stop to allow service call finish * Change to use non-blocking service all for restart and stop --- homeassistant/components/websocket_api.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/homeassistant/components/websocket_api.py b/homeassistant/components/websocket_api.py index ed478550c7a..d9c92fa357f 100644 --- a/homeassistant/components/websocket_api.py +++ b/homeassistant/components/websocket_api.py @@ -519,8 +519,12 @@ def handle_call_service(hass, connection, msg): """ async def call_service_helper(msg): """Call a service and fire complete message.""" + blocking = True + if (msg['domain'] == 'homeassistant' and + msg['service'] in ['restart', 'stop']): + blocking = False await hass.services.async_call( - msg['domain'], msg['service'], msg.get('service_data'), True, + msg['domain'], msg['service'], msg.get('service_data'), blocking, connection.context(msg)) connection.send_message_outside(result_message(msg['id']))