Modify docstrings to match PEP257
This commit is contained in:
parent
18f48191d9
commit
1e97d31711
6 changed files with 66 additions and 85 deletions
|
@ -1,7 +1,8 @@
|
||||||
"""
|
"""
|
||||||
homeassistant.components.alarm_control_panel
|
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
Component to interface with a alarm control panel.
|
Component to interface with a alarm control panel.
|
||||||
|
|
||||||
|
For more details about this platform, please refer to the documentation at
|
||||||
|
https://home-assistant.io/components/alarm_control_panel/
|
||||||
"""
|
"""
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
|
@ -120,11 +121,10 @@ def alarm_trigger(hass, code=None, entity_id=None):
|
||||||
|
|
||||||
# pylint: disable=no-self-use
|
# pylint: disable=no-self-use
|
||||||
class AlarmControlPanel(Entity):
|
class AlarmControlPanel(Entity):
|
||||||
""" ABC for alarm control devices. """
|
"""An ABC for alarm control devices."""
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def code_format(self):
|
def code_format(self):
|
||||||
""" regex for code format or None if no code is required. """
|
"""Regex for code format or None if no code is required."""
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def alarm_disarm(self, code=None):
|
def alarm_disarm(self, code=None):
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
"""
|
"""
|
||||||
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
|
||||||
|
@ -24,7 +22,6 @@ 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 an 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 +40,6 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
||||||
# pylint: disable=abstract-method
|
# pylint: disable=abstract-method
|
||||||
class AlarmDotCom(alarm.AlarmControlPanel):
|
class AlarmDotCom(alarm.AlarmControlPanel):
|
||||||
"""Represents a Alarm.com status."""
|
"""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
|
||||||
self._alarm = Alarmdotcom(username, password, timeout=10)
|
self._alarm = Alarmdotcom(username, password, timeout=10)
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
"""
|
"""
|
||||||
homeassistant.components.alarm_control_panel.manual
|
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
Support for manual alarms.
|
Support for manual alarms.
|
||||||
|
|
||||||
For more details about this platform, please refer to the documentation at
|
For more details about this platform, please refer to the documentation at
|
||||||
|
@ -25,7 +23,6 @@ DEFAULT_TRIGGER_TIME = 120
|
||||||
|
|
||||||
def setup_platform(hass, config, add_devices, discovery_info=None):
|
def setup_platform(hass, config, add_devices, discovery_info=None):
|
||||||
"""Sets up the manual alarm platform."""
|
"""Sets up the manual alarm platform."""
|
||||||
|
|
||||||
add_devices([ManualAlarm(
|
add_devices([ManualAlarm(
|
||||||
hass,
|
hass,
|
||||||
config.get('name', DEFAULT_ALARM_NAME),
|
config.get('name', DEFAULT_ALARM_NAME),
|
||||||
|
@ -45,7 +42,6 @@ class ManualAlarm(alarm.AlarmControlPanel):
|
||||||
When triggered, will be pending for 'trigger_time'. After that will be
|
When triggered, will be pending for 'trigger_time'. After that will be
|
||||||
triggered for 'trigger_time', after that we return to disarmed.
|
triggered for 'trigger_time', after that we return to disarmed.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, hass, name, code, pending_time, trigger_time):
|
def __init__(self, hass, name, code, pending_time, trigger_time):
|
||||||
self._state = STATE_ALARM_DISARMED
|
self._state = STATE_ALARM_DISARMED
|
||||||
self._hass = hass
|
self._hass = hass
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
"""
|
"""
|
||||||
homeassistant.components.alarm_control_panel.mqtt
|
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
This platform enables the possibility to control a MQTT alarm.
|
This platform enables the possibility to control a MQTT alarm.
|
||||||
|
|
||||||
For more details about this platform, please refer to the documentation at
|
For more details about this platform, please refer to the documentation at
|
||||||
|
@ -27,7 +25,6 @@ DEPENDENCIES = ['mqtt']
|
||||||
|
|
||||||
def setup_platform(hass, config, add_devices, discovery_info=None):
|
def setup_platform(hass, config, add_devices, discovery_info=None):
|
||||||
"""Sets up the MQTT platform."""
|
"""Sets up the MQTT platform."""
|
||||||
|
|
||||||
if config.get('state_topic') is None:
|
if config.get('state_topic') is None:
|
||||||
_LOGGER.error("Missing required variable: state_topic")
|
_LOGGER.error("Missing required variable: state_topic")
|
||||||
return False
|
return False
|
||||||
|
@ -51,8 +48,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 MqttAlarm(alarm.AlarmControlPanel):
|
class MqttAlarm(alarm.AlarmControlPanel):
|
||||||
""" represents a MQTT alarm status within home assistant. """
|
"""Represents a MQTT alarm status."""
|
||||||
|
|
||||||
def __init__(self, hass, name, state_topic, command_topic, qos,
|
def __init__(self, hass, name, state_topic, command_topic, qos,
|
||||||
payload_disarm, payload_arm_home, payload_arm_away, code):
|
payload_disarm, payload_arm_home, payload_arm_away, code):
|
||||||
self._state = STATE_UNKNOWN
|
self._state = STATE_UNKNOWN
|
||||||
|
@ -80,7 +76,7 @@ class MqttAlarm(alarm.AlarmControlPanel):
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def should_poll(self):
|
def should_poll(self):
|
||||||
""" No polling needed """
|
"""No polling needed."""
|
||||||
return False
|
return False
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
@ -95,7 +91,7 @@ class MqttAlarm(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 '.+'
|
||||||
|
|
||||||
def alarm_disarm(self, code=None):
|
def alarm_disarm(self, code=None):
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
"""
|
"""
|
||||||
homeassistant.components.alarm_control_panel.nx584
|
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
Support for NX584 alarm control panels.
|
Support for NX584 alarm control panels.
|
||||||
|
|
||||||
For more details about this platform, please refer to the documentation at
|
For more details about this platform, please refer to the documentation at
|
||||||
|
@ -16,12 +14,11 @@ from homeassistant.const import (
|
||||||
STATE_UNKNOWN)
|
STATE_UNKNOWN)
|
||||||
|
|
||||||
REQUIREMENTS = ['pynx584==0.2']
|
REQUIREMENTS = ['pynx584==0.2']
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
def setup_platform(hass, config, add_devices, discovery_info=None):
|
def setup_platform(hass, config, add_devices, discovery_info=None):
|
||||||
""" Setup nx584. """
|
"""Setup nx584 platform."""
|
||||||
host = config.get('host', 'localhost:5007')
|
host = config.get('host', 'localhost:5007')
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
@ -32,7 +29,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
||||||
|
|
||||||
|
|
||||||
class NX584Alarm(alarm.AlarmControlPanel):
|
class NX584Alarm(alarm.AlarmControlPanel):
|
||||||
""" NX584-based alarm panel. """
|
"""Represents the NX584-based alarm panel. """
|
||||||
def __init__(self, hass, host, name):
|
def __init__(self, hass, host, name):
|
||||||
from nx584 import client
|
from nx584 import client
|
||||||
self._hass = hass
|
self._hass = hass
|
||||||
|
|
|
@ -1,10 +1,8 @@
|
||||||
"""
|
"""
|
||||||
homeassistant.components.alarm_control_panel.verisure
|
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
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/verisure/
|
https://home-assistant.io/components/alarm_control_panel.verisure/
|
||||||
"""
|
"""
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
|
@ -19,8 +17,7 @@ _LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
def setup_platform(hass, config, add_devices, discovery_info=None):
|
def setup_platform(hass, config, add_devices, discovery_info=None):
|
||||||
""" Sets up the Verisure platform. """
|
"""Setup the Verisure platform."""
|
||||||
|
|
||||||
alarms = []
|
alarms = []
|
||||||
if int(hub.config.get('alarm', '1')):
|
if int(hub.config.get('alarm', '1')):
|
||||||
hub.update_alarms()
|
hub.update_alarms()
|
||||||
|
@ -34,7 +31,6 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
||||||
# pylint: disable=abstract-method
|
# pylint: disable=abstract-method
|
||||||
class VerisureAlarm(alarm.AlarmControlPanel):
|
class VerisureAlarm(alarm.AlarmControlPanel):
|
||||||
"""Represents a Verisure alarm status."""
|
"""Represents a Verisure alarm status."""
|
||||||
|
|
||||||
def __init__(self, device_id):
|
def __init__(self, device_id):
|
||||||
self._id = device_id
|
self._id = device_id
|
||||||
self._state = STATE_UNKNOWN
|
self._state = STATE_UNKNOWN
|
||||||
|
@ -52,11 +48,11 @@ class VerisureAlarm(alarm.AlarmControlPanel):
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def code_format(self):
|
def code_format(self):
|
||||||
""" code format as regex """
|
"""Code format as regex."""
|
||||||
return '^\\d{%s}$' % self._digits
|
return '^\\d{%s}$' % self._digits
|
||||||
|
|
||||||
def update(self):
|
def update(self):
|
||||||
""" Update alarm status """
|
"""Update alarm status."""
|
||||||
hub.update_alarms()
|
hub.update_alarms()
|
||||||
|
|
||||||
if hub.alarm_status[self._id].status == 'unarmed':
|
if hub.alarm_status[self._id].status == 'unarmed':
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue