From ed45dff6e89f4b9b0bacecd586d4f149d4d9db0a Mon Sep 17 00:00:00 2001 From: Karim Geiger Date: Thu, 11 Oct 2018 13:25:48 +0200 Subject: [PATCH] Implement turn_off and turn_on actions for eq3btsmart (#17168) * Implement turn_off and turn_on actions for eq3btsmart This commit implements the turn_off and turn_on methods for eq3btsmart. Turning the device off will set the thermostat to "OFF". Turning it on will set it to "AUTO". * Add missing support flags for on/off feature * Fix line length --- homeassistant/components/climate/eq3btsmart.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/homeassistant/components/climate/eq3btsmart.py b/homeassistant/components/climate/eq3btsmart.py index b88500f7fb2..bb0a9d4b810 100644 --- a/homeassistant/components/climate/eq3btsmart.py +++ b/homeassistant/components/climate/eq3btsmart.py @@ -10,7 +10,8 @@ import voluptuous as vol from homeassistant.components.climate import ( STATE_ON, STATE_OFF, STATE_AUTO, PLATFORM_SCHEMA, ClimateDevice, - SUPPORT_TARGET_TEMPERATURE, SUPPORT_OPERATION_MODE, SUPPORT_AWAY_MODE) + SUPPORT_TARGET_TEMPERATURE, SUPPORT_OPERATION_MODE, SUPPORT_AWAY_MODE, + SUPPORT_ON_OFF) from homeassistant.const import ( CONF_MAC, CONF_DEVICES, TEMP_CELSIUS, ATTR_TEMPERATURE, PRECISION_HALVES) import homeassistant.helpers.config_validation as cv @@ -39,7 +40,7 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({ }) SUPPORT_FLAGS = (SUPPORT_TARGET_TEMPERATURE | SUPPORT_OPERATION_MODE | - SUPPORT_AWAY_MODE) + SUPPORT_AWAY_MODE | SUPPORT_ON_OFF) def setup_platform(hass, config, add_entities, discovery_info=None): @@ -150,6 +151,14 @@ class EQ3BTSmartThermostat(ClimateDevice): """Return if we are away.""" return self.current_operation == STATE_AWAY + def turn_on(self): + """Turn device on.""" + self.set_operation_mode(STATE_AUTO) + + def turn_off(self): + """Turn device off.""" + self.set_operation_mode(STATE_OFF) + @property def min_temp(self): """Return the minimum temperature."""