[sht3xd] Use the sub_* helpers for optional child entities (#20031)

This commit is contained in:
J. Nick Koston
2026-10-02 12:29:09 -04:00
committed by GitHub
parent 995109aa4f
commit 2d286031a4
+3 -7
View File
@@ -56,10 +56,6 @@ async def to_code(config: ConfigType) -> None:
cg.add(var.set_heater_enabled(config[CONF_HEATER_ENABLED]))
if CONF_TEMPERATURE in config:
sens = await sensor.new_sensor(config[CONF_TEMPERATURE])
cg.add(var.set_temperature_sensor(sens))
if CONF_HUMIDITY in config:
sens = await sensor.new_sensor(config[CONF_HUMIDITY])
cg.add(var.set_humidity_sensor(sens))
sensors = sensor.sub_sensors(config)
await sensors(CONF_TEMPERATURE, var.set_temperature_sensor)
await sensors(CONF_HUMIDITY, var.set_humidity_sensor)