1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-24 21:06:19 +00:00

Allow input_number entity_id as for numeric_state trigger thresholds (#45091)

* Allow input_number as limits for numeric_state trigger

* Rename threshold schema
This commit is contained in:
Alexei Chetroi
2021-01-13 10:20:59 -05:00
committed by GitHub
parent 83b210061d
commit de8f273bd0
3 changed files with 344 additions and 111 deletions

View File

@@ -916,18 +916,18 @@ SERVICE_SCHEMA = vol.All(
has_at_least_one_key(CONF_SERVICE, CONF_SERVICE_TEMPLATE),
)
NUMERIC_STATE_THRESHOLD_SCHEMA = vol.Any(
vol.Coerce(float), vol.All(str, entity_domain("input_number"))
)
NUMERIC_STATE_CONDITION_SCHEMA = vol.All(
vol.Schema(
{
vol.Required(CONF_CONDITION): "numeric_state",
vol.Required(CONF_ENTITY_ID): entity_ids,
vol.Optional(CONF_ATTRIBUTE): str,
CONF_BELOW: vol.Any(
vol.Coerce(float), vol.All(str, entity_domain("input_number"))
),
CONF_ABOVE: vol.Any(
vol.Coerce(float), vol.All(str, entity_domain("input_number"))
),
CONF_BELOW: NUMERIC_STATE_THRESHOLD_SCHEMA,
CONF_ABOVE: NUMERIC_STATE_THRESHOLD_SCHEMA,
vol.Optional(CONF_VALUE_TEMPLATE): template,
}
),