Fix fritzbox climate HVAC mode / temperature (#25275)

* Set the target temperature

* Update tests

* Update tests

* Fix linter complaints
This commit is contained in:
cgtobi 2019-07-19 09:49:28 +02:00 committed by Pascal Vizeli
parent bc7e1a3797
commit 1eb66f3657
2 changed files with 11 additions and 7 deletions

View file

@ -93,9 +93,10 @@ class FritzboxThermostat(ClimateDevice):
@property
def target_temperature(self):
"""Return the temperature we try to reach."""
if self._target_temperature in (ON_API_TEMPERATURE,
OFF_API_TEMPERATURE):
return None
if self._target_temperature == ON_API_TEMPERATURE:
return ON_REPORT_SET_TEMPERATURE
if self._target_temperature == OFF_API_TEMPERATURE:
return OFF_REPORT_SET_TEMPERATURE
return self._target_temperature
def set_temperature(self, **kwargs):
@ -110,7 +111,10 @@ class FritzboxThermostat(ClimateDevice):
@property
def hvac_mode(self):
"""Return the current operation mode."""
if self._target_temperature == OFF_REPORT_SET_TEMPERATURE:
if (
self._target_temperature == OFF_REPORT_SET_TEMPERATURE or
self._target_temperature == OFF_API_TEMPERATURE
):
return HVAC_MODE_OFF
return HVAC_MODE_HEAT