mirror of
https://github.com/esphome/esphome.git
synced 2025-09-11 15:52:20 +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:
@@ -10,13 +10,11 @@ from esphome.const import (
|
||||
restart_ns = cg.esphome_ns.namespace("restart")
|
||||
RestartButton = restart_ns.class_("RestartButton", button.Button, cg.Component)
|
||||
|
||||
CONFIG_SCHEMA = (
|
||||
button.button_schema(
|
||||
device_class=DEVICE_CLASS_RESTART, entity_category=ENTITY_CATEGORY_CONFIG
|
||||
)
|
||||
.extend({cv.GenerateID(): cv.declare_id(RestartButton)})
|
||||
.extend(cv.COMPONENT_SCHEMA)
|
||||
)
|
||||
CONFIG_SCHEMA = button.button_schema(
|
||||
RestartButton,
|
||||
device_class=DEVICE_CLASS_RESTART,
|
||||
entity_category=ENTITY_CATEGORY_CONFIG,
|
||||
).extend(cv.COMPONENT_SCHEMA)
|
||||
|
||||
|
||||
async def to_code(config):
|
||||
|
Reference in New Issue
Block a user