[schema] generator fixes (#15276)

This commit is contained in:
Guillermo Ruffino
2026-03-31 13:08:50 +13:00
committed by GitHub
parent 53b2a03c80
commit ef65e47bc5
3 changed files with 151 additions and 63 deletions
+4
View File
@@ -113,6 +113,7 @@ from esphome.core.entity_helpers import (
setup_unit_of_measurement,
)
from esphome.cpp_generator import MockObj, MockObjClass
from esphome.schema_extractors import SCHEMA_EXTRACT, schema_extractor
from esphome.util import Registry
CODEOWNERS = ["@esphome/core"]
@@ -229,7 +230,10 @@ _SENSOR_ENTITY_CATEGORIES = {
}
@schema_extractor("enum")
def sensor_entity_category(value):
if value == SCHEMA_EXTRACT:
return _SENSOR_ENTITY_CATEGORIES
return cv.enum(_SENSOR_ENTITY_CATEGORIES, lower=True)(value)