mirror of
https://github.com/home-assistant/core.git
synced 2025-07-22 20:57:21 +00:00
Report Sensibo as off when it is off (#11281)
This commit is contained in:
parent
6e2bfcfe65
commit
ab9ffc4f05
@ -13,11 +13,12 @@ import async_timeout
|
|||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
ATTR_TEMPERATURE, CONF_API_KEY, CONF_ID, TEMP_CELSIUS, TEMP_FAHRENHEIT)
|
ATTR_TEMPERATURE, CONF_API_KEY, CONF_ID, STATE_OFF, TEMP_CELSIUS,
|
||||||
|
TEMP_FAHRENHEIT)
|
||||||
from homeassistant.components.climate import (
|
from homeassistant.components.climate import (
|
||||||
ATTR_CURRENT_HUMIDITY, ClimateDevice, PLATFORM_SCHEMA,
|
ATTR_CURRENT_HUMIDITY, ClimateDevice, PLATFORM_SCHEMA,
|
||||||
SUPPORT_TARGET_TEMPERATURE, SUPPORT_OPERATION_MODE,
|
SUPPORT_TARGET_TEMPERATURE, SUPPORT_OPERATION_MODE,
|
||||||
SUPPORT_FAN_MODE, SUPPORT_AWAY_MODE, SUPPORT_SWING_MODE,
|
SUPPORT_FAN_MODE, SUPPORT_SWING_MODE,
|
||||||
SUPPORT_AUX_HEAT)
|
SUPPORT_AUX_HEAT)
|
||||||
from homeassistant.exceptions import PlatformNotReady
|
from homeassistant.exceptions import PlatformNotReady
|
||||||
from homeassistant.helpers import config_validation as cv
|
from homeassistant.helpers import config_validation as cv
|
||||||
@ -41,9 +42,13 @@ _FETCH_FIELDS = ','.join([
|
|||||||
'acState', 'connectionStatus{isAlive}', 'temperatureUnit'])
|
'acState', 'connectionStatus{isAlive}', 'temperatureUnit'])
|
||||||
_INITIAL_FETCH_FIELDS = 'id,' + _FETCH_FIELDS
|
_INITIAL_FETCH_FIELDS = 'id,' + _FETCH_FIELDS
|
||||||
|
|
||||||
SUPPORT_FLAGS = (SUPPORT_TARGET_TEMPERATURE | SUPPORT_OPERATION_MODE |
|
FIELD_TO_FLAG = {
|
||||||
SUPPORT_FAN_MODE | SUPPORT_AWAY_MODE | SUPPORT_SWING_MODE |
|
'fanLevel': SUPPORT_FAN_MODE,
|
||||||
SUPPORT_AUX_HEAT)
|
'mode': SUPPORT_OPERATION_MODE,
|
||||||
|
'swing': SUPPORT_SWING_MODE,
|
||||||
|
'targetTemperature': SUPPORT_TARGET_TEMPERATURE,
|
||||||
|
'on': SUPPORT_AUX_HEAT,
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@asyncio.coroutine
|
@asyncio.coroutine
|
||||||
@ -85,7 +90,14 @@ class SensiboClimate(ClimateDevice):
|
|||||||
@property
|
@property
|
||||||
def supported_features(self):
|
def supported_features(self):
|
||||||
"""Return the list of supported features."""
|
"""Return the list of supported features."""
|
||||||
return SUPPORT_FLAGS
|
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):
|
def _do_update(self, data):
|
||||||
self._name = data['room']['name']
|
self._name = data['room']['name']
|
||||||
@ -106,6 +118,10 @@ class SensiboClimate(ClimateDevice):
|
|||||||
else:
|
else:
|
||||||
self._temperature_unit = self.unit_of_measurement
|
self._temperature_unit = self.unit_of_measurement
|
||||||
self._temperatures_list = []
|
self._temperatures_list = []
|
||||||
|
self._supported_features = 0
|
||||||
|
for key in self._ac_states:
|
||||||
|
if key in FIELD_TO_FLAG:
|
||||||
|
self._supported_features |= FIELD_TO_FLAG[key]
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def device_state_attributes(self):
|
def device_state_attributes(self):
|
||||||
@ -196,13 +212,13 @@ class SensiboClimate(ClimateDevice):
|
|||||||
def min_temp(self):
|
def min_temp(self):
|
||||||
"""Return the minimum temperature."""
|
"""Return the minimum temperature."""
|
||||||
return self._temperatures_list[0] \
|
return self._temperatures_list[0] \
|
||||||
if len(self._temperatures_list) else super.min_temp()
|
if len(self._temperatures_list) else super().min_temp()
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def max_temp(self):
|
def max_temp(self):
|
||||||
"""Return the maximum temperature."""
|
"""Return the maximum temperature."""
|
||||||
return self._temperatures_list[-1] \
|
return self._temperatures_list[-1] \
|
||||||
if len(self._temperatures_list) else super.max_temp()
|
if len(self._temperatures_list) else super().max_temp()
|
||||||
|
|
||||||
@asyncio.coroutine
|
@asyncio.coroutine
|
||||||
def async_set_temperature(self, **kwargs):
|
def async_set_temperature(self, **kwargs):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user