1
0
mirror of https://github.com/esphome/esphome.git synced 2025-07-10 00:53:09 +01:00
Files
esphome/esphome/components/dfrobot_sen0395/binary_sensor.py
2023-10-27 17:56:33 +13:00

23 lines
677 B
Python

import esphome.codegen as cg
import esphome.config_validation as cv
from esphome.components import binary_sensor
from esphome.const import DEVICE_CLASS_MOTION
from . import CONF_DFROBOT_SEN0395_ID, DfrobotSen0395Component
DEPENDENCIES = ["dfrobot_sen0395"]
CONFIG_SCHEMA = binary_sensor.binary_sensor_schema(
device_class=DEVICE_CLASS_MOTION
).extend(
{
cv.GenerateID(CONF_DFROBOT_SEN0395_ID): cv.use_id(DfrobotSen0395Component),
}
)
async def to_code(config):
parent = await cg.get_variable(config[CONF_DFROBOT_SEN0395_ID])
binary_sens = await binary_sensor.new_binary_sensor(config)
cg.add(parent.set_detected_binary_sensor(binary_sens))