From b49a672fd5e0bbe7475864f55c30cebb97fe1b78 Mon Sep 17 00:00:00 2001 From: Anders Melchiorsen Date: Thu, 4 Mar 2021 21:47:24 +0100 Subject: [PATCH] Catch ConditionError in generic_thermostat climate (#47359) --- .../components/generic_thermostat/climate.py | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/homeassistant/components/generic_thermostat/climate.py b/homeassistant/components/generic_thermostat/climate.py index 5fbdf499146..7062267de19 100644 --- a/homeassistant/components/generic_thermostat/climate.py +++ b/homeassistant/components/generic_thermostat/climate.py @@ -35,6 +35,7 @@ from homeassistant.const import ( STATE_UNKNOWN, ) from homeassistant.core import DOMAIN as HA_DOMAIN, CoreState, callback +from homeassistant.exceptions import ConditionError from homeassistant.helpers import condition import homeassistant.helpers.config_validation as cv from homeassistant.helpers.event import ( @@ -439,12 +440,16 @@ class GenericThermostat(ClimateEntity, RestoreEntity): current_state = STATE_ON else: current_state = HVAC_MODE_OFF - long_enough = condition.state( - self.hass, - self.heater_entity_id, - current_state, - self.min_cycle_duration, - ) + try: + long_enough = condition.state( + self.hass, + self.heater_entity_id, + current_state, + self.min_cycle_duration, + ) + except ConditionError: + long_enough = False + if not long_enough: return