1
0
mirror of https://github.com/esphome/esphome.git synced 2025-09-25 22:52:20 +01:00

Binary Sensor codegen tidyup (#3217)

This commit is contained in:
Jesse Hills
2022-02-18 10:39:59 +13:00
committed by GitHub
parent 3b8bb09ae3
commit 7a242bb4ed
38 changed files with 196 additions and 222 deletions

View File

@@ -137,13 +137,14 @@ _UNDEF = object()
def text_sensor_schema(
klass: MockObjClass = _UNDEF,
class_: MockObjClass = _UNDEF,
*,
icon: str = _UNDEF,
entity_category: str = _UNDEF,
) -> cv.Schema:
schema = TEXT_SENSOR_SCHEMA
if klass is not _UNDEF:
schema = schema.extend({cv.GenerateID(): cv.declare_id(klass)})
if class_ is not _UNDEF:
schema = schema.extend({cv.GenerateID(): cv.declare_id(class_)})
if icon is not _UNDEF:
schema = schema.extend({cv.Optional(CONF_ICON, default=icon): cv.icon})
if entity_category is not _UNDEF: