Add docstrings, fix typos, and update docsstring for PEP257

This commit is contained in:
Fabian Affolter 2016-02-22 10:11:46 +01:00
parent 7a0c99a1d5
commit fd3ea95b82
15 changed files with 67 additions and 89 deletions

View file

@ -1,8 +1,6 @@
"""
homeassistant.components.binary_sensor.command_sensor
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Allows to configure custom shell commands to turn a value
into a logical value for a binary sensor.
Allows to configure custom shell commands to turn a value into a logical value
for a binary sensor.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/binary_sensor.command/
@ -27,8 +25,7 @@ MIN_TIME_BETWEEN_UPDATES = timedelta(seconds=60)
# pylint: disable=unused-argument
def setup_platform(hass, config, add_devices, discovery_info=None):
""" Add the Command Sensor. """
"""Add the Command Sensor."""
if config.get('command') is None:
_LOGGER.error('Missing required variable: "command"')
return False
@ -47,8 +44,9 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
# pylint: disable=too-many-arguments
class CommandBinarySensor(BinarySensorDevice):
""" Represents a binary sensor that is returning
a value of a shell commands. """
"""
Represents a binary sensor that is returning a value of a shell commands.
"""
def __init__(self, hass, data, name, payload_on,
payload_off, value_template):
self._hass = hass
@ -62,16 +60,16 @@ class CommandBinarySensor(BinarySensorDevice):
@property
def name(self):
""" The name of the sensor. """
"""The name of the sensor."""
return self._name
@property
def is_on(self):
""" True if the binary sensor is on. """
"""True if the binary sensor is on."""
return self._state
def update(self):
""" Gets the latest data and updates the state. """
"""Gets the latest data and updates the state."""
self.data.update()
value = self.data.value