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.
This commit is contained in:
Mister Wil 2018-04-12 13:27:23 -07:00 committed by Fabian Affolter
parent 993866a314
commit 62dc737ea3
2 changed files with 8 additions and 5 deletions

View file

@ -19,7 +19,7 @@ from homeassistant.helpers import config_validation as cv
from homeassistant.helpers import discovery from homeassistant.helpers import discovery
from homeassistant.helpers.entity import Entity from homeassistant.helpers.entity import Entity
REQUIREMENTS = ['abodepy==0.12.3'] REQUIREMENTS = ['abodepy==0.13.1']
_LOGGER = logging.getLogger(__name__) _LOGGER = logging.getLogger(__name__)
@ -27,6 +27,7 @@ CONF_ATTRIBUTION = "Data provided by goabode.com"
CONF_POLLING = 'polling' CONF_POLLING = 'polling'
DOMAIN = 'abode' DOMAIN = 'abode'
DEFAULT_CACHEDB = './abodepy_cache.pickle'
NOTIFICATION_ID = 'abode_notification' NOTIFICATION_ID = 'abode_notification'
NOTIFICATION_TITLE = 'Abode Security Setup' NOTIFICATION_TITLE = 'Abode Security Setup'
@ -87,12 +88,13 @@ ABODE_PLATFORMS = [
class AbodeSystem(object): class AbodeSystem(object):
"""Abode System class.""" """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.""" """Initialize the system."""
import abodepy import abodepy
self.abode = abodepy.Abode( self.abode = abodepy.Abode(
username, password, auto_login=True, get_devices=True, username, password, auto_login=True, get_devices=True,
get_automations=True) get_automations=True, cache_path=cache)
self.name = name self.name = name
self.polling = polling self.polling = polling
self.exclude = exclude self.exclude = exclude
@ -129,8 +131,9 @@ def setup(hass, config):
lights = conf.get(CONF_LIGHTS) lights = conf.get(CONF_LIGHTS)
try: try:
cache = hass.config.path(DEFAULT_CACHEDB)
hass.data[DOMAIN] = AbodeSystem( hass.data[DOMAIN] = AbodeSystem(
username, password, name, polling, exclude, lights) username, password, cache, name, polling, exclude, lights)
except (AbodeException, ConnectTimeout, HTTPError) as ex: except (AbodeException, ConnectTimeout, HTTPError) as ex:
_LOGGER.error("Unable to connect to Abode: %s", str(ex)) _LOGGER.error("Unable to connect to Abode: %s", str(ex))

View file

@ -64,7 +64,7 @@ WazeRouteCalculator==0.5
YesssSMS==0.1.1b3 YesssSMS==0.1.1b3
# homeassistant.components.abode # homeassistant.components.abode
abodepy==0.12.3 abodepy==0.13.1
# homeassistant.components.media_player.frontier_silicon # homeassistant.components.media_player.frontier_silicon
afsapi==0.0.3 afsapi==0.0.3