mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 19:27:45 +00:00
add temperature controls to eph-ember (#11400)
* add temperature controls to eph-ember * fix linting
This commit is contained in:
parent
799e1f0469
commit
c43eceb2cb
@ -9,9 +9,10 @@ from datetime import timedelta
|
|||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.components.climate import (
|
from homeassistant.components.climate import (
|
||||||
ClimateDevice, PLATFORM_SCHEMA, STATE_HEAT, STATE_IDLE, SUPPORT_AUX_HEAT)
|
ClimateDevice, PLATFORM_SCHEMA, STATE_HEAT, STATE_IDLE, SUPPORT_AUX_HEAT,
|
||||||
|
SUPPORT_TARGET_TEMPERATURE)
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
TEMP_CELSIUS, CONF_USERNAME, CONF_PASSWORD)
|
TEMP_CELSIUS, CONF_USERNAME, CONF_PASSWORD, ATTR_TEMPERATURE)
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
|
|
||||||
REQUIREMENTS = ['pyephember==0.1.1']
|
REQUIREMENTS = ['pyephember==0.1.1']
|
||||||
@ -59,7 +60,10 @@ class EphEmberThermostat(ClimateDevice):
|
|||||||
@property
|
@property
|
||||||
def supported_features(self):
|
def supported_features(self):
|
||||||
"""Return the list of supported features."""
|
"""Return the list of supported features."""
|
||||||
return SUPPORT_AUX_HEAT
|
if self._hot_water:
|
||||||
|
return SUPPORT_AUX_HEAT
|
||||||
|
|
||||||
|
return SUPPORT_TARGET_TEMPERATURE | SUPPORT_AUX_HEAT
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def name(self):
|
def name(self):
|
||||||
@ -81,6 +85,14 @@ class EphEmberThermostat(ClimateDevice):
|
|||||||
"""Return the temperature we try to reach."""
|
"""Return the temperature we try to reach."""
|
||||||
return self._zone['targetTemperature']
|
return self._zone['targetTemperature']
|
||||||
|
|
||||||
|
@property
|
||||||
|
def target_temperature_step(self):
|
||||||
|
"""Return the supported step of target temperature."""
|
||||||
|
if self._hot_water:
|
||||||
|
return None
|
||||||
|
|
||||||
|
return 1
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def current_operation(self):
|
def current_operation(self):
|
||||||
"""Return current operation ie. heat, cool, idle."""
|
"""Return current operation ie. heat, cool, idle."""
|
||||||
@ -105,17 +117,38 @@ class EphEmberThermostat(ClimateDevice):
|
|||||||
|
|
||||||
def set_temperature(self, **kwargs):
|
def set_temperature(self, **kwargs):
|
||||||
"""Set new target temperature."""
|
"""Set new target temperature."""
|
||||||
return
|
temperature = kwargs.get(ATTR_TEMPERATURE)
|
||||||
|
if temperature is None:
|
||||||
|
return
|
||||||
|
|
||||||
|
if self._hot_water:
|
||||||
|
return
|
||||||
|
|
||||||
|
if temperature == self.target_temperature:
|
||||||
|
return
|
||||||
|
|
||||||
|
if temperature > self.max_temp or temperature < self.min_temp:
|
||||||
|
return
|
||||||
|
|
||||||
|
self._ember.set_target_temperture_by_name(self._zone_name,
|
||||||
|
int(temperature))
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def min_temp(self):
|
def min_temp(self):
|
||||||
"""Return the minimum temperature."""
|
"""Return the minimum temperature."""
|
||||||
return self._zone['targetTemperature']
|
# Hot water temp doesn't support being changed
|
||||||
|
if self._hot_water:
|
||||||
|
return self._zone['targetTemperature']
|
||||||
|
|
||||||
|
return 5
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def max_temp(self):
|
def max_temp(self):
|
||||||
"""Return the maximum temperature."""
|
"""Return the maximum temperature."""
|
||||||
return self._zone['targetTemperature']
|
if self._hot_water:
|
||||||
|
return self._zone['targetTemperature']
|
||||||
|
|
||||||
|
return 35
|
||||||
|
|
||||||
def update(self):
|
def update(self):
|
||||||
"""Get the latest data."""
|
"""Get the latest data."""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user