Add on/off supported feature to climate (#11379)
* Add on/off supported feature to climate * Lint
This commit is contained in:
parent
ec700c2cd6
commit
eb00e54eba
5 changed files with 125 additions and 17 deletions
|
@ -13,13 +13,12 @@ import async_timeout
|
|||
import voluptuous as vol
|
||||
|
||||
from homeassistant.const import (
|
||||
ATTR_TEMPERATURE, CONF_API_KEY, CONF_ID, STATE_OFF, TEMP_CELSIUS,
|
||||
TEMP_FAHRENHEIT)
|
||||
ATTR_TEMPERATURE, CONF_API_KEY, CONF_ID, TEMP_CELSIUS, TEMP_FAHRENHEIT)
|
||||
from homeassistant.components.climate import (
|
||||
ATTR_CURRENT_HUMIDITY, ClimateDevice, PLATFORM_SCHEMA,
|
||||
SUPPORT_TARGET_TEMPERATURE, SUPPORT_OPERATION_MODE,
|
||||
SUPPORT_FAN_MODE, SUPPORT_SWING_MODE,
|
||||
SUPPORT_AUX_HEAT)
|
||||
SUPPORT_AUX_HEAT, SUPPORT_ON_OFF)
|
||||
from homeassistant.exceptions import PlatformNotReady
|
||||
from homeassistant.helpers import config_validation as cv
|
||||
from homeassistant.helpers.aiohttp_client import async_get_clientsession
|
||||
|
@ -47,7 +46,7 @@ FIELD_TO_FLAG = {
|
|||
'mode': SUPPORT_OPERATION_MODE,
|
||||
'swing': SUPPORT_SWING_MODE,
|
||||
'targetTemperature': SUPPORT_TARGET_TEMPERATURE,
|
||||
'on': SUPPORT_AUX_HEAT,
|
||||
'on': SUPPORT_AUX_HEAT | SUPPORT_ON_OFF,
|
||||
}
|
||||
|
||||
|
||||
|
@ -92,13 +91,6 @@ class SensiboClimate(ClimateDevice):
|
|||
"""Return the list of supported features."""
|
||||
return self._supported_features
|
||||
|
||||
@property
|
||||
def state(self):
|
||||
"""Return the current state."""
|
||||
if not self.is_aux_heat_on:
|
||||
return STATE_OFF
|
||||
return super().state
|
||||
|
||||
def _do_update(self, data):
|
||||
self._name = data['room']['name']
|
||||
self._measurements = data['measurements']
|
||||
|
@ -208,6 +200,8 @@ class SensiboClimate(ClimateDevice):
|
|||
"""Return true if AC is on."""
|
||||
return self._ac_states['on']
|
||||
|
||||
is_on = is_aux_heat_on
|
||||
|
||||
@property
|
||||
def min_temp(self):
|
||||
"""Return the minimum temperature."""
|
||||
|
@ -279,6 +273,9 @@ class SensiboClimate(ClimateDevice):
|
|||
yield from self._client.async_set_ac_state_property(
|
||||
self._id, 'on', False)
|
||||
|
||||
async_on = async_turn_aux_heat_on
|
||||
async_off = async_turn_aux_heat_off
|
||||
|
||||
@asyncio.coroutine
|
||||
def async_update(self):
|
||||
"""Retrieve latest state."""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue