Fix numeric_state condition spamming on unavailable (#12550)
This commit is contained in:
parent
7829e61361
commit
3077444d62
2 changed files with 22 additions and 1 deletions
|
@ -13,7 +13,7 @@ from homeassistant.const import (
|
|||
CONF_ENTITY_ID, CONF_VALUE_TEMPLATE, CONF_CONDITION,
|
||||
WEEKDAYS, CONF_STATE, CONF_ZONE, CONF_BEFORE,
|
||||
CONF_AFTER, CONF_WEEKDAY, SUN_EVENT_SUNRISE, SUN_EVENT_SUNSET,
|
||||
CONF_BELOW, CONF_ABOVE)
|
||||
CONF_BELOW, CONF_ABOVE, STATE_UNAVAILABLE, STATE_UNKNOWN)
|
||||
from homeassistant.exceptions import TemplateError, HomeAssistantError
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.sun import get_astral_event_date
|
||||
|
@ -160,6 +160,9 @@ def async_numeric_state(hass: HomeAssistant, entity, below=None, above=None,
|
|||
_LOGGER.error("Template error: %s", ex)
|
||||
return False
|
||||
|
||||
if value in (STATE_UNAVAILABLE, STATE_UNKNOWN):
|
||||
return False
|
||||
|
||||
try:
|
||||
value = float(value)
|
||||
except ValueError:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue