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 self._target_temp is None:
|
||||
# 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:
|
||||
self._target_temp = self.max_temp
|
||||
else:
|
||||
|
@ -166,7 +166,7 @@ class GenericThermostat(ClimateDevice):
|
|||
else:
|
||||
self._target_temp = float(
|
||||
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(
|
||||
old_state.attributes[ATTR_AWAY_MODE]) == STATE_ON
|
||||
if (self._initial_operation_mode is None and
|
||||
|
|
Loading…
Reference in New Issue