From 6d5a87afb65db1d60ed13477f8935bfbc6261430 Mon Sep 17 00:00:00 2001 From: Marius Date: Fri, 2 Feb 2018 10:05:19 +0200 Subject: [PATCH] Fixes away_mode error on startup (#12121) * Fixes away_mode error on startup * Updated based on feedback --- homeassistant/components/climate/generic_thermostat.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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