1
0
mirror of https://github.com/esphome/esphome.git synced 2025-03-14 14:48:18 +00:00

fixed issues with code

This commit is contained in:
mvturnho 2019-05-26 11:08:52 +02:00
parent 9516fa0b63
commit 20c0d788d1
4 changed files with 12 additions and 10 deletions

View File

@ -1,7 +1,8 @@
import esphome.codegen as cg
import esphome.config_validation as cv
from esphome.components import i2c
from esphome.const import CONF_ID, CONF_RELEASE_DEBOUNCE, CONF_TOUCH_DEBOUNCE, \
from esphome.const import CONF_ID
from init import CONF_RELEASE_DEBOUNCE, CONF_TOUCH_DEBOUNCE, \
CONF_TOUCH_THRESHOLD, CONF_RELEASE_THRESHOLD
DEPENDENCIES = ['i2c']
@ -14,10 +15,10 @@ MPR121Component = mpr121_ns.class_('MPR121Component', cg.Component, i2c.I2CDevic
MULTI_CONF = True
CONFIG_SCHEMA = cv.Schema({
cv.GenerateID(): cv.declare_id(MPR121Component),
cv.Optional(CONF_RELEASE_DEBOUNCE): cv.int_range(min=0, max=7),
cv.Optional(CONF_TOUCH_DEBOUNCE): cv.All(cv.Coerce(int), cv.Range(min=0, max=7)),
cv.Optional(CONF_TOUCH_THRESHOLD): cv.All(cv.Coerce(int), cv.Range(min=0x05, max=0x30)),
cv.Optional(CONF_RELEASE_THRESHOLD): cv.All(cv.Coerce(int), cv.Range(min=0x05, max=0x30)),
cv.Optional(CONF_RELEASE_DEBOUNCE, default=0): cv.int_range(min=0, max=7),
cv.Optional(CONF_TOUCH_DEBOUNCE, default=0): cv.All(cv.Coerce(int), cv.Range(min=0, max=7)),
cv.Optional(CONF_TOUCH_THRESHOLD, default=0x06): cv.All(cv.Coerce(int), cv.Range(min=0x05, max=0x30)),
cv.Optional(CONF_RELEASE_THRESHOLD, default=0x0b): cv.All(cv.Coerce(int), cv.Range(min=0x05, max=0x30)),
}).extend(cv.COMPONENT_SCHEMA).extend(i2c.i2c_device_schema(0x5A))

View File

@ -1,7 +1,8 @@
import esphome.codegen as cg
import esphome.config_validation as cv
from esphome.components import binary_sensor
from esphome.const import CONF_CHANNEL, CONF_ID, CONF_TOUCH_THRESHOLD, CONF_RELEASE_THRESHOLD
from esphome.const import CONF_ID, CONF_CHANNEL
from init import CONF_TOUCH_THRESHOLD, CONF_RELEASE_THRESHOLD
from . import mpr121_ns, MPR121Component, CONF_MPR121_ID
DEPENDENCIES = ['mpr121']

View File

@ -0,0 +1,4 @@
CONF_TOUCH_THRESHOLD = "touch_threshold"
CONF_RELEASE_THRESHOLD = "release_threshold"
CONF_TOUCH_DEBOUNCE = "touch_debounce"
CONF_RELEASE_DEBOUNCE = "release_debounce"

View File

@ -448,10 +448,6 @@ CONF_WIFI = 'wifi'
CONF_WILL_MESSAGE = 'will_message'
CONF_WINDOW_SIZE = 'window_size'
CONF_ZERO = 'zero'
CONF_TOUCH_THRESHOLD = "touch_threshold"
CONF_RELEASE_THRESHOLD = "release_threshold"
CONF_TOUCH_DEBOUNCE = "touch_debounce"
CONF_RELEASE_DEBOUNCE = "release_debounce"
ICON_ARROW_EXPAND_VERTICAL = 'mdi:arrow-expand-vertical'
ICON_BATTERY = 'mdi:battery'