Merge pull request #908 from persandstrom/verisure_code_digits

Verisure - code digits settings
pull/907/merge
Paulus Schoutsen 2016-01-16 09:04:53 -08:00
commit 880bd011a9
2 changed files with 5 additions and 2 deletions

View File

@ -57,7 +57,7 @@ class VerisureAlarm(alarm.AlarmControlPanel):
@property @property
def code_format(self): def code_format(self):
""" Four digit code required. """ """ Four digit code required. """
return '^\\d{4}$' return '^\\d{%s}$' % verisure.CODE_DIGITS
def update(self): def update(self):
""" Update alarm status """ """ Update alarm status """

View File

@ -44,6 +44,7 @@ SHOW_THERMOMETERS = True
SHOW_HYGROMETERS = True SHOW_HYGROMETERS = True
SHOW_ALARM = True SHOW_ALARM = True
SHOW_SMARTPLUGS = True SHOW_SMARTPLUGS = True
CODE_DIGITS = 4
# if wrong password was given don't try again # if wrong password was given don't try again
WRONG_PASSWORD_GIVEN = False WRONG_PASSWORD_GIVEN = False
@ -61,11 +62,13 @@ def setup(hass, config):
from verisure import MyPages, LoginError, Error from verisure import MyPages, LoginError, Error
global SHOW_THERMOMETERS, SHOW_HYGROMETERS, SHOW_ALARM, SHOW_SMARTPLUGS global SHOW_THERMOMETERS, SHOW_HYGROMETERS,\
SHOW_ALARM, SHOW_SMARTPLUGS, CODE_DIGITS
SHOW_THERMOMETERS = int(config[DOMAIN].get('thermometers', '1')) SHOW_THERMOMETERS = int(config[DOMAIN].get('thermometers', '1'))
SHOW_HYGROMETERS = int(config[DOMAIN].get('hygrometers', '1')) SHOW_HYGROMETERS = int(config[DOMAIN].get('hygrometers', '1'))
SHOW_ALARM = int(config[DOMAIN].get('alarm', '1')) SHOW_ALARM = int(config[DOMAIN].get('alarm', '1'))
SHOW_SMARTPLUGS = int(config[DOMAIN].get('smartplugs', '1')) SHOW_SMARTPLUGS = int(config[DOMAIN].get('smartplugs', '1'))
CODE_DIGITS = int(config[DOMAIN].get('code_digits', '4'))
global MY_PAGES global MY_PAGES
MY_PAGES = MyPages( MY_PAGES = MyPages(