Skip to content

Commit

Permalink
Change alarm panel code format (#20037)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
arsaboo authored and fabaff committed Jan 13, 2019
1 parent 162e2b8 commit 1c11394
Show file tree
Hide file tree
Showing 16 changed files with 19 additions and 17 deletions.
2 changes: 2 additions & 0 deletions homeassistant/components/alarm_control_panel/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
DOMAIN = 'alarm_control_panel'
SCAN_INTERVAL = timedelta(seconds=30)
ATTR_CHANGED_BY = 'changed_by'
FORMAT_TEXT = 'Text'
FORMAT_NUMBER = 'Number'

ENTITY_ID_FORMAT = DOMAIN + '.{}'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def should_poll(self):
@property
def code_format(self):
"""Return one or more digits/characters."""
return 'Number'
return alarm.FORMAT_NUMBER

@property
def state(self):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def code_format(self):
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
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/alarm_control_panel/concord232.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def name(self):
@property
def code_format(self):
"""Return the characters if code is defined."""
return 'Number'
return alarm.FORMAT_NUMBER

@property
def state(self):
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/alarm_control_panel/elkm1.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ def _watch_keypad(self, keypad, changeset):
@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):
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/alarm_control_panel/envisalink.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ def code_format(self):
"""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):
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/alarm_control_panel/ialarm.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def code_format(self):
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
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/alarm_control_panel/ifttt.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ def code_format(self):
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):
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/alarm_control_panel/manual.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ def code_format(self):
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):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ def code_format(self):
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):
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/alarm_control_panel/mqtt.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ def code_format(self):
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):
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/alarm_control_panel/ness_alarm.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def should_poll(self):
@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):
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/alarm_control_panel/nx584.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def name(self):
@property
def code_format(self):
"""Return one or more digits/characters."""
return 'Number'
return alarm.FORMAT_NUMBER

@property
def state(self):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def should_poll(self):
@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):
Expand Down
6 changes: 3 additions & 3 deletions homeassistant/components/alarm_control_panel/simplisafe.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
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 (
Expand Down Expand Up @@ -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):
Expand All @@ -64,7 +64,7 @@ def code_format(self):
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
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/alarm_control_panel/verisure.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def state(self):
@property
def code_format(self):
"""Return one or more digits/characters."""
return 'Number'
return alarm.FORMAT_NUMBER

@property
def changed_by(self):
Expand Down

0 comments on commit 1c11394

Please sign in to comment.