1
0
mirror of https://github.com/esphome/esphome.git synced 2025-03-15 07:08:20 +00:00

fixes remove duplicate line

remove threshold settings
This commit is contained in:
Michiel van Turnhout 2019-05-27 21:16:41 +02:00
parent b15fbae7f2
commit 81d4988ca6

View File

@ -20,16 +20,12 @@ CONFIG_SCHEMA = binary_sensor.BINARY_SENSOR_SCHEMA.extend({
def to_code(config): def to_code(config):
var = cg.new_Pvariable(config[CONF_ID]) var = cg.new_Pvariable(config[CONF_ID])
yield binary_sensor.register_binary_sensor(var, config) yield binary_sensor.register_binary_sensor(var, config)
hub = yield cg.get_variable(config[CONF_MPR121_ID])
hub = yield cg.get_variable(config[CONF_MPR121_ID]) hub = yield cg.get_variable(config[CONF_MPR121_ID])
cg.add(var.set_channel(config[CONF_CHANNEL])) cg.add(var.set_channel(config[CONF_CHANNEL]))
if CONF_TOUCH_THRESHOLD in config: if CONF_TOUCH_THRESHOLD in config:
cg.add(var.set_touch_threshold(config[CONF_TOUCH_THRESHOLD])) cg.add(var.set_touch_threshold(config[CONF_TOUCH_THRESHOLD]))
else:
cg.add(var.set_touch_threshold(hub.get_touch_threshold()))
if CONF_RELEASE_THRESHOLD in config: if CONF_RELEASE_THRESHOLD in config:
cg.add(var.set_release_threshold(config[CONF_RELEASE_THRESHOLD])) cg.add(var.set_release_threshold(config[CONF_RELEASE_THRESHOLD]))
else:
cg.add(var.set_release_threshold(hub.get_release_threshold()))
cg.add(hub.register_channel(var)) cg.add(hub.register_channel(var))