mirror of
https://github.com/esphome/esphome.git
synced 2025-09-26 23:22:21 +01:00
Clean up
This commit is contained in:
@@ -1,8 +1,7 @@
|
||||
import esphome.codegen as cg
|
||||
import esphome.config_validation as cv
|
||||
from esphome.components import i2c, sensor
|
||||
from esphome.const import CONF_ID, CONF_TEMPERATURE, \
|
||||
ICON_THERMOMETER, UNIT_CELSIUS
|
||||
from esphome.const import CONF_ID, CONF_TEMPERATURE, ICON_THERMOMETER, UNIT_CELSIUS
|
||||
|
||||
DEPENDENCIES = ['i2c']
|
||||
|
||||
@@ -19,7 +18,6 @@ def to_code(config):
|
||||
var = cg.new_Pvariable(config[CONF_ID])
|
||||
yield cg.register_component(var, config)
|
||||
yield i2c.register_i2c_device(var, config)
|
||||
sens = yield sensor.new_sensor(config[CONF_TEMPERATURE])
|
||||
|
||||
if CONF_TEMPERATURE in config:
|
||||
sens = yield sensor.new_sensor(config[CONF_TEMPERATURE])
|
||||
cg.add(var.set_temperature_sensor(sens))
|
||||
cg.add(var.set_temperature_sensor(sens))
|
||||
|
Reference in New Issue
Block a user