diff --git a/homeassistant/components/sensor/arduino.py b/homeassistant/components/sensor/arduino.py index 4210a064d1..f6c44d3f60 100644 --- a/homeassistant/components/sensor/arduino.py +++ b/homeassistant/components/sensor/arduino.py @@ -6,6 +6,9 @@ supported. Configuration: +To use the arduino sensor you will need to add something like the following +to your configuration.yaml file. + sensor: platform: arduino pins: @@ -46,7 +49,7 @@ _LOGGER = logging.getLogger(__name__) def setup_platform(hass, config, add_devices, discovery_info=None): """ Sets up the Arduino platform. """ - # Verify that Arduino board is present + # Verify that the Arduino board is present if arduino.BOARD is None: _LOGGER.error('A connection has not been made to the Arduino board.') return False diff --git a/homeassistant/components/sensor/bitcoin.py b/homeassistant/components/sensor/bitcoin.py index b30886448a..60a8a9172b 100644 --- a/homeassistant/components/sensor/bitcoin.py +++ b/homeassistant/components/sensor/bitcoin.py @@ -1,7 +1,6 @@ """ homeassistant.components.sensor.bitcoin ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - Bitcoin information service that uses blockchain.info and its online wallet. 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. 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: platform: bitcoin diff --git a/homeassistant/components/sensor/demo.py b/homeassistant/components/sensor/demo.py index 218860290b..333a0564df 100644 --- a/homeassistant/components/sensor/demo.py +++ b/homeassistant/components/sensor/demo.py @@ -1,9 +1,7 @@ """ homeassistant.components.sensor.demo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -Demo platform that has two fake sensors. - +Demo platform that has a couple of fake sensors. """ from homeassistant.helpers.entity import Entity from homeassistant.const import TEMP_CELCIUS, ATTR_BATTERY_LEVEL diff --git a/homeassistant/components/sensor/dht.py b/homeassistant/components/sensor/dht.py index 7949a7a44f..1c7a2ff11c 100644 --- a/homeassistant/components/sensor/dht.py +++ b/homeassistant/components/sensor/dht.py @@ -1,6 +1,6 @@ """ homeassistant.components.sensor.dht -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Adafruit DHT temperature and humidity sensor. You need a Python3 compatible version of the Adafruit_Python_DHT library (e.g. https://github.com/mala-zaba/Adafruit_Python_DHT, @@ -10,8 +10,8 @@ as root. Configuration: -To use the Adafruit DHT sensor you will need to -add something like the following to your config/configuration.yaml: +To use the Adafruit DHT sensor you will need to add something like the +following to your configuration.yaml file. sensor: platform: dht @@ -102,7 +102,6 @@ def setup_platform(hass, config, add_devices, discovery_info=None): # pylint: disable=too-few-public-methods class DHTSensor(Entity): - """ Implements an DHT sensor. """ def __init__(self, dht_client, sensor_type, temp_unit): @@ -144,7 +143,6 @@ class DHTSensor(Entity): class DHTClient(object): - """ Gets the latest data from the DHT sensor. """ def __init__(self, adafruit_dht, sensor, pin): diff --git a/homeassistant/components/sensor/efergy.py b/homeassistant/components/sensor/efergy.py index 893c4403d7..aed685dce6 100644 --- a/homeassistant/components/sensor/efergy.py +++ b/homeassistant/components/sensor/efergy.py @@ -7,7 +7,7 @@ Monitors home energy use as measured by an efergy engage hub using its Configuration: 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: platform: efergy @@ -61,7 +61,7 @@ SENSOR_TYPES = { 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") if not app_token: _LOGGER.error( @@ -118,7 +118,7 @@ class EfergySensor(Entity): return self._unit_of_measurement 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': url_string = _RESOURCE + 'getInstant?token=' + self.app_token response = get(url_string) diff --git a/homeassistant/components/sensor/forecast.py b/homeassistant/components/sensor/forecast.py index b56432ab89..fcd976baa0 100644 --- a/homeassistant/components/sensor/forecast.py +++ b/homeassistant/components/sensor/forecast.py @@ -1,12 +1,12 @@ """ homeassistant.components.sensor.forecast ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -Forecast.io service. +Forecast.io weather service. Configuration: 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: platform: forecast diff --git a/homeassistant/components/sensor/isy994.py b/homeassistant/components/sensor/isy994.py index 7a242c044f..c30f618f71 100644 --- a/homeassistant/components/sensor/isy994.py +++ b/homeassistant/components/sensor/isy994.py @@ -1,7 +1,6 @@ """ homeassistant.components.sensor.isy994 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - Support for ISY994 sensors. """ import logging diff --git a/homeassistant/components/sensor/modbus.py b/homeassistant/components/sensor/modbus.py index c1cbf101dc..ac2a5e444d 100644 --- a/homeassistant/components/sensor/modbus.py +++ b/homeassistant/components/sensor/modbus.py @@ -4,8 +4,9 @@ homeassistant.components.modbus Support for Modbus sensors. Configuration: + To use the Modbus sensors you will need to add something like the following to -your config/configuration.yaml +your configuration.yaml file. sensor: platform: modbus @@ -47,7 +48,6 @@ Note: - Each named register will create an integer sensor. - Each named bit will create a boolean sensor. """ - import logging import homeassistant.components.modbus as modbus @@ -61,7 +61,7 @@ DEPENDENCIES = ['modbus'] def setup_platform(hass, config, add_devices, discovery_info=None): - """ Read config and create Modbus devices """ + """ Read config and create Modbus devices. """ sensors = [] slave = config.get("slave", None) if modbus.TYPE == "serial" and not slave: @@ -97,7 +97,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None): class ModbusSensor(Entity): # 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): self._name = name @@ -113,8 +113,10 @@ class ModbusSensor(Entity): @property 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 @property diff --git a/homeassistant/components/sensor/mysensors.py b/homeassistant/components/sensor/mysensors.py index 994b110a58..e8c9b779c3 100644 --- a/homeassistant/components/sensor/mysensors.py +++ b/homeassistant/components/sensor/mysensors.py @@ -1,13 +1,12 @@ """ homeassistant.components.sensor.mysensors ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - Support for MySensors sensors. Configuration: 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: platform: mysensors diff --git a/homeassistant/components/sensor/openweathermap.py b/homeassistant/components/sensor/openweathermap.py index 537fc9f59b..a00c66d4b6 100644 --- a/homeassistant/components/sensor/openweathermap.py +++ b/homeassistant/components/sensor/openweathermap.py @@ -6,7 +6,7 @@ OpenWeatherMap (OWM) service. Configuration: 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: platform: openweathermap diff --git a/homeassistant/components/sensor/rfxtrx.py b/homeassistant/components/sensor/rfxtrx.py index 8e5a1ad3dc..d00f6a0cf8 100644 --- a/homeassistant/components/sensor/rfxtrx.py +++ b/homeassistant/components/sensor/rfxtrx.py @@ -4,10 +4,9 @@ homeassistant.components.sensor.rfxtrx Shows sensor values from RFXtrx sensors. 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: platform: rfxtrx @@ -102,4 +101,5 @@ class RfxtrxSensor(Entity): @property def unit_of_measurement(self): + """ Unit this state is expressed in. """ return self._unit_of_measurement diff --git a/homeassistant/components/sensor/rpi_gpio.py b/homeassistant/components/sensor/rpi_gpio.py index f973b24a30..e8482ea56a 100644 --- a/homeassistant/components/sensor/rpi_gpio.py +++ b/homeassistant/components/sensor/rpi_gpio.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- """ homeassistant.components.sensor.rpi_gpio -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Allows to configure a binary state sensor using RPi GPIO. 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 *Required An array specifying the GPIO ports to use and the name to use in the frontend. - """ - import logging from homeassistant.helpers.entity import Entity + try: import RPi.GPIO as GPIO except ImportError: @@ -119,12 +118,12 @@ class RPiGPIOSensor(Entity): @property def should_poll(self): - """ No polling needed """ + """ No polling needed. """ return False @property def name(self): - """ The name of the sensor """ + """ The name of the sensor. """ return self._name @property diff --git a/homeassistant/components/sensor/sabnzbd.py b/homeassistant/components/sensor/sabnzbd.py index cc37bd96b6..89110f7a71 100644 --- a/homeassistant/components/sensor/sabnzbd.py +++ b/homeassistant/components/sensor/sabnzbd.py @@ -1,13 +1,12 @@ """ homeassistant.components.sensor.sabnzbd ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - Monitors SABnzbd NZB client API Configuration: To use the SABnzbd sensor you will need to add something like the following to -your config/configuration.yaml +your configuration.yaml file. sensor: platform: sabnzbd @@ -27,11 +26,11 @@ Variables: base_url *Required 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 *Optional -The name to use when displaying this SABnzbd instance +The name to use when displaying this SABnzbd instance. monitored_variables *Required @@ -44,7 +43,6 @@ type The variable you wish to monitor, see the configuration example above for a list of all available variables. """ - from homeassistant.util import Throttle from datetime import timedelta @@ -71,7 +69,7 @@ _THROTTLED_REFRESH = None # pylint: disable=unused-argument 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") base_url = config.get("base_url") name = config.get("name", "SABnzbd") @@ -105,7 +103,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None): class SabnzbdSensor(Entity): - """ A Sabnzbd sensor """ + """ Represents an SABnzbd sensor. """ def __init__(self, sensor_type, sabnzb_client, client_name): self._name = SENSOR_TYPES[sensor_type][0] diff --git a/homeassistant/components/sensor/swiss_public_transport.py b/homeassistant/components/sensor/swiss_public_transport.py index bd2d336d8e..440c7f8ad2 100644 --- a/homeassistant/components/sensor/swiss_public_transport.py +++ b/homeassistant/components/sensor/swiss_public_transport.py @@ -1,14 +1,13 @@ """ homeassistant.components.sensor.swiss_public_transport ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - 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. Configuration: 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: platform: swiss_public_transport diff --git a/homeassistant/components/sensor/systemmonitor.py b/homeassistant/components/sensor/systemmonitor.py index b473cc2728..ff7e908ccf 100644 --- a/homeassistant/components/sensor/systemmonitor.py +++ b/homeassistant/components/sensor/systemmonitor.py @@ -1,13 +1,12 @@ """ 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: 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: platform: systemmonitor diff --git a/homeassistant/components/sensor/tellstick.py b/homeassistant/components/sensor/tellstick.py index e93c6e4c97..7ee0fc19a9 100644 --- a/homeassistant/components/sensor/tellstick.py +++ b/homeassistant/components/sensor/tellstick.py @@ -1,8 +1,7 @@ """ homeassistant.components.sensor.tellstick ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -Shows sensor values from tellstick sensors. +Shows sensor values from Tellstick sensors. Possible config keys: diff --git a/homeassistant/components/sensor/temper.py b/homeassistant/components/sensor/temper.py index 8579a92266..26dba41fb1 100644 --- a/homeassistant/components/sensor/temper.py +++ b/homeassistant/components/sensor/temper.py @@ -4,10 +4,9 @@ homeassistant.components.sensor.temper Support for getting temperature from TEMPer devices. 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: platform: temper diff --git a/homeassistant/components/sensor/time_date.py b/homeassistant/components/sensor/time_date.py index 149730d4b5..77011c3afa 100644 --- a/homeassistant/components/sensor/time_date.py +++ b/homeassistant/components/sensor/time_date.py @@ -1,13 +1,12 @@ """ homeassistant.components.sensor.time_date ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - Date and Time service. Configuration: 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: platform: time_date diff --git a/homeassistant/components/sensor/transmission.py b/homeassistant/components/sensor/transmission.py index 587f5131d9..f67759477a 100644 --- a/homeassistant/components/sensor/transmission.py +++ b/homeassistant/components/sensor/transmission.py @@ -7,7 +7,7 @@ Monitors Transmission BitTorrent client API Configuration: 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: platform: transmission @@ -25,7 +25,7 @@ Variables: host *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 *Optional @@ -54,7 +54,6 @@ type The variable you wish to monitor, see the configuration example above for a list of all available variables. """ - from homeassistant.util import Throttle from datetime import timedelta from homeassistant.const import CONF_HOST, CONF_USERNAME, CONF_PASSWORD @@ -81,7 +80,7 @@ _THROTTLED_REFRESH = None # pylint: disable=unused-argument def setup_platform(hass, config, add_devices, discovery_info=None): - """ Sets up the sensors. """ + """ Sets up the Transmission sensors. """ host = config.get(CONF_HOST) username = config.get(CONF_USERNAME, None) password = config.get(CONF_PASSWORD, None) diff --git a/homeassistant/components/sensor/vera.py b/homeassistant/components/sensor/vera.py index 89b2a1a296..47748af637 100644 --- a/homeassistant/components/sensor/vera.py +++ b/homeassistant/components/sensor/vera.py @@ -1,13 +1,12 @@ """ homeassistant.components.sensor.vera ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - Support for Vera sensors. Configuration: To use the Vera sensors you will need to add something like the following to -your config/configuration.yaml +your configuration.yaml file. sensor: platform: vera @@ -24,8 +23,7 @@ Variables: vera_controller_url *Required This is the base URL of your vera controller including the port number if not -running on 80 -Example: http://192.168.1.21:3480/ +running on 80, e.g. http://192.168.1.21:3480/ device_data @@ -33,7 +31,7 @@ device_data 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 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: @@ -41,14 +39,12 @@ name *Optional 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 -will be used - +will be used. exclude *Optional -This parameter allows you to exclude the specified device from homeassistant, -it should be set to "true" if you want this device excluded - +This parameter allows you to exclude the specified device from Home Assistant, +it should be set to "true" if you want this device excluded. """ import logging from requests.exceptions import RequestException