Introduce PRESET_NONE for climate (#25360)

* Introduce PRESET_NONE for climate

* Require preset mode to be a string

* Lint

* Fix tests
This commit is contained in:
Paulus Schoutsen 2019-07-21 11:00:42 -07:00 committed by GitHub
parent 17d754dbbf
commit 50d4921d0a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
18 changed files with 44 additions and 38 deletions

View file

@ -7,7 +7,7 @@ import voluptuous as vol
from homeassistant.components.climate import PLATFORM_SCHEMA, ClimateDevice
from homeassistant.components.climate.const import (
HVAC_MODE_AUTO, HVAC_MODE_HEAT, HVAC_MODE_OFF, PRESET_AWAY, PRESET_BOOST,
SUPPORT_PRESET_MODE, SUPPORT_TARGET_TEMPERATURE)
SUPPORT_PRESET_MODE, SUPPORT_TARGET_TEMPERATURE, PRESET_NONE)
from homeassistant.const import (
ATTR_TEMPERATURE, CONF_DEVICES, CONF_MAC, PRECISION_HALVES, TEMP_CELSIUS)
import homeassistant.helpers.config_validation as cv
@ -181,7 +181,7 @@ class EQ3BTSmartThermostat(ClimateDevice):
def set_preset_mode(self, preset_mode):
"""Set new preset mode."""
if not preset_mode:
if preset_mode == PRESET_NONE:
self.set_hvac_mode(HVAC_MODE_HEAT)
self._thermostat.mode = HA_TO_EQ_PRESET[preset_mode]