diff --git a/homeassistant/components/climate/generic_thermostat.py b/homeassistant/components/climate/generic_thermostat.py index ba4973aea9e..7436053b7d4 100644 --- a/homeassistant/components/climate/generic_thermostat.py +++ b/homeassistant/components/climate/generic_thermostat.py @@ -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