This commit is contained in:
T
2025-03-14 15:23:22 +01:00
commit 419143d70a
9 changed files with 384 additions and 0 deletions

21
binary_sensor.py Normal file
View 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))