mirror of
https://github.com/home-assistant/core.git
synced 2025-12-24 21:06:19 +00:00
add support for multiple execution per execute request (#10844)
This commit is contained in:
committed by
Paulus Schoutsen
parent
99ea2c17a1
commit
253d5aea6e
@@ -126,23 +126,23 @@ class GoogleAssistantView(HomeAssistantView):
|
||||
commands = []
|
||||
for command in requested_commands:
|
||||
ent_ids = [ent.get('id') for ent in command.get('devices', [])]
|
||||
execution = command.get('execution')[0]
|
||||
for eid in ent_ids:
|
||||
success = False
|
||||
domain = eid.split('.')[0]
|
||||
(service, service_data) = determine_service(
|
||||
eid, execution.get('command'), execution.get('params'),
|
||||
hass.config.units)
|
||||
if domain == "group":
|
||||
domain = "homeassistant"
|
||||
success = yield from hass.services.async_call(
|
||||
domain, service, service_data, blocking=True)
|
||||
result = {"ids": [eid], "states": {}}
|
||||
if success:
|
||||
result['status'] = 'SUCCESS'
|
||||
else:
|
||||
result['status'] = 'ERROR'
|
||||
commands.append(result)
|
||||
for execution in command.get('execution'):
|
||||
for eid in ent_ids:
|
||||
success = False
|
||||
domain = eid.split('.')[0]
|
||||
(service, service_data) = determine_service(
|
||||
eid, execution.get('command'), execution.get('params'),
|
||||
hass.config.units)
|
||||
if domain == "group":
|
||||
domain = "homeassistant"
|
||||
success = yield from hass.services.async_call(
|
||||
domain, service, service_data, blocking=True)
|
||||
result = {"ids": [eid], "states": {}}
|
||||
if success:
|
||||
result['status'] = 'SUCCESS'
|
||||
else:
|
||||
result['status'] = 'ERROR'
|
||||
commands.append(result)
|
||||
|
||||
return self.json(
|
||||
_make_actions_response(request_id, {'commands': commands}))
|
||||
|
||||
Reference in New Issue
Block a user