Update docstring (config file) and attempt to honor PEP0257
This commit is contained in:
parent
78a555faf5
commit
914a6dff5e
20 changed files with 52 additions and 67 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
"""
|
||||
homeassistant.components.sensor.isy994
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Support for ISY994 sensors.
|
||||
"""
|
||||
import logging
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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]
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
"""
|
||||
homeassistant.components.sensor.tellstick
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Shows sensor values from tellstick sensors.
|
||||
Shows sensor values from Tellstick sensors.
|
||||
|
||||
Possible config keys:
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue