updates to support ui

This commit is contained in:
Per Sandström 2015-09-25 06:23:04 +02:00
parent f28b392f1a
commit 5cf9bd7223
2 changed files with 11 additions and 1 deletions

View File

@ -29,9 +29,11 @@ SERVICE_TO_METHOD = {
}
ATTR_CODE = 'code'
ATTR_CODE_FORMAT = 'code_format'
ATTR_TO_PROPERTY = [
ATTR_CODE,
ATTR_CODE_FORMAT
]
@ -113,3 +115,11 @@ class AlarmControlPanel(Entity):
def alarm_arm_away(self, code=None):
""" Send arm away command. """
raise NotImplementedError()
@property
def state_attributes(self):
""" Return the state attributes. """
state_attr = {
ATTR_CODE_FORMAT: self.code_format,
}
return state_attr

View File

@ -54,7 +54,7 @@ class VerisureAlarm(alarm.AlarmControlPanel):
@property
def code_format(self):
""" Four digit code required"""
return '[0-9]{4}'
return '^\\d{4}$'
def update(self):
''' update alarm status '''