mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 11:17:21 +00:00
Update link to docs and docstrings
This commit is contained in:
parent
5ee17ffc58
commit
5108602de3
@ -1,9 +1,10 @@
|
|||||||
"""
|
"""
|
||||||
homeassistant.components.alarm_control_panel.alarmdotcom
|
homeassistant.components.alarm_control_panel.alarmdotcom
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
Interfaces with Verisure alarm control panel.
|
Interfaces with Verisure alarm control panel.
|
||||||
|
|
||||||
For more details about this platform, please refer to the documentation at
|
For more details about this platform, please refer to the documentation at
|
||||||
https://home-assistant.io/components/alarmdotcom/
|
https://home-assistant.io/components/alarm_control_panel.alarmdotcom/
|
||||||
"""
|
"""
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
@ -24,7 +25,7 @@ DEFAULT_NAME = 'Alarm.com'
|
|||||||
|
|
||||||
|
|
||||||
def setup_platform(hass, config, add_devices, discovery_info=None):
|
def setup_platform(hass, config, add_devices, discovery_info=None):
|
||||||
""" Setup Alarm.com control panel """
|
""" Setup an Alarm.com control panel. """
|
||||||
|
|
||||||
username = config.get(CONF_USERNAME)
|
username = config.get(CONF_USERNAME)
|
||||||
password = config.get(CONF_PASSWORD)
|
password = config.get(CONF_PASSWORD)
|
||||||
@ -43,7 +44,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
|||||||
# pylint: disable=too-many-arguments, too-many-instance-attributes
|
# pylint: disable=too-many-arguments, too-many-instance-attributes
|
||||||
# pylint: disable=abstract-method
|
# pylint: disable=abstract-method
|
||||||
class AlarmDotCom(alarm.AlarmControlPanel):
|
class AlarmDotCom(alarm.AlarmControlPanel):
|
||||||
""" Represents a Alarm.com status within HA """
|
""" Represents a Alarm.com status. """
|
||||||
|
|
||||||
def __init__(self, hass, name, code, username, password):
|
def __init__(self, hass, name, code, username, password):
|
||||||
from pyalarmdotcom.pyalarmdotcom import Alarmdotcom
|
from pyalarmdotcom.pyalarmdotcom import Alarmdotcom
|
||||||
@ -62,11 +63,12 @@ class AlarmDotCom(alarm.AlarmControlPanel):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def code_format(self):
|
def code_format(self):
|
||||||
""" One or more characters if code is defined """
|
""" One or more characters if code is defined. """
|
||||||
return None if self._code is None else '.+'
|
return None if self._code is None else '.+'
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def state(self):
|
def state(self):
|
||||||
|
""" Returns the state of the device. """
|
||||||
if self._alarm.state == 'Disarmed':
|
if self._alarm.state == 'Disarmed':
|
||||||
return STATE_ALARM_DISARMED
|
return STATE_ALARM_DISARMED
|
||||||
elif self._alarm.state == 'Armed Stay':
|
elif self._alarm.state == 'Armed Stay':
|
||||||
@ -77,18 +79,21 @@ class AlarmDotCom(alarm.AlarmControlPanel):
|
|||||||
return STATE_UNKNOWN
|
return STATE_UNKNOWN
|
||||||
|
|
||||||
def alarm_disarm(self, code=None):
|
def alarm_disarm(self, code=None):
|
||||||
|
""" Send disarm command. """
|
||||||
if not self._validate_code(code, 'arming home'):
|
if not self._validate_code(code, 'arming home'):
|
||||||
return
|
return
|
||||||
self._alarm.disarm()
|
self._alarm.disarm()
|
||||||
self.update_ha_state()
|
self.update_ha_state()
|
||||||
|
|
||||||
def alarm_arm_home(self, code=None):
|
def alarm_arm_home(self, code=None):
|
||||||
|
""" Send arm home command. """
|
||||||
if not self._validate_code(code, 'arming home'):
|
if not self._validate_code(code, 'arming home'):
|
||||||
return
|
return
|
||||||
self._alarm.arm_stay()
|
self._alarm.arm_stay()
|
||||||
self.update_ha_state()
|
self.update_ha_state()
|
||||||
|
|
||||||
def alarm_arm_away(self, code=None):
|
def alarm_arm_away(self, code=None):
|
||||||
|
""" Send arm away command. """
|
||||||
if not self._validate_code(code, 'arming home'):
|
if not self._validate_code(code, 'arming home'):
|
||||||
return
|
return
|
||||||
self._alarm.arm_away()
|
self._alarm.arm_away()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user