mirror of
https://github.com/home-assistant/core.git
synced 2025-07-21 12:17:07 +00:00
parent
1c99960357
commit
26dd490e8e
@ -15,6 +15,14 @@ from homeassistant.const import TEMP_CELSIUS
|
|||||||
|
|
||||||
SUPPORT_FLAGS = SUPPORT_TARGET_TEMPERATURE | SUPPORT_OPERATION_MODE
|
SUPPORT_FLAGS = SUPPORT_TARGET_TEMPERATURE | SUPPORT_OPERATION_MODE
|
||||||
|
|
||||||
|
HA_TOON = {
|
||||||
|
STATE_AUTO: 'Comfort',
|
||||||
|
STATE_HEAT: 'Home',
|
||||||
|
STATE_ECO: 'Away',
|
||||||
|
STATE_COOL: 'Sleep',
|
||||||
|
}
|
||||||
|
TOON_HA = {value: key for key, value in HA_TOON.items()}
|
||||||
|
|
||||||
|
|
||||||
def setup_platform(hass, config, add_entities, discovery_info=None):
|
def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||||
"""Set up the Toon climate device."""
|
"""Set up the Toon climate device."""
|
||||||
@ -58,8 +66,7 @@ class ThermostatDevice(ClimateDevice):
|
|||||||
@property
|
@property
|
||||||
def current_operation(self):
|
def current_operation(self):
|
||||||
"""Return current operation i.e. comfort, home, away."""
|
"""Return current operation i.e. comfort, home, away."""
|
||||||
state = self.thermos.get_data('state')
|
return TOON_HA.get(self.thermos.get_data('state'))
|
||||||
return state
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def operation_list(self):
|
def operation_list(self):
|
||||||
@ -83,14 +90,7 @@ class ThermostatDevice(ClimateDevice):
|
|||||||
|
|
||||||
def set_operation_mode(self, operation_mode):
|
def set_operation_mode(self, operation_mode):
|
||||||
"""Set new operation mode."""
|
"""Set new operation mode."""
|
||||||
toonlib_values = {
|
self.thermos.set_state(HA_TOON[operation_mode])
|
||||||
STATE_AUTO: 'Comfort',
|
|
||||||
STATE_HEAT: 'Home',
|
|
||||||
STATE_ECO: 'Away',
|
|
||||||
STATE_COOL: 'Sleep',
|
|
||||||
}
|
|
||||||
|
|
||||||
self.thermos.set_state(toonlib_values[operation_mode])
|
|
||||||
|
|
||||||
def update(self):
|
def update(self):
|
||||||
"""Update local state."""
|
"""Update local state."""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user