Add docstrings, fix typos, and update docsstring for PEP257
This commit is contained in:
parent
7a0c99a1d5
commit
fd3ea95b82
15 changed files with 67 additions and 89 deletions
|
@ -1,13 +1,11 @@
|
|||
"""
|
||||
homeassistant.components.binary_sensor.demo
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
Demo platform that has two fake binary sensors.
|
||||
"""
|
||||
from homeassistant.components.binary_sensor import BinarySensorDevice
|
||||
|
||||
|
||||
def setup_platform(hass, config, add_devices, discovery_info=None):
|
||||
""" Sets up the Demo binary sensors. """
|
||||
"""Sets up the Demo binary sensors """
|
||||
add_devices([
|
||||
DemoBinarySensor('Basement Floor Wet', False, 'moisture'),
|
||||
DemoBinarySensor('Movement Backyard', True, 'motion'),
|
||||
|
@ -15,7 +13,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
|||
|
||||
|
||||
class DemoBinarySensor(BinarySensorDevice):
|
||||
""" A Demo binary sensor. """
|
||||
"""A Demo binary sensor."""
|
||||
|
||||
def __init__(self, name, state, sensor_class):
|
||||
self._name = name
|
||||
|
@ -24,20 +22,20 @@ class DemoBinarySensor(BinarySensorDevice):
|
|||
|
||||
@property
|
||||
def sensor_class(self):
|
||||
""" Return our class. """
|
||||
"""Return the class of this sensor."""
|
||||
return self._sensor_type
|
||||
|
||||
@property
|
||||
def should_poll(self):
|
||||
""" No polling needed for a demo binary sensor. """
|
||||
"""No polling needed for a demo binary sensor."""
|
||||
return False
|
||||
|
||||
@property
|
||||
def name(self):
|
||||
""" Returns the name of the binary sensor. """
|
||||
"""Returns the name of the binary 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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue