Fix mysensors climate supported features (#15110)

This commit is contained in:
Martin Hjelmare 2018-06-25 19:06:12 +02:00 committed by Paulus Schoutsen
parent 9dd2c36de4
commit b2d37ccef6

View File

@ -26,9 +26,8 @@ DICT_MYS_TO_HA = {
'Off': STATE_OFF, 'Off': STATE_OFF,
} }
SUPPORT_FLAGS = (SUPPORT_TARGET_TEMPERATURE | SUPPORT_TARGET_TEMPERATURE_HIGH | FAN_LIST = ['Auto', 'Min', 'Normal', 'Max']
SUPPORT_TARGET_TEMPERATURE_LOW | SUPPORT_FAN_MODE | OPERATION_LIST = [STATE_OFF, STATE_AUTO, STATE_COOL, STATE_HEAT]
SUPPORT_OPERATION_MODE)
async def async_setup_platform( async def async_setup_platform(
@ -45,7 +44,18 @@ class MySensorsHVAC(mysensors.device.MySensorsEntity, 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 features = SUPPORT_OPERATION_MODE
set_req = self.gateway.const.SetReq
if set_req.V_HVAC_SPEED in self._values:
features = features | SUPPORT_FAN_MODE
if (set_req.V_HVAC_SETPOINT_COOL in self._values and
set_req.V_HVAC_SETPOINT_HEAT in self._values):
features = (
features | SUPPORT_TARGET_TEMPERATURE_HIGH |
SUPPORT_TARGET_TEMPERATURE_LOW)
else:
features = features | SUPPORT_TARGET_TEMPERATURE
return features
@property @property
def assumed_state(self): def assumed_state(self):
@ -103,7 +113,7 @@ class MySensorsHVAC(mysensors.device.MySensorsEntity, ClimateDevice):
@property @property
def operation_list(self): def operation_list(self):
"""List of available operation modes.""" """List of available operation modes."""
return [STATE_OFF, STATE_AUTO, STATE_COOL, STATE_HEAT] return OPERATION_LIST
@property @property
def current_fan_mode(self): def current_fan_mode(self):
@ -113,7 +123,7 @@ class MySensorsHVAC(mysensors.device.MySensorsEntity, ClimateDevice):
@property @property
def fan_list(self): def fan_list(self):
"""List of available fan modes.""" """List of available fan modes."""
return ['Auto', 'Min', 'Normal', 'Max'] return FAN_LIST
async def async_set_temperature(self, **kwargs): async def async_set_temperature(self, **kwargs):
"""Set new target temperature.""" """Set new target temperature."""