mirror of
https://github.com/esphome/esphome.git
synced 2025-11-19 08:15:49 +00:00
28
esphome/components/cst816/binary_sensor/__init__.py
Normal file
28
esphome/components/cst816/binary_sensor/__init__.py
Normal file
@@ -0,0 +1,28 @@
|
||||
import esphome.codegen as cg
|
||||
import esphome.config_validation as cv
|
||||
from esphome.components import binary_sensor
|
||||
|
||||
from .. import cst816_ns
|
||||
from ..touchscreen import CST816Touchscreen, CST816ButtonListener
|
||||
|
||||
CONF_CST816_ID = "cst816_id"
|
||||
|
||||
CST816Button = cst816_ns.class_(
|
||||
"CST816Button",
|
||||
binary_sensor.BinarySensor,
|
||||
cg.Component,
|
||||
CST816ButtonListener,
|
||||
cg.Parented.template(CST816Touchscreen),
|
||||
)
|
||||
|
||||
CONFIG_SCHEMA = binary_sensor.binary_sensor_schema(CST816Button).extend(
|
||||
{
|
||||
cv.GenerateID(CONF_CST816_ID): cv.use_id(CST816Touchscreen),
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
async def to_code(config):
|
||||
var = await binary_sensor.new_binary_sensor(config)
|
||||
await cg.register_component(var, config)
|
||||
await cg.register_parented(var, config[CONF_CST816_ID])
|
||||
Reference in New Issue
Block a user