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
pull/28201/head
Mister Wil 2019-11-01 17:28:50 -07:00 committed by Paulus Schoutsen
parent 50affdf953
commit ad4a960ed2
3 changed files with 8 additions and 5 deletions

View File

@ -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"

View File

@ -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))

View File

@ -1,3 +1,5 @@
"""Constants for the Abode Security System component."""
DOMAIN = "abode"
ATTRIBUTION = "Data provided by goabode.com"
DEFAULT_CACHEDB = "abodepy_cache.pickle"