merge from dev

This commit is contained in:
Per Sandström committed 2015-09-13 21:00:51 +02:00
commit 964a1f9aef
169 files changed
+3983 -1830

No files matched your search

+4 -1
View File
@@ -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
+150
View File
@@ -0,0 +1,150 @@
"""
homeassistant.components.sensor.arest
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The arest sensor will consume an exposed aREST API of a device.
Configuration:
To use the arest sensor you will need to add something like the following
to your configuration.yaml file.
sensor:
platform: arest
resource: http://IP_ADDRESS
monitored_variables:
- name: temperature
unit: '°C'
- name: humidity
unit: '%'
Variables:
resource:
*Required
IP address of the device that is exposing an aREST API.
These are the variables for the monitored_variables array:
name
*Required
The name of the variable you wish to monitor.
unit
*Optional
Defines the units of measurement of the sensor, if any.
Details for the API: http://arest.io
Format of a default JSON response by aREST:
{
"variables":{
"temperature":21,
"humidity":89
},
"id":"device008",
"name":"Bedroom",
"connected":true
}
"""
import logging
from requests import get, exceptions
from datetime import timedelta
from homeassistant.util import Throttle
from homeassistant.helpers.entity import Entity
_LOGGER = logging.getLogger(__name__)
# Return cached results if last scan was less then this time ago
MIN_TIME_BETWEEN_UPDATES = timedelta(seconds=60)
def setup_platform(hass, config, add_devices, discovery_info=None):
""" Get the aREST sensor. """
resource = config.get('resource', None)
try:
response = get(resource, timeout=10)
except exceptions.MissingSchema:
_LOGGER.error("Missing resource or schema in configuration. "
"Add http:// to your URL.")
return False
except exceptions.ConnectionError:
_LOGGER.error("No route to device. "
"Please check the IP address in the configuration file.")
return False
rest = ArestData(resource)
dev = []
for variable in config['monitored_variables']:
if 'unit' not in variable:
variable['unit'] = ' '
if variable['name'] not in response.json()['variables']:
_LOGGER.error('Variable: "%s" does not exist', variable['name'])
else:
dev.append(ArestSensor(rest,
response.json()['name'],
variable['name'],
variable['unit']))
add_devices(dev)
class ArestSensor(Entity):
""" Implements an aREST sensor. """
def __init__(self, rest, location, variable, unit_of_measurement):
self.rest = rest
self._name = '{} {}'.format(location.title(), variable.title())
self._variable = variable
self._state = 'n/a'
self._unit_of_measurement = unit_of_measurement
self.update()
@property
def name(self):
""" The name of the sensor. """
return self._name
@property
def unit_of_measurement(self):
""" Unit the value is expressed in. """
return self._unit_of_measurement
@property
def state(self):
""" Returns the state of the device. """
return self._state
def update(self):
""" Gets the latest data from aREST API and updates the state. """
self.rest.update()
values = self.rest.data
if 'error' in values:
self._state = values['error']
else:
self._state = values[self._variable]
# pylint: disable=too-few-public-methods
class ArestData(object):
""" Class for handling the data retrieval. """
def __init__(self, resource):
self.resource = resource
self.data = dict()
@Throttle(MIN_TIME_BETWEEN_UPDATES)
def update(self):
""" Gets the latest data from aREST device. """
try:
response = get(self.resource, timeout=10)
if 'error' in self.data:
del self.data['error']
self.data = response.json()['variables']
except exceptions.ConnectionError:
_LOGGER.error("No route to device. Is device offline?")
self.data['error'] = 'n/a'
+2 -3
View File
@@ -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
@@ -71,7 +70,7 @@ from homeassistant.util import Throttle
from homeassistant.helpers.entity import Entity
REQUIREMENTS = ['blockchain>=1.1.2']
REQUIREMENTS = ['blockchain==1.1.2']
_LOGGER = logging.getLogger(__name__)
OPTION_TYPES = {
'wallet': ['Wallet balance', 'BTC'],
+1 -3
View File
@@ -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
+164
View File
@@ -0,0 +1,164 @@
"""
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,
also see requirements.txt).
As this requires access to the GPIO, you will need to run home-assistant
as root.
Configuration:
To use the Adafruit DHT sensor you will need to add something like the
following to your configuration.yaml file.
sensor:
platform: dht
sensor: DHT22
pin: 23
monitored_conditions:
- temperature
- humidity
Variables:
sensor
*Required
The sensor type, DHT11, DHT22 or AM2302
pin
*Required
The pin the sensor is connected to, something like
'P8_11' for Beaglebone, '23' for Raspberry Pi
monitored_conditions
*Optional
Conditions to monitor. Available conditions are temperature and humidity.
"""
import logging
from datetime import timedelta
from homeassistant.util import Throttle
from homeassistant.const import TEMP_FAHRENHEIT
from homeassistant.helpers.entity import Entity
# update this requirement to upstream as soon as it supports python3
REQUIREMENTS = ['http://github.com/mala-zaba/Adafruit_Python_DHT/archive/'
'4101340de8d2457dd194bca1e8d11cbfc237e919.zip'
'#Adafruit_DHT==1.1.0']
_LOGGER = logging.getLogger(__name__)
SENSOR_TYPES = {
'temperature': ['Temperature', ''],
'humidity': ['Humidity', '%']
}
# Return cached results if last scan was less then this time ago
# DHT11 is able to deliver data once per second, DHT22 once every two
MIN_TIME_BETWEEN_UPDATES = timedelta(seconds=30)
def setup_platform(hass, config, add_devices, discovery_info=None):
""" Get the DHT sensor. """
try:
import Adafruit_DHT
except ImportError:
_LOGGER.exception(
"Unable to import Adafruit_DHT. "
"Did you maybe not install the 'Adafruit_DHT' package?")
return False
SENSOR_TYPES['temperature'][1] = hass.config.temperature_unit
unit = hass.config.temperature_unit
available_sensors = {
"DHT11": Adafruit_DHT.DHT11,
"DHT22": Adafruit_DHT.DHT22,
"AM2302": Adafruit_DHT.AM2302
}
sensor = available_sensors[config['sensor']]
pin = config['pin']
if not sensor or not pin:
_LOGGER.error(
"Config error "
"Please check your settings for DHT, sensor not supported.")
return None
data = DHTClient(Adafruit_DHT, sensor, pin)
dev = []
try:
for variable in config['monitored_conditions']:
if variable not in SENSOR_TYPES:
_LOGGER.error('Sensor type: "%s" does not exist', variable)
else:
dev.append(DHTSensor(data, variable, unit))
except KeyError:
pass
add_devices(dev)
# pylint: disable=too-few-public-methods
class DHTSensor(Entity):
""" Implements an DHT sensor. """
def __init__(self, dht_client, sensor_type, temp_unit):
self.client_name = 'DHT sensor'
self._name = SENSOR_TYPES[sensor_type][0]
self.dht_client = dht_client
self.temp_unit = temp_unit
self.type = sensor_type
self._state = None
self._unit_of_measurement = SENSOR_TYPES[sensor_type][1]
self.update()
@property
def name(self):
return '{} {}'.format(self.client_name, self._name)
@property
def state(self):
""" Returns the state of the device. """
return self._state
@property
def unit_of_measurement(self):
""" Unit of measurement of this entity, if any. """
return self._unit_of_measurement
def update(self):
""" Gets the latest data from the DHT and updates the states. """
self.dht_client.update()
data = self.dht_client.data
if self.type == 'temperature':
self._state = round(data['temperature'], 1)
if self.temp_unit == TEMP_FAHRENHEIT:
self._state = round(data['temperature'] * 1.8 + 32, 1)
elif self.type == 'humidity':
self._state = round(data['humidity'], 1)
class DHTClient(object):
""" Gets the latest data from the DHT sensor. """
def __init__(self, adafruit_dht, sensor, pin):
self.adafruit_dht = adafruit_dht
self.sensor = sensor
self.pin = pin
self.data = dict()
@Throttle(MIN_TIME_BETWEEN_UPDATES)
def update(self):
""" Gets the latest data the DHT sensor. """
humidity, temperature = self.adafruit_dht.read_retry(self.sensor,
self.pin)
if temperature:
self.data['temperature'] = temperature
if humidity:
self.data['humidity'] = humidity
+3 -3
View File
@@ -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)
+6 -8
View File
@@ -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
@@ -37,11 +37,9 @@ monitored_conditions
*Required
An array specifying the conditions to monitor.
These are the variables for the monitored_conditions array:
type
monitored_conditions
*Required
The condition you wish to monitor, see the configuration example above for a
Conditions to monitor. See the configuration example above for a
list of all available conditions to monitor.
Details for the API : https://developer.forecast.io/docs/v2
@@ -49,7 +47,7 @@ Details for the API : https://developer.forecast.io/docs/v2
import logging
from datetime import timedelta
REQUIREMENTS = ['python-forecastio>=1.3.3']
REQUIREMENTS = ['python-forecastio==1.3.3']
try:
import forecastio
@@ -73,7 +71,7 @@ SENSOR_TYPES = {
'humidity': ['Humidity', '%'],
'pressure': ['Pressure', 'mBar'],
'visibility': ['Visibility', 'km'],
'ozone': ['Ozone', ''],
'ozone': ['Ozone', 'DU'],
}
# Return cached results if last scan was less then this time ago
@@ -1,7 +1,6 @@
"""
homeassistant.components.sensor.isy994
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Support for ISY994 sensors.
"""
import logging
+8 -6
View File
@@ -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
+11 -2
View File
@@ -13,6 +13,7 @@ sensor:
platform: mqtt
name: "MQTT Sensor"
state_topic: "home/bedroom/temperature"
qos: 0
unit_of_measurement: "ºC"
Variables:
@@ -25,6 +26,10 @@ state_topic
*Required
The MQTT topic subscribed to receive sensor values.
qos
*Optional
The maximum QoS level of the state topic. Default is 0.
unit_of_measurement
*Optional
Defines the units of measurement of the sensor, if any.
@@ -38,6 +43,7 @@ import homeassistant.components.mqtt as mqtt
_LOGGER = logging.getLogger(__name__)
DEFAULT_NAME = "MQTT Sensor"
DEFAULT_QOS = 0
DEPENDENCIES = ['mqtt']
@@ -54,16 +60,19 @@ def setup_platform(hass, config, add_devices_callback, discovery_info=None):
hass,
config.get('name', DEFAULT_NAME),
config.get('state_topic'),
config.get('qos', DEFAULT_QOS),
config.get('unit_of_measurement'))])
# pylint: disable=too-many-arguments, too-many-instance-attributes
class MqttSensor(Entity):
""" Represents a sensor that can be updated using MQTT """
def __init__(self, hass, name, state_topic, unit_of_measurement):
def __init__(self, hass, name, state_topic, qos, unit_of_measurement):
self._state = "-"
self._hass = hass
self._name = name
self._state_topic = state_topic
self._qos = qos
self._unit_of_measurement = unit_of_measurement
def message_received(topic, payload, qos):
@@ -71,7 +80,7 @@ class MqttSensor(Entity):
self._state = payload
self.update_ha_state()
mqtt.subscribe(hass, self._state_topic, message_received)
mqtt.subscribe(hass, self._state_topic, message_received, self._qos)
@property
def should_poll(self):
+4 -4
View File
@@ -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
@@ -36,8 +35,9 @@ ATTR_NODE_ID = "node_id"
ATTR_CHILD_ID = "child_id"
_LOGGER = logging.getLogger(__name__)
REQUIREMENTS = ['https://github.com/theolind/pymysensors/archive/master.zip'
'#egg=pymysensors-0.1']
REQUIREMENTS = ['https://github.com/theolind/pymysensors/archive/'
'35b87d880147a34107da0d40cb815d75e6cb4af7.zip'
'#pymysensors==0.2']
def setup_platform(hass, config, add_devices, discovery_info=None):
@@ -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
@@ -33,7 +33,7 @@ forecast
Enables the forecast. The default is to display the current conditions.
monitored_conditions
*Optional
*Required
Conditions to monitor. See the configuration example above for a
list of all available conditions to monitor.
@@ -48,7 +48,7 @@ from homeassistant.util import Throttle
from homeassistant.const import (CONF_API_KEY, TEMP_CELCIUS, TEMP_FAHRENHEIT)
from homeassistant.helpers.entity import Entity
REQUIREMENTS = ['pyowm>=2.2.1']
REQUIREMENTS = ['pyowm==2.2.1']
_LOGGER = logging.getLogger(__name__)
SENSOR_TYPES = {
'weather': ['Condition', ''],
+5 -5
View File
@@ -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
@@ -26,8 +25,8 @@ from collections import OrderedDict
from homeassistant.const import (TEMP_CELCIUS)
from homeassistant.helpers.entity import Entity
REQUIREMENTS = ['https://github.com/Danielhiversen/pyRFXtrx/archive/master.zip'
'#RFXtrx>=0.15']
REQUIREMENTS = ['https://github.com/Danielhiversen/pyRFXtrx/archive/' +
'ec7a1aaddf8270db6e5da1c13d58c1547effd7cf.zip#RFXtrx==0.15']
DATA_TYPES = OrderedDict([
('Temperature', TEMP_CELCIUS),
@@ -102,4 +101,5 @@ class RfxtrxSensor(Entity):
@property
def unit_of_measurement(self):
""" Unit this state is expressed in. """
return self._unit_of_measurement
+5 -6
View File
@@ -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:
@@ -53,7 +52,7 @@ DEFAULT_VALUE_HIGH = "HIGH"
DEFAULT_VALUE_LOW = "LOW"
DEFAULT_BOUNCETIME = 50
REQUIREMENTS = ['RPi.GPIO>=0.5.11']
REQUIREMENTS = ['RPi.GPIO==0.5.11']
_LOGGER = logging.getLogger(__name__)
@@ -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
+12 -10
View File
@@ -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,17 +43,17 @@ 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.helpers.entity import Entity
# pylint: disable=no-name-in-module, import-error
from homeassistant.external.nzbclients.sabnzbd import SabnzbdApi
from homeassistant.external.nzbclients.sabnzbd import SabnzbdApiException
import logging
REQUIREMENTS = ['https://github.com/jamespcole/home-assistant-nzb-clients/'
'archive/616cad59154092599278661af17e2a9f2cf5e2a9.zip'
'#python-sabnzbd==0.1']
SENSOR_TYPES = {
'current_status': ['Status', ''],
'speed': ['Speed', 'MB/s'],
@@ -71,7 +70,9 @@ _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. """
from pysabnzbd import SabnzbdApi, SabnzbdApiException
api_key = config.get("api_key")
base_url = config.get("base_url")
name = config.get("name", "SABnzbd")
@@ -105,7 +106,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]
@@ -132,6 +133,7 @@ class SabnzbdSensor(Entity):
def refresh_sabnzbd_data(self):
""" Calls the throttled SABnzbd refresh method. """
if _THROTTLED_REFRESH is not None:
from pysabnzbd import SabnzbdApiException
try:
_THROTTLED_REFRESH()
except SabnzbdApiException:
@@ -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
@@ -54,7 +53,8 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
try:
for location in [config.get('from', None), config.get('to', None)]:
# transport.opendata.ch doesn't play nice with requests.Session
result = get(_RESOURCE + 'locations?query=%s' % location)
result = get(_RESOURCE + 'locations?query=%s' % location,
timeout=10)
journey.append(result.json()['stations'][0]['name'])
except KeyError:
_LOGGER.exception(
@@ -116,8 +116,8 @@ class PublicTransportData(object):
'from=' + self.start + '&' +
'to=' + self.destination + '&' +
'fields[]=connections/from/departureTimestamp/&' +
'fields[]=connections/')
'fields[]=connections/',
timeout=10)
connections = response.json()['connections'][:2]
try:
@@ -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
@@ -66,7 +65,7 @@ import homeassistant.util.dt as dt_util
from homeassistant.helpers.entity import Entity
from homeassistant.const import STATE_ON, STATE_OFF
REQUIREMENTS = ['psutil>=3.0.0']
REQUIREMENTS = ['psutil==3.0.0']
SENSOR_TYPES = {
'disk_use_percent': ['Disk Use', '%'],
'disk_use': ['Disk Use', 'GiB'],
+2 -3
View File
@@ -1,8 +1,7 @@
"""
homeassistant.components.sensor.tellstick
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Shows sensor values from tellstick sensors.
Shows sensor values from Tellstick sensors.
Possible config keys:
@@ -35,7 +34,7 @@ import homeassistant.util as util
DatatypeDescription = namedtuple("DatatypeDescription", ['name', 'unit'])
REQUIREMENTS = ['tellcore-py>=1.0.4']
REQUIREMENTS = ['tellcore-py==1.0.4']
# pylint: disable=unused-argument
+5 -4
View File
@@ -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
@@ -18,7 +17,9 @@ from homeassistant.const import CONF_NAME, DEVICE_DEFAULT_NAME
_LOGGER = logging.getLogger(__name__)
REQUIREMENTS = ['https://github.com/rkabadi/temper-python/archive/master.zip']
REQUIREMENTS = ['https://github.com/rkabadi/temper-python/archive/'
'3dbdaf2d87b8db9a3cd6e5585fc704537dd2d09b.zip'
'#temperusb==1.2.3']
# pylint: disable=unused-argument
+1 -2
View File
@@ -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
+22 -30
View File
@@ -1,31 +1,30 @@
"""
homeassistant.components.sensor.transmission
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Monitors Transmission BitTorrent client API
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
name: Transmission
host: 192.168.1.26
port: 9091
username: YOUR_USERNAME
password: YOUR_PASSWORD
monitored_variables:
- type: 'current_status'
- type: 'download_speed'
- type: 'upload_speed'
platform: transmission
name: Transmission
host: 192.168.1.26
port: 9091
username: YOUR_USERNAME
password: YOUR_PASSWORD
monitored_variables:
- 'current_status'
- 'download_speed'
- 'upload_speed'
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
@@ -33,11 +32,11 @@ The port your Transmission daemon uses, defaults to 9091. Example: 8080
username
*Required
Your Transmission username
Your Transmission username.
password
*Required
Your Transmission password
Your Transmission password.
name
*Optional
@@ -45,16 +44,9 @@ The name to use when displaying this Transmission instance.
monitored_variables
*Required
An array specifying the variables to monitor.
These are the variables for the monitored_variables array:
type
*Required
The variable you wish to monitor, see the configuration example above for a
list of all available variables.
Variables to monitor. See the configuration example above for a
list of all available variables to monitor.
"""
from homeassistant.util import Throttle
from datetime import timedelta
from homeassistant.const import CONF_HOST, CONF_USERNAME, CONF_PASSWORD
@@ -67,7 +59,7 @@ from transmissionrpc.error import TransmissionError
import logging
REQUIREMENTS = ['transmissionrpc>=0.11']
REQUIREMENTS = ['transmissionrpc==0.11']
SENSOR_TYPES = {
'current_status': ['Status', ''],
'download_speed': ['Down Speed', 'MB/s'],
@@ -81,7 +73,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)
@@ -110,11 +102,11 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
dev = []
for variable in config['monitored_variables']:
if variable['type'] not in SENSOR_TYPES:
_LOGGER.error('Sensor type: "%s" does not exist', variable['type'])
if variable not in SENSOR_TYPES:
_LOGGER.error('Sensor type: "%s" does not exist', variable)
else:
dev.append(TransmissionSensor(
variable['type'], transmission_api, name))
variable, transmission_api, name))
add_devices(dev)
+11 -12
View File
@@ -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
@@ -58,8 +54,10 @@ from homeassistant.helpers.entity import Entity
from homeassistant.const import (
ATTR_BATTERY_LEVEL, ATTR_TRIPPED, ATTR_ARMED, ATTR_LAST_TRIP_TIME,
TEMP_CELCIUS, TEMP_FAHRENHEIT)
# pylint: disable=no-name-in-module, import-error
import homeassistant.external.vera.vera as veraApi
REQUIREMENTS = ['https://github.com/balloob/home-assistant-vera-api/archive/'
'a8f823066ead6c7da6fb5e7abaf16fef62e63364.zip'
'#python-vera==0.1']
_LOGGER = logging.getLogger(__name__)
@@ -67,6 +65,7 @@ _LOGGER = logging.getLogger(__name__)
# pylint: disable=unused-argument
def get_devices(hass, config):
""" Find and return Vera Sensors. """
import pyvera as veraApi
base_url = config.get('vera_controller_url')
if not base_url:
+3 -2
View File
@@ -8,8 +8,9 @@ import logging
from homeassistant.helpers.entity import Entity
from homeassistant.const import CONF_ACCESS_TOKEN, STATE_OPEN, STATE_CLOSED
REQUIREMENTS = ['https://github.com/balloob/python-wink/archive/master.zip'
'#pywink>=0.1']
REQUIREMENTS = ['https://github.com/balloob/python-wink/archive/'
'c2b700e8ca866159566ecf5e644d9c297f69f257.zip'
'#python-wink==0.1']
def setup_platform(hass, config, add_devices, discovery_info=None):