From ad4a960ed2296e4a58713e1d3cfba2da27a3e6ed Mon Sep 17 00:00:00 2001 From: Mister Wil <1091741+MisterWil@users.noreply.github.com> Date: Fri, 1 Nov 2019 17:28:50 -0700 Subject: [PATCH] Change Abode cache file path, add cache path to config flow (#28389) * Changed cache file path * Cache file naming scheme matches original * Restart tests * Adding cache path to config_flow.py * Moved DEFAULT_CACHEDB to consts file * Use correct cache path * Linting issues --- homeassistant/components/abode/__init__.py | 4 +--- homeassistant/components/abode/config_flow.py | 7 +++++-- homeassistant/components/abode/const.py | 2 ++ 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/homeassistant/components/abode/__init__.py b/homeassistant/components/abode/__init__.py index 6a72ac64145..76c14d7917f 100644 --- a/homeassistant/components/abode/__init__.py +++ b/homeassistant/components/abode/__init__.py @@ -23,14 +23,12 @@ from homeassistant.const import ( from homeassistant.helpers import config_validation as cv from homeassistant.helpers.entity import Entity -from .const import ATTRIBUTION, DOMAIN +from .const import ATTRIBUTION, DOMAIN, DEFAULT_CACHEDB _LOGGER = logging.getLogger(__name__) CONF_POLLING = "polling" -DEFAULT_CACHEDB = "./abodepy_cache.pickle" - SERVICE_SETTINGS = "change_setting" SERVICE_CAPTURE_IMAGE = "capture_image" SERVICE_TRIGGER = "trigger_quick_action" diff --git a/homeassistant/components/abode/config_flow.py b/homeassistant/components/abode/config_flow.py index d8d914f7998..bf48e4546b3 100644 --- a/homeassistant/components/abode/config_flow.py +++ b/homeassistant/components/abode/config_flow.py @@ -10,7 +10,7 @@ from homeassistant import config_entries from homeassistant.const import CONF_PASSWORD, CONF_USERNAME from homeassistant.core import callback -from .const import DOMAIN # pylint: disable=W0611 +from .const import DOMAIN, DEFAULT_CACHEDB # pylint: disable=W0611 CONF_POLLING = "polling" @@ -42,9 +42,12 @@ class AbodeFlowHandler(config_entries.ConfigFlow, domain=DOMAIN): username = user_input[CONF_USERNAME] password = user_input[CONF_PASSWORD] polling = user_input.get(CONF_POLLING, False) + cache = self.hass.config.path(DEFAULT_CACHEDB) try: - await self.hass.async_add_executor_job(Abode, username, password, True) + await self.hass.async_add_executor_job( + Abode, username, password, True, True, True, cache + ) except (AbodeException, ConnectTimeout, HTTPError) as ex: _LOGGER.error("Unable to connect to Abode: %s", str(ex)) diff --git a/homeassistant/components/abode/const.py b/homeassistant/components/abode/const.py index 35e74e154cf..092843ba212 100644 --- a/homeassistant/components/abode/const.py +++ b/homeassistant/components/abode/const.py @@ -1,3 +1,5 @@ """Constants for the Abode Security System component.""" DOMAIN = "abode" ATTRIBUTION = "Data provided by goabode.com" + +DEFAULT_CACHEDB = "abodepy_cache.pickle"