mirror of
https://github.com/Threnklyn/esphome-dev.git
synced 2026-05-24 14:48:29 +02:00
Update components "if x in config" (#5181)
This commit is contained in:
@@ -21,9 +21,8 @@ CONFIG_SCHEMA = cv.Schema(
|
||||
|
||||
|
||||
async def setup_conf(config, key, hub):
|
||||
if key in config:
|
||||
conf = config[key]
|
||||
sens = await text_sensor.new_text_sensor(conf)
|
||||
if sensor_config := config.get(key):
|
||||
sens = await text_sensor.new_text_sensor(sensor_config)
|
||||
cg.add(getattr(hub, f"set_{key}_text_sensor")(sens))
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user