mirror of
https://github.com/esphome/esphome.git
synced 2024-11-10 09:17:46 +01:00
Allow on_value_range for sensor and number to be templated (#3359)
This commit is contained in:
parent
06f4ad922c
commit
ba8d255cb4
2 changed files with 4 additions and 4 deletions
|
@ -63,8 +63,8 @@ NUMBER_SCHEMA = cv.ENTITY_BASE_SCHEMA.extend(cv.MQTT_COMMAND_COMPONENT_SCHEMA).e
|
||||||
cv.Optional(CONF_ON_VALUE_RANGE): automation.validate_automation(
|
cv.Optional(CONF_ON_VALUE_RANGE): automation.validate_automation(
|
||||||
{
|
{
|
||||||
cv.GenerateID(CONF_TRIGGER_ID): cv.declare_id(ValueRangeTrigger),
|
cv.GenerateID(CONF_TRIGGER_ID): cv.declare_id(ValueRangeTrigger),
|
||||||
cv.Optional(CONF_ABOVE): cv.float_,
|
cv.Optional(CONF_ABOVE): cv.templatable(cv.float_),
|
||||||
cv.Optional(CONF_BELOW): cv.float_,
|
cv.Optional(CONF_BELOW): cv.templatable(cv.float_),
|
||||||
},
|
},
|
||||||
cv.has_at_least_one_key(CONF_ABOVE, CONF_BELOW),
|
cv.has_at_least_one_key(CONF_ABOVE, CONF_BELOW),
|
||||||
),
|
),
|
||||||
|
|
|
@ -212,8 +212,8 @@ SENSOR_SCHEMA = cv.ENTITY_BASE_SCHEMA.extend(cv.MQTT_COMPONENT_SCHEMA).extend(
|
||||||
cv.Optional(CONF_ON_VALUE_RANGE): automation.validate_automation(
|
cv.Optional(CONF_ON_VALUE_RANGE): automation.validate_automation(
|
||||||
{
|
{
|
||||||
cv.GenerateID(CONF_TRIGGER_ID): cv.declare_id(ValueRangeTrigger),
|
cv.GenerateID(CONF_TRIGGER_ID): cv.declare_id(ValueRangeTrigger),
|
||||||
cv.Optional(CONF_ABOVE): cv.float_,
|
cv.Optional(CONF_ABOVE): cv.templatable(cv.float_),
|
||||||
cv.Optional(CONF_BELOW): cv.float_,
|
cv.Optional(CONF_BELOW): cv.templatable(cv.float_),
|
||||||
},
|
},
|
||||||
cv.has_at_least_one_key(CONF_ABOVE, CONF_BELOW),
|
cv.has_at_least_one_key(CONF_ABOVE, CONF_BELOW),
|
||||||
),
|
),
|
||||||
|
|
Loading…
Reference in a new issue