1
0
mirror of https://github.com/esphome/esphome.git synced 2025-09-12 16:22:22 +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,13 @@
import esphome.codegen as cg
import esphome.config_validation as cv
from esphome.components import binary_sensor
from esphome.const import CONF_ID, CONF_DEVICE_CLASS, DEVICE_CLASS_CONNECTIVITY
from esphome.const import (
CONF_ENTITY_CATEGORY,
CONF_ID,
CONF_DEVICE_CLASS,
DEVICE_CLASS_CONNECTIVITY,
ENTITY_CATEGORY_DIAGNOSTIC,
)
status_ns = cg.esphome_ns.namespace("status")
StatusBinarySensor = status_ns.class_(
@@ -14,6 +20,9 @@ CONFIG_SCHEMA = binary_sensor.BINARY_SENSOR_SCHEMA.extend(
cv.Optional(
CONF_DEVICE_CLASS, default=DEVICE_CLASS_CONNECTIVITY
): binary_sensor.device_class,
cv.Optional(
CONF_ENTITY_CATEGORY, default=ENTITY_CATEGORY_DIAGNOSTIC
): cv.entity_category,
}
).extend(cv.COMPONENT_SCHEMA)