mirror of
https://github.com/Threnklyn/esphome-dev.git
synced 2026-06-03 19:38:30 +02:00
Update components "if x in config" (#5181)
This commit is contained in:
@@ -87,6 +87,6 @@ async def to_code(config):
|
||||
(CONF_MOISTURE, var.set_soil_moisture),
|
||||
(CONF_ILLUMINANCE, var.set_illuminance),
|
||||
]:
|
||||
if config_key in config:
|
||||
sens = await sensor.new_sensor(config[config_key])
|
||||
if sensor_config := config.get(config_key):
|
||||
sens = await sensor.new_sensor(sensor_config)
|
||||
cg.add(setter(sens))
|
||||
|
||||
Reference in New Issue
Block a user