1
0
mirror of https://github.com/esphome/esphome.git synced 2025-10-29 22:24:26 +00:00

add SUB_NUMBER macro and schema to number (#4449)

* add SUB_NUMBER macro and schema

* add SUB_NUMBER macro and schema

* add SUB_NUMBER macro and schema
This commit is contained in:
Regev Brody
2023-02-19 21:54:00 +02:00
committed by GitHub
parent 40e2832e67
commit e68beb8a43
7 changed files with 77 additions and 18 deletions

View File

@@ -46,9 +46,9 @@ def validate(config):
CONFIG_SCHEMA = cv.All(
number.NUMBER_SCHEMA.extend(
number.number_schema(TemplateNumber)
.extend(
{
cv.GenerateID(): cv.declare_id(TemplateNumber),
cv.Required(CONF_MAX_VALUE): cv.float_,
cv.Required(CONF_MIN_VALUE): cv.float_,
cv.Required(CONF_STEP): cv.positive_float,
@@ -58,7 +58,8 @@ CONFIG_SCHEMA = cv.All(
cv.Optional(CONF_INITIAL_VALUE): cv.float_,
cv.Optional(CONF_RESTORE_VALUE): cv.boolean,
}
).extend(cv.polling_component_schema("60s")),
)
.extend(cv.polling_component_schema("60s")),
validate_min_max,
validate,
)