Update docstring (config file) and attempt to honor PEP0257
This commit is contained in:
parent
e55922eb9e
commit
1ed8e58679
3 changed files with 14 additions and 14 deletions
|
@ -3,7 +3,6 @@ homeassistant.components.thermostat.demo
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
Demo platform that offers a fake thermostat.
|
Demo platform that offers a fake thermostat.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
from homeassistant.components.thermostat import ThermostatDevice
|
from homeassistant.components.thermostat import ThermostatDevice
|
||||||
from homeassistant.const import TEMP_CELCIUS, TEMP_FAHRENHEIT
|
from homeassistant.const import TEMP_CELCIUS, TEMP_FAHRENHEIT
|
||||||
|
@ -19,7 +18,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
||||||
|
|
||||||
# pylint: disable=too-many-arguments
|
# pylint: disable=too-many-arguments
|
||||||
class DemoThermostat(ThermostatDevice):
|
class DemoThermostat(ThermostatDevice):
|
||||||
""" Represents a HeatControl within Home Assistant. """
|
""" Represents a HeatControl thermostat. """
|
||||||
|
|
||||||
def __init__(self, name, target_temperature, unit_of_measurement,
|
def __init__(self, name, target_temperature, unit_of_measurement,
|
||||||
away, current_temperature):
|
away, current_temperature):
|
||||||
|
@ -60,7 +59,7 @@ class DemoThermostat(ThermostatDevice):
|
||||||
return self._away
|
return self._away
|
||||||
|
|
||||||
def set_temperature(self, temperature):
|
def set_temperature(self, temperature):
|
||||||
""" Set new target temperature """
|
""" Set new target temperature. """
|
||||||
self._target_temperature = temperature
|
self._target_temperature = temperature
|
||||||
|
|
||||||
def turn_away_mode_on(self):
|
def turn_away_mode_on(self):
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
"""
|
"""
|
||||||
|
homeassistant.components.thermostat.heat_control
|
||||||
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
Adds support for a thermostat.
|
Adds support for a thermostat.
|
||||||
|
|
||||||
Specify a start time, end time and a target temperature.
|
Specify a start time, end time and a target temperature.
|
||||||
|
@ -12,8 +14,8 @@ temperature (min_temp in config). The min temperature is also used
|
||||||
as target temperature when no other temperature is specified.
|
as target temperature when no other temperature is specified.
|
||||||
|
|
||||||
If the heater is manually turned on, the target temperature will
|
If the heater is manually turned on, the target temperature will
|
||||||
be sat to 100*C. Meaning
|
be sat to 100*C. Meaning the thermostat probably will never turn
|
||||||
the thermostat probably will never turn off the heater.
|
off the heater.
|
||||||
If the heater is manually turned off, the target temperature will
|
If the heater is manually turned off, the target temperature will
|
||||||
be sat according to normal rules. (Based on target temperature
|
be sat according to normal rules. (Based on target temperature
|
||||||
for given time intervals and the min temperature.)
|
for given time intervals and the min temperature.)
|
||||||
|
@ -21,7 +23,6 @@ for given time intervals and the min temperature.)
|
||||||
A target temperature sat with the set_temperature function will
|
A target temperature sat with the set_temperature function will
|
||||||
override all other rules for the target temperature.
|
override all other rules for the target temperature.
|
||||||
|
|
||||||
|
|
||||||
Config:
|
Config:
|
||||||
|
|
||||||
[thermostat]
|
[thermostat]
|
||||||
|
@ -55,9 +56,7 @@ target temperature will be 17*C. Between 0745 and 1500 no temperature
|
||||||
is specified. so the min_temp of 10*C will be used. From 1500 to 1850
|
is specified. so the min_temp of 10*C will be used. From 1500 to 1850
|
||||||
the target temperature is 20*, but if away mode is true the target
|
the target temperature is 20*, but if away mode is true the target
|
||||||
temperature will be sat to 10*C
|
temperature will be sat to 10*C
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
import datetime
|
import datetime
|
||||||
import homeassistant.components as core
|
import homeassistant.components as core
|
||||||
|
@ -80,7 +79,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
||||||
|
|
||||||
# pylint: disable=too-many-instance-attributes
|
# pylint: disable=too-many-instance-attributes
|
||||||
class HeatControl(ThermostatDevice):
|
class HeatControl(ThermostatDevice):
|
||||||
""" Represents a HeatControl within Home Assistant. """
|
""" Represents a HeatControl device. """
|
||||||
|
|
||||||
def __init__(self, hass, config, logger):
|
def __init__(self, hass, config, logger):
|
||||||
|
|
||||||
|
@ -150,14 +149,14 @@ class HeatControl(ThermostatDevice):
|
||||||
return self.min_temp
|
return self.min_temp
|
||||||
|
|
||||||
def set_temperature(self, temperature):
|
def set_temperature(self, temperature):
|
||||||
""" Set new target temperature """
|
""" Set new target temperature. """
|
||||||
if temperature is None:
|
if temperature is None:
|
||||||
self._manual_sat_temp = None
|
self._manual_sat_temp = None
|
||||||
else:
|
else:
|
||||||
self._manual_sat_temp = float(temperature)
|
self._manual_sat_temp = float(temperature)
|
||||||
|
|
||||||
def update(self):
|
def update(self):
|
||||||
""" Update current thermostat """
|
""" Update current thermostat. """
|
||||||
heater = self.hass.states.get(self.heater_entity_id)
|
heater = self.hass.states.get(self.heater_entity_id)
|
||||||
if heater is None:
|
if heater is None:
|
||||||
self.logger.error("No heater available")
|
self.logger.error("No heater available")
|
||||||
|
@ -178,7 +177,7 @@ class HeatControl(ThermostatDevice):
|
||||||
core.turn_on(self.hass, self.heater_entity_id)
|
core.turn_on(self.hass, self.heater_entity_id)
|
||||||
|
|
||||||
def _heater_turned_on(self, entity_id, old_state, new_state):
|
def _heater_turned_on(self, entity_id, old_state, new_state):
|
||||||
""" heater is turned on"""
|
""" Heater is turned on. """
|
||||||
if not self._heater_manual_changed:
|
if not self._heater_manual_changed:
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
|
@ -187,7 +186,7 @@ class HeatControl(ThermostatDevice):
|
||||||
self._heater_manual_changed = True
|
self._heater_manual_changed = True
|
||||||
|
|
||||||
def _heater_turned_off(self, entity_id, old_state, new_state):
|
def _heater_turned_off(self, entity_id, old_state, new_state):
|
||||||
""" heater is turned off"""
|
""" Heater is turned off. """
|
||||||
if self._heater_manual_changed:
|
if self._heater_manual_changed:
|
||||||
self.set_temperature(None)
|
self.set_temperature(None)
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
"""
|
"""
|
||||||
|
homeassistant.components.thermostat.nest
|
||||||
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
Adds support for Nest thermostats.
|
Adds support for Nest thermostats.
|
||||||
"""
|
"""
|
||||||
import logging
|
import logging
|
||||||
|
@ -41,7 +43,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
||||||
|
|
||||||
|
|
||||||
class NestThermostat(ThermostatDevice):
|
class NestThermostat(ThermostatDevice):
|
||||||
""" Represents a Nest thermostat within Home Assistant. """
|
""" Represents a Nest thermostat. """
|
||||||
|
|
||||||
def __init__(self, structure, device):
|
def __init__(self, structure, device):
|
||||||
self.structure = structure
|
self.structure = structure
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue