Fix TypeError in current_temperature if no temperature is known. (#22112)

Don't set opentherm_gw climate temperatures to 0 on init.
pull/22121/head
mvn23 2019-03-16 16:34:31 +01:00 committed by Daniel Høyer Iversen
parent c90f0d5bd6
commit 4423572682
1 changed files with 4 additions and 2 deletions

View File

@ -37,8 +37,8 @@ class OpenThermGateway(ClimateDevice):
self.floor_temp = config.get(CONF_FLOOR_TEMP)
self.temp_precision = config.get(CONF_PRECISION)
self._current_operation = STATE_IDLE
self._current_temperature = 0.0
self._target_temperature = 0.0
self._current_temperature = None
self._target_temperature = None
self._away_mode_a = None
self._away_mode_b = None
self._away_state_a = False
@ -124,6 +124,8 @@ class OpenThermGateway(ClimateDevice):
@property
def current_temperature(self):
"""Return the current temperature."""
if self._current_temperature is None:
return
if self.floor_temp is True:
if self.temp_precision == PRECISION_HALVES:
return int(2 * self._current_temperature) / 2