mirror of
https://github.com/esphome/esphome.git
synced 2025-10-02 10:02:23 +01:00
Add Entity categories for Home Assistant (#2636)
This commit is contained in:
@@ -1,7 +1,14 @@
|
||||
import esphome.codegen as cg
|
||||
import esphome.config_validation as cv
|
||||
from esphome.components import switch
|
||||
from esphome.const import CONF_ID, CONF_INVERTED, CONF_ICON, ICON_POWER
|
||||
from esphome.const import (
|
||||
CONF_ENTITY_CATEGORY,
|
||||
CONF_ID,
|
||||
CONF_INVERTED,
|
||||
CONF_ICON,
|
||||
ENTITY_CATEGORY_CONFIG,
|
||||
ICON_POWER,
|
||||
)
|
||||
|
||||
shutdown_ns = cg.esphome_ns.namespace("shutdown")
|
||||
ShutdownSwitch = shutdown_ns.class_("ShutdownSwitch", switch.Switch, cg.Component)
|
||||
@@ -13,6 +20,9 @@ CONFIG_SCHEMA = switch.SWITCH_SCHEMA.extend(
|
||||
"Shutdown switches do not support inverted mode!"
|
||||
),
|
||||
cv.Optional(CONF_ICON, default=ICON_POWER): switch.icon,
|
||||
cv.Optional(
|
||||
CONF_ENTITY_CATEGORY, default=ENTITY_CATEGORY_CONFIG
|
||||
): cv.entity_category,
|
||||
}
|
||||
).extend(cv.COMPONENT_SCHEMA)
|
||||
|
||||
|
Reference in New Issue
Block a user