From 623cfb8fe44aa8828163c7c4eac000315256f7b6 Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Mon, 3 Dec 2018 15:12:28 +0100 Subject: [PATCH 1/2] Fix toon --- homeassistant/components/climate/toon.py | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/homeassistant/components/climate/toon.py b/homeassistant/components/climate/toon.py index 5972ff52a8b2bf..7e08e874882ef2 100644 --- a/homeassistant/components/climate/toon.py +++ b/homeassistant/components/climate/toon.py @@ -15,6 +15,13 @@ 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): """Set up the Toon climate device.""" @@ -58,8 +65,7 @@ def temperature_unit(self): @property def current_operation(self): """Return current operation i.e. comfort, home, away.""" - state = self.thermos.get_data('state') - return state + return TOON_HA.get(self.thermos.get_data('state')) @property def operation_list(self): @@ -83,14 +89,7 @@ def set_temperature(self, **kwargs): def set_operation_mode(self, operation_mode): """Set new operation mode.""" - toonlib_values = { - STATE_AUTO: 'Comfort', - STATE_HEAT: 'Home', - STATE_ECO: 'Away', - STATE_COOL: 'Sleep', - } - - self.thermos.set_state(toonlib_values[operation_mode]) + self.thermos.set_state(HA_TOON[operation_mode]) def update(self): """Update local state.""" From 9a637ddf55bb3c50e7da8dc6586086333eb1688e Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Tue, 4 Dec 2018 12:54:53 +0100 Subject: [PATCH 2/2] Update toon.py --- homeassistant/components/climate/toon.py | 1 + 1 file changed, 1 insertion(+) diff --git a/homeassistant/components/climate/toon.py b/homeassistant/components/climate/toon.py index 7e08e874882ef2..022a509ce06bdb 100644 --- a/homeassistant/components/climate/toon.py +++ b/homeassistant/components/climate/toon.py @@ -23,6 +23,7 @@ } TOON_HA = {value: key for key, value in HA_TOON.items()} + def setup_platform(hass, config, add_entities, discovery_info=None): """Set up the Toon climate device.""" add_entities([ThermostatDevice(hass)], True)