Change alarm panel code format (#20037)

* Change code format

* Update elkm1 code format

* Update alarmdecodes code_format

* Update alarmdotcom code_format

* Update concord232 code_format

* Update envisalink code_format

* Update ialarm code_format

* Update ifttt code_format

* Update manual alarm code_format

* Update manual mqtt code_format

* Update mqtt code_format

* Update ness code_format

* Update nx584 code_format

* Update satel_integra code_format

* Update simplisafe code_format

* Update verisure code_format

* Change text to be consistent with the Polymer PR
pull/20107/head
Alok Saboo 2019-01-13 05:59:12 -05:00 committed by Fabian Affolter
parent 162e2b8385
commit 1c11394f5f
16 changed files with 19 additions and 17 deletions

View File

@ -21,6 +21,8 @@ from homeassistant.helpers.entity_component import EntityComponent
DOMAIN = 'alarm_control_panel'
SCAN_INTERVAL = timedelta(seconds=30)
ATTR_CHANGED_BY = 'changed_by'
FORMAT_TEXT = 'Text'
FORMAT_NUMBER = 'Number'
ENTITY_ID_FORMAT = DOMAIN + '.{}'

View File

@ -99,7 +99,7 @@ class AlarmDecoderAlarmPanel(alarm.AlarmControlPanel):
@property
def code_format(self):
"""Return one or more digits/characters."""
return 'Number'
return alarm.FORMAT_NUMBER
@property
def state(self):

View File

@ -81,7 +81,7 @@ class AlarmDotCom(alarm.AlarmControlPanel):
if self._code is None:
return None
if isinstance(self._code, str) and re.search('^\\d+$', self._code):
return 'Number'
return alarm.FORMAT_NUMBER
return 'Any'
@property

View File

@ -80,7 +80,7 @@ class Concord232Alarm(alarm.AlarmControlPanel):
@property
def code_format(self):
"""Return the characters if code is defined."""
return 'Number'
return alarm.FORMAT_NUMBER
@property
def state(self):

View File

@ -116,7 +116,7 @@ class ElkArea(ElkEntity, alarm.AlarmControlPanel):
@property
def code_format(self):
"""Return the alarm code format."""
return '^[0-9]{4}([0-9]{2})?$'
return alarm.FORMAT_NUMBER
@property
def state(self):

View File

@ -104,7 +104,7 @@ class EnvisalinkAlarm(EnvisalinkDevice, alarm.AlarmControlPanel):
"""Regex for code format or None if no code is required."""
if self._code:
return None
return 'Number'
return alarm.FORMAT_NUMBER
@property
def state(self):

View File

@ -82,7 +82,7 @@ class IAlarmPanel(alarm.AlarmControlPanel):
if self._code is None:
return None
if isinstance(self._code, str) and re.search('^\\d+$', self._code):
return 'Number'
return alarm.FORMAT_NUMBER
return 'Any'
@property

View File

@ -129,7 +129,7 @@ class IFTTTAlarmPanel(alarm.AlarmControlPanel):
if self._code is None:
return None
if isinstance(self._code, str) and re.search('^\\d+$', self._code):
return 'Number'
return alarm.FORMAT_NUMBER
return 'Any'
def alarm_disarm(self, code=None):

View File

@ -207,7 +207,7 @@ class ManualAlarm(alarm.AlarmControlPanel, RestoreEntity):
if self._code is None:
return None
if isinstance(self._code, str) and re.search('^\\d+$', self._code):
return 'Number'
return alarm.FORMAT_NUMBER
return 'Any'
def alarm_disarm(self, code=None):

View File

@ -241,7 +241,7 @@ class ManualMQTTAlarm(alarm.AlarmControlPanel):
if self._code is None:
return None
if isinstance(self._code, str) and re.search('^\\d+$', self._code):
return 'Number'
return alarm.FORMAT_NUMBER
return 'Any'
def alarm_disarm(self, code=None):

View File

@ -172,7 +172,7 @@ class MqttAlarm(MqttAvailability, MqttDiscoveryUpdate, MqttEntityDeviceInfo,
if code is None:
return None
if isinstance(code, str) and re.search('^\\d+$', code):
return 'Number'
return alarm.FORMAT_NUMBER
return 'Any'
async def async_alarm_disarm(self, code=None):

View File

@ -59,7 +59,7 @@ class NessAlarmPanel(alarm.AlarmControlPanel):
@property
def code_format(self):
"""Return the regex for code format or None if no code is required."""
return 'Number'
return alarm.FORMAT_NUMBER
@property
def state(self):

View File

@ -70,7 +70,7 @@ class NX584Alarm(alarm.AlarmControlPanel):
@property
def code_format(self):
"""Return one or more digits/characters."""
return 'Number'
return alarm.FORMAT_NUMBER
@property
def state(self):

View File

@ -64,7 +64,7 @@ class SatelIntegraAlarmPanel(alarm.AlarmControlPanel):
@property
def code_format(self):
"""Return the regex for code format or None if no code is required."""
return 'Number'
return alarm.FORMAT_NUMBER
@property
def state(self):

View File

@ -7,7 +7,7 @@ https://home-assistant.io/components/alarm_control_panel.simplisafe/
import logging
import re
from homeassistant.components.alarm_control_panel import AlarmControlPanel
import homeassistant.components.alarm_control_panel as alarm
from homeassistant.components.simplisafe.const import (
DATA_CLIENT, DOMAIN, TOPIC_UPDATE)
from homeassistant.const import (
@ -37,7 +37,7 @@ async def async_setup_entry(hass, entry, async_add_entities):
], True)
class SimpliSafeAlarm(AlarmControlPanel):
class SimpliSafeAlarm(alarm.AlarmControlPanel):
"""Representation of a SimpliSafe alarm."""
def __init__(self, system, code):
@ -64,7 +64,7 @@ class SimpliSafeAlarm(AlarmControlPanel):
if not self._code:
return None
if isinstance(self._code, str) and re.search('^\\d+$', self._code):
return 'Number'
return alarm.FORMAT_NUMBER
return 'Any'
@property

View File

@ -61,7 +61,7 @@ class VerisureAlarm(alarm.AlarmControlPanel):
@property
def code_format(self):
"""Return one or more digits/characters."""
return 'Number'
return alarm.FORMAT_NUMBER
@property
def changed_by(self):