You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
829 B
26 lines
829 B
import esphome.codegen as cg
|
|
import esphome.config_validation as cv
|
|
from esphome.components import i2c, sensor, output
|
|
from esphome.const import CONF_ID
|
|
|
|
DEPENDENCIES = ['i2c']
|
|
|
|
CONF_I2C_ADDR = 0x09
|
|
|
|
showcase_component_ns = cg.esphome_ns.namespace('showcase_component')
|
|
ShowcaseComponent = showcase_component_ns.class_('ShowcaseComponent', cg.Component, i2c.I2CDevice)
|
|
|
|
CONFIG_SCHEMA = cv.Schema(
|
|
{
|
|
cv.GenerateID(): cv.declare_id(ShowcaseComponent),
|
|
|
|
cv.Required(CONF_UPPER): cv.use_id(output.FloatOutput),
|
|
cv.Required(CONF_LOWER): cv.use_id(output.FloatOutput)
|
|
}
|
|
).extend(cv.COMPONENT_SCHEMA).extend(i2c.i2c_device_schema(CONF_I2C_ADDR))
|
|
|
|
def to_code(config):
|
|
var = cg.new_Pvariable(config[CONF_ID])
|
|
yield cg.register_component(var, config)
|
|
yield i2c.register_i2c_device(var, config)
|