mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 11:17:21 +00:00
Catch ConditionError in generic_thermostat climate (#47359)
This commit is contained in:
parent
208a104e96
commit
b49a672fd5
@ -35,6 +35,7 @@ from homeassistant.const import (
|
|||||||
STATE_UNKNOWN,
|
STATE_UNKNOWN,
|
||||||
)
|
)
|
||||||
from homeassistant.core import DOMAIN as HA_DOMAIN, CoreState, callback
|
from homeassistant.core import DOMAIN as HA_DOMAIN, CoreState, callback
|
||||||
|
from homeassistant.exceptions import ConditionError
|
||||||
from homeassistant.helpers import condition
|
from homeassistant.helpers import condition
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
from homeassistant.helpers.event import (
|
from homeassistant.helpers.event import (
|
||||||
@ -439,12 +440,16 @@ class GenericThermostat(ClimateEntity, RestoreEntity):
|
|||||||
current_state = STATE_ON
|
current_state = STATE_ON
|
||||||
else:
|
else:
|
||||||
current_state = HVAC_MODE_OFF
|
current_state = HVAC_MODE_OFF
|
||||||
long_enough = condition.state(
|
try:
|
||||||
self.hass,
|
long_enough = condition.state(
|
||||||
self.heater_entity_id,
|
self.hass,
|
||||||
current_state,
|
self.heater_entity_id,
|
||||||
self.min_cycle_duration,
|
current_state,
|
||||||
)
|
self.min_cycle_duration,
|
||||||
|
)
|
||||||
|
except ConditionError:
|
||||||
|
long_enough = False
|
||||||
|
|
||||||
if not long_enough:
|
if not long_enough:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user