Fixes away_mode error on startup (#12121)
* Fixes away_mode error on startup * Updated based on feedbackpull/12148/head
parent
30ad591a59
commit
6d5a87afb6
|
@ -156,7 +156,7 @@ class GenericThermostat(ClimateDevice):
|
||||||
# If we have no initial temperature, restore
|
# If we have no initial temperature, restore
|
||||||
if self._target_temp is None:
|
if self._target_temp is None:
|
||||||
# If we have a previously saved temperature
|
# If we have a previously saved temperature
|
||||||
if old_state.attributes[ATTR_TEMPERATURE] is None:
|
if old_state.attributes.get(ATTR_TEMPERATURE) is None:
|
||||||
if self.ac_mode:
|
if self.ac_mode:
|
||||||
self._target_temp = self.max_temp
|
self._target_temp = self.max_temp
|
||||||
else:
|
else:
|
||||||
|
@ -166,7 +166,7 @@ class GenericThermostat(ClimateDevice):
|
||||||
else:
|
else:
|
||||||
self._target_temp = float(
|
self._target_temp = float(
|
||||||
old_state.attributes[ATTR_TEMPERATURE])
|
old_state.attributes[ATTR_TEMPERATURE])
|
||||||
if old_state.attributes[ATTR_AWAY_MODE] is not None:
|
if old_state.attributes.get(ATTR_AWAY_MODE) is not None:
|
||||||
self._is_away = str(
|
self._is_away = str(
|
||||||
old_state.attributes[ATTR_AWAY_MODE]) == STATE_ON
|
old_state.attributes[ATTR_AWAY_MODE]) == STATE_ON
|
||||||
if (self._initial_operation_mode is None and
|
if (self._initial_operation_mode is None and
|
||||||
|
|
Loading…
Reference in New Issue