1
0
mirror of https://github.com/esphome/esphome.git synced 2025-10-30 06:33:51 +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

@@ -15,12 +15,15 @@ from .. import copy_ns
CopyNumber = copy_ns.class_("CopyNumber", number.Number, cg.Component)
CONFIG_SCHEMA = number.NUMBER_SCHEMA.extend(
{
cv.GenerateID(): cv.declare_id(CopyNumber),
cv.Required(CONF_SOURCE_ID): cv.use_id(number.Number),
}
).extend(cv.COMPONENT_SCHEMA)
CONFIG_SCHEMA = (
number.number_schema(CopyNumber)
.extend(
{
cv.Required(CONF_SOURCE_ID): cv.use_id(number.Number),
}
)
.extend(cv.COMPONENT_SCHEMA)
)
FINAL_VALIDATE_SCHEMA = cv.All(
inherit_property_from(CONF_ICON, CONF_SOURCE_ID),