Update docstrings (#7361)
* Update docstrings * Update docstrings * Update docstrings * Update docstrings * update docstrings * Update docstrings * Update docstrings * Update docstrings * Update docstrings * Update docstrings * Update tomato.py * Update isy994.py * Lint + fix tests * Lint
This commit is contained in:
parent
e22e70a01a
commit
3ee4d1060f
264 changed files with 1686 additions and 1768 deletions
|
@ -19,15 +19,12 @@ from homeassistant.const import (CONF_HOST, CONF_USERNAME, CONF_PASSWORD,
|
|||
CONF_PORT, TEMP_CELSIUS, CONF_NAME)
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
|
||||
# Home Assistant depends on 3rd party packages for API specific code.
|
||||
REQUIREMENTS = ['oemthermostat==1.1']
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
# Local configs
|
||||
CONF_AWAY_TEMP = 'away_temp'
|
||||
|
||||
# Validation of the user's configuration
|
||||
PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
|
||||
vol.Required(CONF_HOST): cv.string,
|
||||
vol.Optional(CONF_NAME, default="Thermostat"): cv.string,
|
||||
|
@ -39,11 +36,9 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
|
|||
|
||||
|
||||
def setup_platform(hass, config, add_devices, discovery_info=None):
|
||||
"""Setup oemthermostat."""
|
||||
"""Set up the oemthermostat platform."""
|
||||
from oemthermostat import Thermostat
|
||||
|
||||
# Assign configuration variables. The configuration check takes care they
|
||||
# are present.
|
||||
name = config.get(CONF_NAME)
|
||||
host = config.get(CONF_HOST)
|
||||
port = config.get(CONF_PORT)
|
||||
|
@ -51,20 +46,17 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
|||
password = config.get(CONF_PASSWORD)
|
||||
away_temp = config.get(CONF_AWAY_TEMP)
|
||||
|
||||
# If creating the class raises an exception, it failed to connect or
|
||||
# something else went wrong.
|
||||
try:
|
||||
therm = Thermostat(host, port=port,
|
||||
username=username, password=password)
|
||||
therm = Thermostat(
|
||||
host, port=port, username=username, password=password)
|
||||
except (ValueError, AssertionError, requests.RequestException):
|
||||
return False
|
||||
|
||||
# Add devices
|
||||
add_devices((ThermostatDevice(hass, therm, name, away_temp), ), True)
|
||||
|
||||
|
||||
class ThermostatDevice(ClimateDevice):
|
||||
"""Interface class for the oemthermostat module and HA."""
|
||||
"""Interface class for the oemthermostat modul."""
|
||||
|
||||
def __init__(self, hass, thermostat, name, away_temp):
|
||||
"""Initialize the device."""
|
||||
|
@ -87,12 +79,12 @@ class ThermostatDevice(ClimateDevice):
|
|||
|
||||
@property
|
||||
def name(self):
|
||||
"""Name of this Thermostat."""
|
||||
"""Return the name of this Thermostat."""
|
||||
return self._name
|
||||
|
||||
@property
|
||||
def temperature_unit(self):
|
||||
"""The unit of measurement used by the platform."""
|
||||
"""Return the unit of measurement used by the platform."""
|
||||
return TEMP_CELSIUS
|
||||
|
||||
@property
|
||||
|
@ -114,7 +106,7 @@ class ThermostatDevice(ClimateDevice):
|
|||
return self._setpoint
|
||||
|
||||
def set_temperature(self, **kwargs):
|
||||
"""Change the setpoint of the thermostat."""
|
||||
"""Set the temperature."""
|
||||
# If we are setting the temp, then we don't want away mode anymore.
|
||||
self.turn_away_mode_off()
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue