binary sensor
This commit is contained in:
parent
9293be012a
commit
0fb3f6e13f
|
@ -12,17 +12,16 @@ RATGDOBinarySensor = ratgdo_ns.class_(
|
|||
"RATGDOBinarySensor", binary_sensor.BinarySensor, cg.Component
|
||||
)
|
||||
|
||||
CONF_TYPE = "type"
|
||||
TYPES = {"motion", "obstruction"}
|
||||
|
||||
|
||||
CONFIG_SCHEMA = binary_sensor.BINARY_SENSOR_SCHEMA.extend(
|
||||
{cv.Optional(type): binary_sensor.binary_sensor_schema() for type in TYPES}
|
||||
{cv.Required(CONF_TYPE): str}
|
||||
)
|
||||
|
||||
|
||||
async def to_code(config):
|
||||
for type in TYPES:
|
||||
if type in config:
|
||||
conf = config[type]
|
||||
var = await binary_sensor.new_binary_sensor(conf)
|
||||
await register_ratgdo_child(var, config)
|
||||
var = await binary_sensor.new_binary_sensor(config)
|
||||
await cg.register_component(var, config)
|
||||
await register_ratgdo_child(var, config)
|
||||
|
|
Loading…
Reference in New Issue