Update docstrings

This commit is contained in:
Fabian Affolter 2016-02-03 15:13:53 +01:00
parent f5e736d271
commit 356013118d
2 changed files with 15 additions and 53 deletions

View File

@ -1,29 +1,10 @@
""" """
homeassistant.components.sensor.ecobee homeassistant.components.sensor.ecobee
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Sensor platform for Ecobee sensors.
Ecobee Thermostat Component For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/sensor.ecobee/
This component adds support for Ecobee3 Wireless Thermostats.
You will need to setup developer access to your thermostat,
and create and API key on the ecobee website.
The first time you run this component you will see a configuration
component card in Home Assistant. This card will contain a PIN code
that you will need to use to authorize access to your thermostat. You
can do this at https://www.ecobee.com/consumerportal/index.html
Click My Apps, Add application, Enter Pin and click Authorize.
After authorizing the application click the button in the configuration
card. Now your thermostat and sensors should shown in home-assistant.
You can use the optional hold_temp parameter to set whether or not holds
are set indefintely or until the next scheduled event.
ecobee:
api_key: asdfasdfasdfasdfasdfaasdfasdfasdfasdf
hold_temp: True
""" """
import logging import logging
@ -32,7 +13,6 @@ from homeassistant.components import ecobee
from homeassistant.const import TEMP_FAHRENHEIT from homeassistant.const import TEMP_FAHRENHEIT
DEPENDENCIES = ['ecobee'] DEPENDENCIES = ['ecobee']
SENSOR_TYPES = { SENSOR_TYPES = {
'temperature': ['Temperature', TEMP_FAHRENHEIT], 'temperature': ['Temperature', TEMP_FAHRENHEIT],
'humidity': ['Humidity', '%'], 'humidity': ['Humidity', '%'],
@ -40,12 +20,11 @@ SENSOR_TYPES = {
} }
_LOGGER = logging.getLogger(__name__) _LOGGER = logging.getLogger(__name__)
ECOBEE_CONFIG_FILE = 'ecobee.conf' ECOBEE_CONFIG_FILE = 'ecobee.conf'
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 Ecobee sensors. """
if discovery_info is None: if discovery_info is None:
return return
data = ecobee.NETWORK data = ecobee.NETWORK
@ -63,7 +42,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
class EcobeeSensor(Entity): class EcobeeSensor(Entity):
""" An ecobee sensor. """ """ An Ecobee sensor. """
def __init__(self, sensor_name, sensor_type, sensor_index): def __init__(self, sensor_name, sensor_type, sensor_index):
self._name = sensor_name + ' ' + SENSOR_TYPES[sensor_type][0] self._name = sensor_name + ' ' + SENSOR_TYPES[sensor_type][0]
@ -76,6 +55,7 @@ class EcobeeSensor(Entity):
@property @property
def name(self): def name(self):
""" Returns the name of the Ecobee sensor.. """
return self._name.rstrip() return self._name.rstrip()
@property @property
@ -85,9 +65,11 @@ class EcobeeSensor(Entity):
@property @property
def unit_of_measurement(self): def unit_of_measurement(self):
""" Unit of measurement this sensor expresses itself in. """
return self._unit_of_measurement return self._unit_of_measurement
def update(self): def update(self):
""" Get the latest state of the sensor. """
data = ecobee.NETWORK data = ecobee.NETWORK
data.update() data.update()
for sensor in data.ecobee.get_remote_sensors(self.index): for sensor in data.ecobee.get_remote_sensors(self.index):

View File

@ -1,29 +1,10 @@
""" """
homeassistant.components.thermostat.ecobee homeassistant.components.thermostat.ecobee
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Platform for Ecobee Thermostats.
Ecobee Thermostat Component
This component adds support for Ecobee3 Wireless Thermostats.
You will need to setup developer access to your thermostat,
and create and API key on the ecobee website.
The first time you run this component you will see a configuration
component card in Home Assistant. This card will contain a PIN code
that you will need to use to authorize access to your thermostat. You
can do this at https://www.ecobee.com/consumerportal/index.html
Click My Apps, Add application, Enter Pin and click Authorize.
After authorizing the application click the button in the configuration
card. Now your thermostat and sensors should shown in home-assistant.
You can use the optional hold_temp parameter to set whether or not holds
are set indefintely or until the next scheduled event.
ecobee:
api_key: asdfasdfasdfasdfasdfaasdfasdfasdfasdf
hold_temp: True
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/thermostat.ecobee/
""" """
import logging import logging
@ -33,15 +14,13 @@ from homeassistant.components.thermostat import (ThermostatDevice, STATE_COOL,
from homeassistant.const import (TEMP_FAHRENHEIT, STATE_ON, STATE_OFF) from homeassistant.const import (TEMP_FAHRENHEIT, STATE_ON, STATE_OFF)
DEPENDENCIES = ['ecobee'] DEPENDENCIES = ['ecobee']
_LOGGER = logging.getLogger(__name__) _LOGGER = logging.getLogger(__name__)
ECOBEE_CONFIG_FILE = 'ecobee.conf' ECOBEE_CONFIG_FILE = 'ecobee.conf'
_CONFIGURING = {} _CONFIGURING = {}
def setup_platform(hass, config, add_devices, discovery_info=None): def setup_platform(hass, config, add_devices, discovery_info=None):
""" Setup Platform """ """ Setup the Ecobee Thermostat Platform. """
if discovery_info is None: if discovery_info is None:
return return
data = ecobee.NETWORK data = ecobee.NETWORK
@ -54,7 +33,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
class Thermostat(ThermostatDevice): class Thermostat(ThermostatDevice):
""" Thermostat class for Ecobee """ """ Thermostat class for Ecobee. """
def __init__(self, data, thermostat_index, hold_temp): def __init__(self, data, thermostat_index, hold_temp):
self.data = data self.data = data
@ -66,6 +45,7 @@ class Thermostat(ThermostatDevice):
self.hold_temp = hold_temp self.hold_temp = hold_temp
def update(self): def update(self):
""" Get the latest state from the thermostat. """
self.data.update() self.data.update()
self.thermostat = self.data.ecobee.get_thermostat( self.thermostat = self.data.ecobee.get_thermostat(
self.thermostat_index) self.thermostat_index)