Fix token sent to Almond Web (#28584)

pull/28591/head
Paulus Schoutsen 2019-11-06 08:32:33 -08:00 committed by GitHub
parent 9ba3abd1b7
commit 9a0a889492
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 5 deletions

View File

@ -2,7 +2,8 @@
"config": { "config": {
"abort": { "abort": {
"already_setup": "You can only configure one Almond account.", "already_setup": "You can only configure one Almond account.",
"cannot_connect": "Unable to connect to the Almond server." "cannot_connect": "Unable to connect to the Almond server.",
"missing_configuration": "Please check the documentation on how to set up Almond."
}, },
"title": "Almond" "title": "Almond"
} }

View File

@ -111,7 +111,7 @@ async def async_setup_entry(hass, entry):
agent = AlmondAgent(api) agent = AlmondAgent(api)
# Hass.io does its own configuration of Almond. # Hass.io does its own configuration of Almond.
if entry.data.get("is_hassio"): if entry.data.get("is_hassio") or entry.data["type"] != TYPE_LOCAL:
conversation.async_set_agent(hass, agent) conversation.async_set_agent(hass, agent)
return True return True
@ -192,10 +192,10 @@ class AlmondOAuth(AbstractAlmondWebAuth):
async def async_get_access_token(self): async def async_get_access_token(self):
"""Return a valid access token.""" """Return a valid access token."""
if not self._oauth_session.is_valid: if not self._oauth_session.valid_token:
await self._oauth_session.async_ensure_token_valid() await self._oauth_session.async_ensure_token_valid()
return self._oauth_session.token return self._oauth_session.token["access_token"]
class AlmondAgent(conversation.AbstractConversationAgent): class AlmondAgent(conversation.AbstractConversationAgent):

View File

@ -2,7 +2,8 @@
"config": { "config": {
"abort": { "abort": {
"already_setup": "You can only configure one Almond account.", "already_setup": "You can only configure one Almond account.",
"cannot_connect": "Unable to connect to the Almond server." "cannot_connect": "Unable to connect to the Almond server.",
"missing_configuration": "Please check the documentation on how to set up Almond."
}, },
"title": "Almond" "title": "Almond"
} }