1
0
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:
Jesse Hills
2021-11-08 07:24:52 +13:00
committed by GitHub
parent b450d4c734
commit 3c0414c420
45 changed files with 354 additions and 14 deletions

View File

@@ -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)