Update esphome/components/lps22/sensor.py

Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com>
This commit is contained in:
Simonas Kazlauskas 2024-10-15 17:08:16 +03:00 committed by GitHub
parent 125a27a158
commit ff66c43d37
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -49,8 +49,8 @@ async def to_code(config):
await cg.register_component(var, config)
await i2c.register_i2c_device(var, config)
if CONF_TEMPERATURE in config:
sens = await sensor.new_sensor(config[CONF_TEMPERATURE])
if temperature_config := config.get(CONF_TEMPERATURE):
sens = await sensor.new_sensor(temperature_config)
cg.add(var.set_temperature_sensor(sens))
if pressure_config := config.get(CONF_PRESSURE):