Only create cloud user if cloud in use (#29150)

* Only create cloud user if cloud in use

* Pass context to alexa

* Update requirements

* Fix handing & design pattern for 0.30

* fix tests

* Fix lint & tests

* rename internal user
This commit is contained in:
Paulus Schoutsen authored and Pascal Vizeli committed 2019-11-28 14:23:59 +01:00
1 parent 5d5d053bce
commit b847d55077
15 files changed
+221 -145

No files matched your search

+5 -9
View File
@@ -174,9 +174,8 @@ class GoogleActionsSyncView(HomeAssistantView):
"""Trigger a Google Actions sync."""
hass = request.app["hass"]
cloud: Cloud = hass.data[DOMAIN]
status = await cloud.client.google_config.async_sync_entities(
cloud.client.google_config.agent_user_id
)
gconf = await cloud.client.get_google_config()
status = await gconf.async_sync_entities(gconf.agent_user_id)
return self.json({}, status_code=status)
@@ -194,11 +193,7 @@ class CloudLoginView(HomeAssistantView):
"""Handle login request."""
hass = request.app["hass"]
cloud = hass.data[DOMAIN]
with async_timeout.timeout(REQUEST_TIMEOUT):
await hass.async_add_job(cloud.auth.login, data["email"], data["password"])
hass.async_add_job(cloud.iot.connect)
await cloud.login(data["email"], data["password"])
return self.json({"success": True})
@@ -479,7 +474,8 @@ async def websocket_remote_disconnect(hass, connection, msg):
async def google_assistant_list(hass, connection, msg):
"""List all google assistant entities."""
cloud = hass.data[DOMAIN]
entities = google_helpers.async_get_entities(hass, cloud.client.google_config)
gconf = await cloud.client.get_google_config()
entities = google_helpers.async_get_entities(hass, gconf)
result = []