mirror of
https://github.com/home-assistant/core.git
synced 2025-07-22 20:57:21 +00:00
Add docstrings, fix typos, and update docsstring for PEP257
This commit is contained in:
parent
7a0c99a1d5
commit
fd3ea95b82
@ -1,6 +1,4 @@
|
||||
"""
|
||||
homeassistant.components.binary_sensor
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
Component to interface with binary sensors (sensors which only know two states)
|
||||
that can be monitored.
|
||||
|
||||
|
@ -1,6 +1,4 @@
|
||||
"""
|
||||
homeassistant.components.binary_sensor.apcupsd
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
Provides a binary sensor to track online status of a UPS.
|
||||
|
||||
For more details about this platform, please refer to the documentation at
|
||||
@ -14,7 +12,7 @@ DEFAULT_NAME = "UPS Online Status"
|
||||
|
||||
|
||||
def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||
""" Instantiate an OnlineStatus binary sensor entity and add it to HA. """
|
||||
"""Instantiate an OnlineStatus binary sensor entity."""
|
||||
add_entities((OnlineStatus(config, apcupsd.DATA),))
|
||||
|
||||
|
||||
|
@ -1,6 +1,4 @@
|
||||
"""
|
||||
homeassistant.components.binary_sensor.arest
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
The arest sensor will consume an exposed aREST API of a device.
|
||||
|
||||
For more details about this platform, please refer to the documentation at
|
||||
@ -25,7 +23,6 @@ CONF_PIN = 'pin'
|
||||
|
||||
def setup_platform(hass, config, add_devices, discovery_info=None):
|
||||
"""Get the aREST binary sensor."""
|
||||
|
||||
resource = config.get(CONF_RESOURCE)
|
||||
pin = config.get(CONF_PIN)
|
||||
|
||||
@ -89,7 +86,6 @@ class ArestBinarySensor(BinarySensorDevice):
|
||||
# pylint: disable=too-few-public-methods
|
||||
class ArestData(object):
|
||||
"""Class for handling the data retrieval for pins."""
|
||||
|
||||
def __init__(self, resource, pin):
|
||||
self._resource = resource
|
||||
self._pin = pin
|
||||
|
@ -38,7 +38,7 @@ class BloomSkySensor(BinarySensorDevice):
|
||||
""" Represents a single binary sensor in a BloomSky device. """
|
||||
|
||||
def __init__(self, bs, device, sensor_name):
|
||||
"""Initialize a bloomsky binary sensor."""
|
||||
"""Initialize a BloomSky binary sensor."""
|
||||
self._bloomsky = bs
|
||||
self._device_id = device["DeviceID"]
|
||||
self._sensor_name = sensor_name
|
||||
|
@ -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/
|
||||
@ -28,7 +26,6 @@ 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."""
|
||||
|
||||
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
|
||||
|
@ -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'),
|
||||
@ -24,7 +22,7 @@ class DemoBinarySensor(BinarySensorDevice):
|
||||
|
||||
@property
|
||||
def sensor_class(self):
|
||||
""" Return our class. """
|
||||
"""Return the class of this sensor."""
|
||||
return self._sensor_type
|
||||
|
||||
@property
|
||||
|
@ -1,6 +1,4 @@
|
||||
"""
|
||||
homeassistant.components.binary_sensor.mqtt
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
Allows to configure a MQTT binary sensor.
|
||||
|
||||
For more details about this platform, please refer to the documentation at
|
||||
|
@ -54,7 +54,8 @@ class MySensorsBinarySensor(BinarySensorDevice):
|
||||
|
||||
def __init__(
|
||||
self, gateway, node_id, child_id, name, value_type, child_type):
|
||||
"""Setup class attributes on instantiation.
|
||||
"""
|
||||
Setup class attributes on instantiation.
|
||||
|
||||
Args:
|
||||
gateway (GatewayWrapper): Gateway object.
|
||||
@ -124,7 +125,7 @@ class MySensorsBinarySensor(BinarySensorDevice):
|
||||
|
||||
@property
|
||||
def sensor_class(self):
|
||||
"""Return the class of this sensor, from SENSOR_CASSES."""
|
||||
"""Return the class of this sensor, from SENSOR_CLASSES."""
|
||||
pres = self.gateway.const.Presentation
|
||||
class_map = {
|
||||
pres.S_DOOR: 'opening',
|
||||
|
@ -1,6 +1,4 @@
|
||||
"""
|
||||
homeassistant.components.binary_sensor.nest
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
Support for Nest Thermostat Binary Sensors.
|
||||
|
||||
For more details about this platform, please refer to the documentation at
|
||||
|
@ -1,6 +1,4 @@
|
||||
"""
|
||||
homeassistant.components.sensor.nx584
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
Support for exposing nx584 elements as sensors.
|
||||
|
||||
For more details about this platform, please refer to the documentation at
|
||||
@ -73,18 +71,22 @@ class NX584ZoneSensor(BinarySensorDevice):
|
||||
|
||||
@property
|
||||
def sensor_class(self):
|
||||
"""Return the class of this sensor, from SENSOR_CLASSES."""
|
||||
return self._zone_type
|
||||
|
||||
@property
|
||||
def should_poll(self):
|
||||
"""No polling needed."""
|
||||
return False
|
||||
|
||||
@property
|
||||
def name(self):
|
||||
"""Name of the binary sensor."""
|
||||
return self._zone['name']
|
||||
|
||||
@property
|
||||
def is_on(self):
|
||||
"""Return true if the binary sensor is on."""
|
||||
# True means "faulted" or "open" or "abnormal state"
|
||||
return self._zone['state']
|
||||
|
||||
|
@ -1,6 +1,4 @@
|
||||
"""
|
||||
homeassistant.components.binary_sensor.rest
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
The rest binary sensor will consume responses sent by an exposed REST API.
|
||||
|
||||
For more details about this platform, please refer to the documentation at
|
||||
@ -59,7 +57,7 @@ class RestBinarySensor(BinarySensorDevice):
|
||||
|
||||
@property
|
||||
def is_on(self):
|
||||
""" Return if the binary sensor is on. """
|
||||
"""Return true if the binary sensor is on."""
|
||||
if self.rest.data is None:
|
||||
return False
|
||||
|
||||
|
@ -1,12 +1,9 @@
|
||||
"""
|
||||
homeassistant.components.binary_sensor.rpi_gpio
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
Allows to configure a binary sensor using RPi GPIO.
|
||||
|
||||
For more details about this platform, please refer to the documentation at
|
||||
https://home-assistant.io/components/binary_sensor.rpi_gpio/
|
||||
"""
|
||||
|
||||
import logging
|
||||
|
||||
import homeassistant.components.rpi_gpio as rpi_gpio
|
||||
|
@ -1,23 +1,23 @@
|
||||
"""
|
||||
homeassistant.components.binary_sensor.tcp
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
Provides a binary_sensor which gets its values from a TCP socket.
|
||||
|
||||
For more details about this platform, please refer to the documentation at
|
||||
https://home-assistant.io/components/binary_sensor.tcp/
|
||||
"""
|
||||
import logging
|
||||
|
||||
from homeassistant.components.binary_sensor import BinarySensorDevice
|
||||
from homeassistant.components.sensor.tcp import Sensor, DOMAIN, CONF_VALUE_ON
|
||||
|
||||
|
||||
DEPENDENCIES = [DOMAIN]
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||
""" Create the BinarySensor. """
|
||||
"""Create the binary sensor."""
|
||||
if not BinarySensor.validate_config(config):
|
||||
return False
|
||||
|
||||
add_entities((BinarySensor(hass, config),))
|
||||
|
||||
|
||||
@ -27,4 +27,5 @@ class BinarySensor(BinarySensorDevice, Sensor):
|
||||
|
||||
@property
|
||||
def is_on(self):
|
||||
"""True if the binary sensor is on."""
|
||||
return self._state == self._config[CONF_VALUE_ON]
|
||||
|
@ -1,6 +1,4 @@
|
||||
"""
|
||||
homeassistant.components.binary_sensor.zigbee
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
Contains functionality to use a ZigBee device as a binary sensor.
|
||||
|
||||
For more details about this platform, please refer to the documentation at
|
||||
|
@ -1,13 +1,9 @@
|
||||
"""
|
||||
homeassistant.components.binary_sensor.zwave
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
Interfaces with Z-Wave sensors.
|
||||
|
||||
For more details about this platform, please refer to the documentation
|
||||
at https://home-assistant.io/components/zwave/
|
||||
https://home-assistant.io/components/binary_sensor.zwave/
|
||||
"""
|
||||
|
||||
|
||||
import logging
|
||||
|
||||
from homeassistant.components.zwave import (
|
||||
@ -23,7 +19,7 @@ DEPENDENCIES = []
|
||||
|
||||
|
||||
def setup_platform(hass, config, add_devices, discovery_info=None):
|
||||
"""Setup the mysensors platform for sensors."""
|
||||
"""Setup the Z-Wave platform for sensors."""
|
||||
|
||||
if discovery_info is None or NETWORK is None:
|
||||
return
|
||||
@ -62,6 +58,7 @@ class ZWaveBinarySensor(BinarySensorDevice, ZWaveDeviceEntity):
|
||||
|
||||
@property
|
||||
def should_poll(self):
|
||||
"""No polling needed."""
|
||||
return False
|
||||
|
||||
def value_changed(self, value):
|
||||
|
Loading…
x
Reference in New Issue
Block a user