From 9a0a889492d06855bdb1f6683aa5c46a10aa4926 Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Wed, 6 Nov 2019 08:32:33 -0800 Subject: [PATCH] Fix token sent to Almond Web (#28584) --- homeassistant/components/almond/.translations/en.json | 3 ++- homeassistant/components/almond/__init__.py | 6 +++--- homeassistant/components/almond/strings.json | 3 ++- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/homeassistant/components/almond/.translations/en.json b/homeassistant/components/almond/.translations/en.json index 89134cbb170..3ee811b8326 100644 --- a/homeassistant/components/almond/.translations/en.json +++ b/homeassistant/components/almond/.translations/en.json @@ -2,7 +2,8 @@ "config": { "abort": { "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" } diff --git a/homeassistant/components/almond/__init__.py b/homeassistant/components/almond/__init__.py index ebdddecdec3..115e0d24de4 100644 --- a/homeassistant/components/almond/__init__.py +++ b/homeassistant/components/almond/__init__.py @@ -111,7 +111,7 @@ async def async_setup_entry(hass, entry): agent = AlmondAgent(api) # 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) return True @@ -192,10 +192,10 @@ class AlmondOAuth(AbstractAlmondWebAuth): async def async_get_access_token(self): """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() - return self._oauth_session.token + return self._oauth_session.token["access_token"] class AlmondAgent(conversation.AbstractConversationAgent): diff --git a/homeassistant/components/almond/strings.json b/homeassistant/components/almond/strings.json index 9bc4b0e1b93..5cfc52044bb 100644 --- a/homeassistant/components/almond/strings.json +++ b/homeassistant/components/almond/strings.json @@ -2,7 +2,8 @@ "config": { "abort": { "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" }