Update docstring (config file) and attempt to honor PEP0257

This commit is contained in:
Fabian Affolter 2015-09-07 19:40:09 +02:00
parent 78a555faf5
commit 914a6dff5e
20 changed files with 52 additions and 67 deletions

View file

@ -6,6 +6,9 @@ supported.
Configuration: Configuration:
To use the arduino sensor you will need to add something like the following
to your configuration.yaml file.
sensor: sensor:
platform: arduino platform: arduino
pins: pins:
@ -46,7 +49,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 Arduino platform. """ """ Sets up the Arduino platform. """
# Verify that Arduino board is present # Verify that the Arduino board is present
if arduino.BOARD is None: if arduino.BOARD is None:
_LOGGER.error('A connection has not been made to the Arduino board.') _LOGGER.error('A connection has not been made to the Arduino board.')
return False return False

View file

@ -1,7 +1,6 @@
""" """
homeassistant.components.sensor.bitcoin homeassistant.components.sensor.bitcoin
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Bitcoin information service that uses blockchain.info and its online wallet. Bitcoin information service that uses blockchain.info and its online wallet.
Configuration: Configuration:
@ -12,7 +11,7 @@ check 'Enable Api Access'. You will get an email message from blockchain.info
where you must authorize the API access. where you must authorize the API access.
To use the Bitcoin sensor you will need to add something like the following To use the Bitcoin sensor you will need to add something like the following
to your config/configuration.yaml to your configuration.yaml file.
sensor: sensor:
platform: bitcoin platform: bitcoin

View file

@ -1,9 +1,7 @@
""" """
homeassistant.components.sensor.demo homeassistant.components.sensor.demo
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Demo platform that has a couple of fake sensors.
Demo platform that has two fake sensors.
""" """
from homeassistant.helpers.entity import Entity from homeassistant.helpers.entity import Entity
from homeassistant.const import TEMP_CELCIUS, ATTR_BATTERY_LEVEL from homeassistant.const import TEMP_CELCIUS, ATTR_BATTERY_LEVEL

View file

@ -1,6 +1,6 @@
""" """
homeassistant.components.sensor.dht homeassistant.components.sensor.dht
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Adafruit DHT temperature and humidity sensor. Adafruit DHT temperature and humidity sensor.
You need a Python3 compatible version of the Adafruit_Python_DHT library You need a Python3 compatible version of the Adafruit_Python_DHT library
(e.g. https://github.com/mala-zaba/Adafruit_Python_DHT, (e.g. https://github.com/mala-zaba/Adafruit_Python_DHT,
@ -10,8 +10,8 @@ as root.
Configuration: Configuration:
To use the Adafruit DHT sensor you will need to To use the Adafruit DHT sensor you will need to add something like the
add something like the following to your config/configuration.yaml: following to your configuration.yaml file.
sensor: sensor:
platform: dht platform: dht
@ -102,7 +102,6 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
# pylint: disable=too-few-public-methods # pylint: disable=too-few-public-methods
class DHTSensor(Entity): class DHTSensor(Entity):
""" Implements an DHT sensor. """ """ Implements an DHT sensor. """
def __init__(self, dht_client, sensor_type, temp_unit): def __init__(self, dht_client, sensor_type, temp_unit):
@ -144,7 +143,6 @@ class DHTSensor(Entity):
class DHTClient(object): class DHTClient(object):
""" Gets the latest data from the DHT sensor. """ """ Gets the latest data from the DHT sensor. """
def __init__(self, adafruit_dht, sensor, pin): def __init__(self, adafruit_dht, sensor, pin):

View file

@ -7,7 +7,7 @@ Monitors home energy use as measured by an efergy engage hub using its
Configuration: Configuration:
To use the efergy sensor you will need to add something like the following To use the efergy sensor you will need to add something like the following
to your config/configuration.yaml to your configuration.yaml file.
sensor: sensor:
platform: efergy platform: efergy
@ -61,7 +61,7 @@ SENSOR_TYPES = {
def setup_platform(hass, config, add_devices, discovery_info=None): def setup_platform(hass, config, add_devices, discovery_info=None):
""" Sets up the efergy sensor. """ """ Sets up the Efergy sensor. """
app_token = config.get("app_token") app_token = config.get("app_token")
if not app_token: if not app_token:
_LOGGER.error( _LOGGER.error(
@ -118,7 +118,7 @@ class EfergySensor(Entity):
return self._unit_of_measurement return self._unit_of_measurement
def update(self): def update(self):
""" Gets the efergy monitor data from the web service """ """ Gets the Efergy monitor data from the web service. """
if self.type == 'instant_readings': if self.type == 'instant_readings':
url_string = _RESOURCE + 'getInstant?token=' + self.app_token url_string = _RESOURCE + 'getInstant?token=' + self.app_token
response = get(url_string) response = get(url_string)

View file

@ -1,12 +1,12 @@
""" """
homeassistant.components.sensor.forecast homeassistant.components.sensor.forecast
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Forecast.io service. Forecast.io weather service.
Configuration: Configuration:
To use the Forecast sensor you will need to add something like the To use the Forecast sensor you will need to add something like the
following to your config/configuration.yaml following to your configuration.yaml file.
sensor: sensor:
platform: forecast platform: forecast

View file

@ -1,7 +1,6 @@
""" """
homeassistant.components.sensor.isy994 homeassistant.components.sensor.isy994
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Support for ISY994 sensors. Support for ISY994 sensors.
""" """
import logging import logging

View file

@ -4,8 +4,9 @@ homeassistant.components.modbus
Support for Modbus sensors. Support for Modbus sensors.
Configuration: Configuration:
To use the Modbus sensors you will need to add something like the following to To use the Modbus sensors you will need to add something like the following to
your config/configuration.yaml your configuration.yaml file.
sensor: sensor:
platform: modbus platform: modbus
@ -47,7 +48,6 @@ Note:
- Each named register will create an integer sensor. - Each named register will create an integer sensor.
- Each named bit will create a boolean sensor. - Each named bit will create a boolean sensor.
""" """
import logging import logging
import homeassistant.components.modbus as modbus import homeassistant.components.modbus as modbus
@ -61,7 +61,7 @@ DEPENDENCIES = ['modbus']
def setup_platform(hass, config, add_devices, discovery_info=None): def setup_platform(hass, config, add_devices, discovery_info=None):
""" Read config and create Modbus devices """ """ Read config and create Modbus devices. """
sensors = [] sensors = []
slave = config.get("slave", None) slave = config.get("slave", None)
if modbus.TYPE == "serial" and not slave: if modbus.TYPE == "serial" and not slave:
@ -97,7 +97,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
class ModbusSensor(Entity): class ModbusSensor(Entity):
# pylint: disable=too-many-arguments # pylint: disable=too-many-arguments
""" Represents a Modbus Sensor """ """ Represents a Modbus Sensor. """
def __init__(self, name, slave, register, bit=None, unit=None, coil=False): def __init__(self, name, slave, register, bit=None, unit=None, coil=False):
self._name = name self._name = name
@ -113,8 +113,10 @@ class ModbusSensor(Entity):
@property @property
def should_poll(self): def should_poll(self):
""" We should poll, because slaves are not allowed to """
initiate communication on Modbus networks""" We should poll, because slaves are not allowed to
initiate communication on Modbus networks.
"""
return True return True
@property @property

View file

@ -1,13 +1,12 @@
""" """
homeassistant.components.sensor.mysensors homeassistant.components.sensor.mysensors
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Support for MySensors sensors. Support for MySensors sensors.
Configuration: Configuration:
To use the MySensors sensor you will need to add something like the To use the MySensors sensor you will need to add something like the
following to your config/configuration.yaml following to your configuration.yaml file.
sensor: sensor:
platform: mysensors platform: mysensors

View file

@ -6,7 +6,7 @@ OpenWeatherMap (OWM) service.
Configuration: Configuration:
To use the OpenWeatherMap sensor you will need to add something like the To use the OpenWeatherMap sensor you will need to add something like the
following to your config/configuration.yaml following to your configuration.yaml file.
sensor: sensor:
platform: openweathermap platform: openweathermap

View file

@ -4,10 +4,9 @@ homeassistant.components.sensor.rfxtrx
Shows sensor values from RFXtrx sensors. Shows sensor values from RFXtrx sensors.
Configuration: Configuration:
To use the rfxtrx sensors you will need to add something like the following to
your config/configuration.yaml
Example: To use the rfxtrx sensors you will need to add something like the following to
your configuration.yaml file.
sensor: sensor:
platform: rfxtrx platform: rfxtrx
@ -102,4 +101,5 @@ class RfxtrxSensor(Entity):
@property @property
def unit_of_measurement(self): def unit_of_measurement(self):
""" Unit this state is expressed in. """
return self._unit_of_measurement return self._unit_of_measurement

View file

@ -1,7 +1,7 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
""" """
homeassistant.components.sensor.rpi_gpio homeassistant.components.sensor.rpi_gpio
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Allows to configure a binary state sensor using RPi GPIO. Allows to configure a binary state sensor using RPi GPIO.
Note: To use RPi GPIO, Home Assistant must be run as root. Note: To use RPi GPIO, Home Assistant must be run as root.
@ -35,11 +35,10 @@ The time in milliseconds for port debouncing. Default is 50ms.
ports ports
*Required *Required
An array specifying the GPIO ports to use and the name to use in the frontend. An array specifying the GPIO ports to use and the name to use in the frontend.
""" """
import logging import logging
from homeassistant.helpers.entity import Entity from homeassistant.helpers.entity import Entity
try: try:
import RPi.GPIO as GPIO import RPi.GPIO as GPIO
except ImportError: except ImportError:
@ -119,12 +118,12 @@ class RPiGPIOSensor(Entity):
@property @property
def should_poll(self): def should_poll(self):
""" No polling needed """ """ No polling needed. """
return False return False
@property @property
def name(self): def name(self):
""" The name of the sensor """ """ The name of the sensor. """
return self._name return self._name
@property @property

View file

@ -1,13 +1,12 @@
""" """
homeassistant.components.sensor.sabnzbd homeassistant.components.sensor.sabnzbd
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Monitors SABnzbd NZB client API Monitors SABnzbd NZB client API
Configuration: Configuration:
To use the SABnzbd sensor you will need to add something like the following to To use the SABnzbd sensor you will need to add something like the following to
your config/configuration.yaml your configuration.yaml file.
sensor: sensor:
platform: sabnzbd platform: sabnzbd
@ -27,11 +26,11 @@ Variables:
base_url base_url
*Required *Required
This is the base URL of your SABnzbd instance including the port number if not This is the base URL of your SABnzbd instance including the port number if not
running on 80. Example: http://192.168.1.32:8124/ running on 80, e.g. http://192.168.1.32:8124/
name name
*Optional *Optional
The name to use when displaying this SABnzbd instance The name to use when displaying this SABnzbd instance.
monitored_variables monitored_variables
*Required *Required
@ -44,7 +43,6 @@ type
The variable you wish to monitor, see the configuration example above for a The variable you wish to monitor, see the configuration example above for a
list of all available variables. list of all available variables.
""" """
from homeassistant.util import Throttle from homeassistant.util import Throttle
from datetime import timedelta from datetime import timedelta
@ -71,7 +69,7 @@ _THROTTLED_REFRESH = None
# pylint: disable=unused-argument # pylint: disable=unused-argument
def setup_platform(hass, config, add_devices, discovery_info=None): def setup_platform(hass, config, add_devices, discovery_info=None):
""" Sets up the sensors. """ """ Sets up the SABnzbd sensors. """
api_key = config.get("api_key") api_key = config.get("api_key")
base_url = config.get("base_url") base_url = config.get("base_url")
name = config.get("name", "SABnzbd") name = config.get("name", "SABnzbd")
@ -105,7 +103,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
class SabnzbdSensor(Entity): class SabnzbdSensor(Entity):
""" A Sabnzbd sensor """ """ Represents an SABnzbd sensor. """
def __init__(self, sensor_type, sabnzb_client, client_name): def __init__(self, sensor_type, sabnzb_client, client_name):
self._name = SENSOR_TYPES[sensor_type][0] self._name = SENSOR_TYPES[sensor_type][0]

View file

@ -1,14 +1,13 @@
""" """
homeassistant.components.sensor.swiss_public_transport homeassistant.components.sensor.swiss_public_transport
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The Swiss public transport sensor will give you the next two departure times The Swiss public transport sensor will give you the next two departure times
from a given location to another one. This sensor is limited to Switzerland. from a given location to another one. This sensor is limited to Switzerland.
Configuration: Configuration:
To use the Swiss public transport sensor you will need to add something like To use the Swiss public transport sensor you will need to add something like
the following to your config/configuration.yaml the following to your configuration.yaml file.
sensor: sensor:
platform: swiss_public_transport platform: swiss_public_transport

View file

@ -1,13 +1,12 @@
""" """
homeassistant.components.sensor.systemmonitor homeassistant.components.sensor.systemmonitor
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Shows system monitor values such as: disk, memory, and processor use.
Shows system monitor values such as: disk, memory and processor use
Configuration: Configuration:
To use the System monitor sensor you will need to add something like the To use the System monitor sensor you will need to add something like the
following to your config/configuration.yaml following to your configuration.yaml file.
sensor: sensor:
platform: systemmonitor platform: systemmonitor

View file

@ -1,8 +1,7 @@
""" """
homeassistant.components.sensor.tellstick homeassistant.components.sensor.tellstick
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Shows sensor values from Tellstick sensors.
Shows sensor values from tellstick sensors.
Possible config keys: Possible config keys:

View file

@ -4,10 +4,9 @@ homeassistant.components.sensor.temper
Support for getting temperature from TEMPer devices. Support for getting temperature from TEMPer devices.
Configuration: Configuration:
To use the temper sensors you will need to add something like the following to
your config/configuration.yaml
Example: To use the temper sensors you will need to add something like the following to
your configuration.yaml file.
sensor: sensor:
platform: temper platform: temper

View file

@ -1,13 +1,12 @@
""" """
homeassistant.components.sensor.time_date homeassistant.components.sensor.time_date
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Date and Time service. Date and Time service.
Configuration: Configuration:
To use the Date and Time sensor you will need to add something like the To use the Date and Time sensor you will need to add something like the
following to your config/configuration.yaml following to your configuration.yaml file.
sensor: sensor:
platform: time_date platform: time_date

View file

@ -7,7 +7,7 @@ Monitors Transmission BitTorrent client API
Configuration: Configuration:
To use the Transmission sensor you will need to add something like the To use the Transmission sensor you will need to add something like the
following to your config/configuration.yaml following to your configuration.yaml file.
sensor: sensor:
platform: transmission platform: transmission
@ -25,7 +25,7 @@ Variables:
host host
*Required *Required
This is the IP address of your Transmission daemon. Example: 192.168.1.32 This is the IP address of your Transmission daemon, e.g. 192.168.1.32
port port
*Optional *Optional
@ -54,7 +54,6 @@ type
The variable you wish to monitor, see the configuration example above for a The variable you wish to monitor, see the configuration example above for a
list of all available variables. list of all available variables.
""" """
from homeassistant.util import Throttle from homeassistant.util import Throttle
from datetime import timedelta from datetime import timedelta
from homeassistant.const import CONF_HOST, CONF_USERNAME, CONF_PASSWORD from homeassistant.const import CONF_HOST, CONF_USERNAME, CONF_PASSWORD
@ -81,7 +80,7 @@ _THROTTLED_REFRESH = None
# pylint: disable=unused-argument # pylint: disable=unused-argument
def setup_platform(hass, config, add_devices, discovery_info=None): def setup_platform(hass, config, add_devices, discovery_info=None):
""" Sets up the sensors. """ """ Sets up the Transmission sensors. """
host = config.get(CONF_HOST) host = config.get(CONF_HOST)
username = config.get(CONF_USERNAME, None) username = config.get(CONF_USERNAME, None)
password = config.get(CONF_PASSWORD, None) password = config.get(CONF_PASSWORD, None)

View file

@ -1,13 +1,12 @@
""" """
homeassistant.components.sensor.vera homeassistant.components.sensor.vera
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Support for Vera sensors. Support for Vera sensors.
Configuration: Configuration:
To use the Vera sensors you will need to add something like the following to To use the Vera sensors you will need to add something like the following to
your config/configuration.yaml your configuration.yaml file.
sensor: sensor:
platform: vera platform: vera
@ -24,8 +23,7 @@ Variables:
vera_controller_url vera_controller_url
*Required *Required
This is the base URL of your vera controller including the port number if not This is the base URL of your vera controller including the port number if not
running on 80 running on 80, e.g. http://192.168.1.21:3480/
Example: http://192.168.1.21:3480/
device_data device_data
@ -33,7 +31,7 @@ device_data
This contains an array additional device info for your Vera devices. It is not This contains an array additional device info for your Vera devices. It is not
required and if not specified all sensors configured in your Vera controller required and if not specified all sensors configured in your Vera controller
will be added with default values. You should use the id of your vera device will be added with default values. You should use the id of your vera device
as the key for the device within device_data as the key for the device within device_data.
These are the variables for the device_data array: These are the variables for the device_data array:
@ -41,14 +39,12 @@ name
*Optional *Optional
This parameter allows you to override the name of your Vera device in the HA This parameter allows you to override the name of your Vera device in the HA
interface, if not specified the value configured for the device in your Vera interface, if not specified the value configured for the device in your Vera
will be used will be used.
exclude exclude
*Optional *Optional
This parameter allows you to exclude the specified device from homeassistant, This parameter allows you to exclude the specified device from Home Assistant,
it should be set to "true" if you want this device excluded it should be set to "true" if you want this device excluded.
""" """
import logging import logging
from requests.exceptions import RequestException from requests.exceptions import RequestException