init
This commit is contained in:
21
binary_sensor.py
Normal file
21
binary_sensor.py
Normal file
@@ -0,0 +1,21 @@
|
||||
import esphome.codegen as cg
|
||||
import esphome.config_validation as cv
|
||||
from esphome.components import binary_sensor
|
||||
from esphome.const import DEVICE_CLASS_POWER, ICON_POWER
|
||||
|
||||
from . import CONF_OPTOMA_RS232_ID, OptomaRS232Component
|
||||
|
||||
DEPENDENCIES = ["optoma_rs232"]
|
||||
|
||||
CONFIG_SCHEMA = binary_sensor.binary_sensor_schema(
|
||||
icon=ICON_POWER,
|
||||
device_class=DEVICE_CLASS_POWER,
|
||||
).extend({
|
||||
cv.GenerateID(CONF_OPTOMA_RS232_ID): cv.use_id(OptomaRS232Component),
|
||||
})
|
||||
|
||||
|
||||
async def to_code(config):
|
||||
hub = await cg.get_variable(config[CONF_OPTOMA_RS232_ID])
|
||||
sens = await binary_sensor.new_binary_sensor(config)
|
||||
cg.add(hub.set_beamer_power_binary_sensor(sens))
|
||||
Reference in New Issue
Block a user