1
0
mirror of https://github.com/esphome/esphome.git synced 2025-09-02 11:22:24 +01:00

[text_sensor] Add support for default filters (#9936)

This commit is contained in:
Keith Burzinski
2025-07-28 18:35:40 -05:00
committed by GitHub
parent 908891a096
commit f5f0a01a85

View File

@@ -162,6 +162,7 @@ def text_sensor_schema(
device_class: str = cv.UNDEFINED,
entity_category: str = cv.UNDEFINED,
icon: str = cv.UNDEFINED,
filters: list = cv.UNDEFINED,
) -> cv.Schema:
schema = {}
@@ -172,6 +173,7 @@ def text_sensor_schema(
(CONF_ICON, icon, cv.icon),
(CONF_DEVICE_CLASS, device_class, validate_device_class),
(CONF_ENTITY_CATEGORY, entity_category, cv.entity_category),
(CONF_FILTERS, filters, validate_filters),
]:
if default is not cv.UNDEFINED:
schema[cv.Optional(key, default=default)] = validator