Raise ConditionError for numeric_state errors (#45923)
This commit is contained in:
parent
9e07910ab0
commit
b9b1caf4d7
10 changed files with 352 additions and 63 deletions
|
@ -17,7 +17,7 @@ from homeassistant.const import (
|
|||
STATE_UNKNOWN,
|
||||
)
|
||||
from homeassistant.core import callback
|
||||
from homeassistant.exceptions import TemplateError
|
||||
from homeassistant.exceptions import ConditionError, TemplateError
|
||||
from homeassistant.helpers import condition
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.event import (
|
||||
|
@ -340,14 +340,17 @@ class BayesianBinarySensor(BinarySensorEntity):
|
|||
"""Return True if numeric condition is met."""
|
||||
entity = entity_observation["entity_id"]
|
||||
|
||||
return condition.async_numeric_state(
|
||||
self.hass,
|
||||
entity,
|
||||
entity_observation.get("below"),
|
||||
entity_observation.get("above"),
|
||||
None,
|
||||
entity_observation,
|
||||
)
|
||||
try:
|
||||
return condition.async_numeric_state(
|
||||
self.hass,
|
||||
entity,
|
||||
entity_observation.get("below"),
|
||||
entity_observation.get("above"),
|
||||
None,
|
||||
entity_observation,
|
||||
)
|
||||
except ConditionError:
|
||||
return False
|
||||
|
||||
def _process_state(self, entity_observation):
|
||||
"""Return True if state conditions are met."""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue