mirror of
https://github.com/home-assistant/core.git
synced 2025-08-03 20:55:10 +02:00
Add ability to change Nest mode to all available options
This commit is contained in:
@@ -12,7 +12,7 @@ from homeassistant.components.climate import (
|
||||
PLATFORM_SCHEMA, ATTR_TARGET_TEMP_HIGH, ATTR_TARGET_TEMP_LOW,
|
||||
ATTR_TEMPERATURE)
|
||||
from homeassistant.const import (
|
||||
TEMP_CELSIUS, CONF_SCAN_INTERVAL, STATE_ON)
|
||||
TEMP_CELSIUS, CONF_SCAN_INTERVAL, STATE_ON, STATE_OFF, STATE_UNKNOWN)
|
||||
from homeassistant.util.temperature import convert as convert_temperature
|
||||
|
||||
DEPENDENCIES = ['nest']
|
||||
@@ -41,7 +41,8 @@ class NestThermostat(ClimateDevice):
|
||||
self.structure = structure
|
||||
self.device = device
|
||||
self._fan_list = [STATE_ON, STATE_AUTO]
|
||||
self._operation_list = [STATE_COOL, STATE_IDLE, STATE_HEAT]
|
||||
self._operation_list = [STATE_HEAT, STATE_COOL, STATE_AUTO,
|
||||
STATE_OFF]
|
||||
|
||||
@property
|
||||
def name(self):
|
||||
@@ -79,12 +80,16 @@ class NestThermostat(ClimateDevice):
|
||||
@property
|
||||
def current_operation(self):
|
||||
"""Return current operation ie. heat, cool, idle."""
|
||||
if self.device.hvac_ac_state:
|
||||
if self.device.mode == 'cool':
|
||||
return STATE_COOL
|
||||
elif self.device.hvac_heater_state:
|
||||
elif self.device.mode == 'heat':
|
||||
return STATE_HEAT
|
||||
elif self.device.mode == 'range':
|
||||
return STATE_AUTO
|
||||
elif self.device.mode == 'off':
|
||||
return STATE_OFF
|
||||
else:
|
||||
return STATE_IDLE
|
||||
return STATE_UNKNOWN
|
||||
|
||||
@property
|
||||
def target_temperature(self):
|
||||
@@ -139,7 +144,14 @@ class NestThermostat(ClimateDevice):
|
||||
|
||||
def set_operation_mode(self, operation_mode):
|
||||
"""Set operation mode."""
|
||||
self.device.mode = operation_mode
|
||||
if operation_mode == STATE_HEAT:
|
||||
self.device.mode = 'heat'
|
||||
elif operation_mode == STATE_COOL:
|
||||
self.device.mode = 'cool'
|
||||
elif operation_mode == STATE_AUTO:
|
||||
self.device.mode = 'range'
|
||||
elif operation_mode == STATE_OFF:
|
||||
self.device.mode = 'off'
|
||||
|
||||
@property
|
||||
def operation_list(self):
|
||||
|
Reference in New Issue
Block a user