1
0
mirror of https://github.com/esphome/esphome.git synced 2025-10-02 01:52:21 +01:00

add SUB_BUTTON macro and ability to button schema to define the class (#4450)

* add ability to button schema to define the class

* add SUB_BUTTON macro
This commit is contained in:
Regev Brody
2023-02-19 21:54:03 +02:00
committed by GitHub
parent e68beb8a43
commit 72391389a3
7 changed files with 28 additions and 24 deletions

View File

@@ -13,15 +13,12 @@ FactoryResetButton = factory_reset_ns.class_(
"FactoryResetButton", button.Button, cg.Component
)
CONFIG_SCHEMA = (
button.button_schema(
device_class=DEVICE_CLASS_RESTART,
entity_category=ENTITY_CATEGORY_CONFIG,
icon=ICON_RESTART_ALERT,
)
.extend({cv.GenerateID(): cv.declare_id(FactoryResetButton)})
.extend(cv.COMPONENT_SCHEMA)
)
CONFIG_SCHEMA = button.button_schema(
FactoryResetButton,
device_class=DEVICE_CLASS_RESTART,
entity_category=ENTITY_CATEGORY_CONFIG,
icon=ICON_RESTART_ALERT,
).extend(cv.COMPONENT_SCHEMA)
async def to_code(config):