From 62dc737ea313f5298e032d81f89dd6f2434726e0 Mon Sep 17 00:00:00 2001 From: Mister Wil <1091741+MisterWil@users.noreply.github.com> Date: Thu, 12 Apr 2018 13:27:23 -0700 Subject: [PATCH] Abode better events (#13809) * Push abodepy version to 0.13.0 * Bump to 0.13.1. Now uses a cache to store the generated UUID. * Reorganize to not be a dumb dumb. --- homeassistant/components/abode.py | 11 +++++++---- requirements_all.txt | 2 +- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/homeassistant/components/abode.py b/homeassistant/components/abode.py index 08918c77f01..2f56bb7c2b5 100644 --- a/homeassistant/components/abode.py +++ b/homeassistant/components/abode.py @@ -19,7 +19,7 @@ from homeassistant.helpers import config_validation as cv from homeassistant.helpers import discovery from homeassistant.helpers.entity import Entity -REQUIREMENTS = ['abodepy==0.12.3'] +REQUIREMENTS = ['abodepy==0.13.1'] _LOGGER = logging.getLogger(__name__) @@ -27,6 +27,7 @@ CONF_ATTRIBUTION = "Data provided by goabode.com" CONF_POLLING = 'polling' DOMAIN = 'abode' +DEFAULT_CACHEDB = './abodepy_cache.pickle' NOTIFICATION_ID = 'abode_notification' NOTIFICATION_TITLE = 'Abode Security Setup' @@ -87,12 +88,13 @@ ABODE_PLATFORMS = [ class AbodeSystem(object): """Abode System class.""" - def __init__(self, username, password, name, polling, exclude, lights): + def __init__(self, username, password, cache, + name, polling, exclude, lights): """Initialize the system.""" import abodepy self.abode = abodepy.Abode( username, password, auto_login=True, get_devices=True, - get_automations=True) + get_automations=True, cache_path=cache) self.name = name self.polling = polling self.exclude = exclude @@ -129,8 +131,9 @@ def setup(hass, config): lights = conf.get(CONF_LIGHTS) try: + cache = hass.config.path(DEFAULT_CACHEDB) hass.data[DOMAIN] = AbodeSystem( - username, password, name, polling, exclude, lights) + username, password, cache, name, polling, exclude, lights) except (AbodeException, ConnectTimeout, HTTPError) as ex: _LOGGER.error("Unable to connect to Abode: %s", str(ex)) diff --git a/requirements_all.txt b/requirements_all.txt index 86cff3f9420..8fe360df8e8 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -64,7 +64,7 @@ WazeRouteCalculator==0.5 YesssSMS==0.1.1b3 # homeassistant.components.abode -abodepy==0.12.3 +abodepy==0.13.1 # homeassistant.components.media_player.frontier_silicon afsapi==0.0.3