mirror of
https://github.com/home-assistant/core.git
synced 2025-11-09 10:59:40 +00:00
Add pin pad to alarm panel (#14178)
* Add pin pad to alarm panel * Add pin pad to alarm panel * Update regex * Update regex * Update regex * Add pin pad to alarm panel * Add pin pad to alarm panel * Add pin pad to alarm panel * Add pin pad to alarm panel * Fix typos * Fix typos * Fix typos * Add pin pad to alarm panel * Fix errors
This commit is contained in:
committed by
Martin Hjelmare
parent
6c3e2021df
commit
9bc26e93a4
@@ -6,6 +6,7 @@ https://home-assistant.io/components/alarm_control_panel.mqtt/
|
||||
"""
|
||||
import asyncio
|
||||
import logging
|
||||
import re
|
||||
|
||||
import voluptuous as vol
|
||||
|
||||
@@ -117,8 +118,12 @@ class MqttAlarm(MqttAvailability, alarm.AlarmControlPanel):
|
||||
|
||||
@property
|
||||
def code_format(self):
|
||||
"""One or more characters if code is defined."""
|
||||
return None if self._code is None else '.+'
|
||||
"""Return one or more digits/characters."""
|
||||
if self._code is None:
|
||||
return None
|
||||
elif isinstance(self._code, str) and re.search('^\\d+$', self._code):
|
||||
return '^\\d+$'
|
||||
return '.+'
|
||||
|
||||
@asyncio.coroutine
|
||||
def async_alarm_disarm(self, code=None):
|
||||
|
||||
Reference in New Issue
Block a user