Improve Alexa error handling (#24745)

This commit is contained in:
Paulus Schoutsen authored and GitHub committed 2019-06-24 22:04:31 -07:00
1 parent d4fc22add4
commit f5f86993f1
8 files changed
+121 -9

No files matched your search

+4 -4
View File
@@ -42,11 +42,11 @@ class AbstractConfig:
self._unsub_proactive_report = self.hass.async_create_task(
async_enable_proactive_mode(self.hass, self)
)
resp = await self._unsub_proactive_report
# Failed to start reporting.
if resp is None:
try:
await self._unsub_proactive_report
except Exception: # pylint: disable=broad-except
self._unsub_proactive_report = None
raise
async def async_disable_proactive_mode(self):
"""Disable proactive mode."""
@@ -21,6 +21,9 @@ async def async_enable_proactive_mode(hass, smart_home_config):
Proactive mode makes this component report state changes to Alexa.
"""
# Validate we can get access token.
await smart_home_config.async_get_access_token()
async def async_entity_state_listener(changed_entity, old_state,
new_state):
if not new_state: