Fix Google Assistant User with Cloud (#22042)

* Fix Google Assistant User with Cloud

* Fix User Agent ID

* respell

* Fix object

* Fix tests

* fix lint

* Fix lint
This commit is contained in:
Pascal Vizeli 2019-03-15 00:18:31 +01:00 committed by Paulus Schoutsen
parent 3769f5893a
commit 6a80ffa8cc
5 changed files with 94 additions and 20 deletions

View file

@ -136,12 +136,16 @@ class CloudClient(Interface):
if not self._prefs.google_enabled:
return ga.turned_off_response(payload)
cloud = self._hass.data[DOMAIN]
return await ga.async_handle_message(
self._hass, self.google_config,
cloud.claims['cognito:username'], payload
answer = await ga.async_handle_message(
self._hass, self.google_config, self.prefs.cloud_user, payload
)
# Fix AgentUserId
cloud = self._hass.data[DOMAIN]
answer['payload']['agentUserId'] = cloud.claims['cognito:username']
return answer
async def async_webhook_message(
self, payload: Dict[Any, Any]) -> Dict[Any, Any]:
"""Process cloud webhook message to client."""