esphome_optoma_rs232/text_sensor.py
2025-03-14 15:23:22 +01:00

19 lines
534 B
Python

import esphome.codegen as cg
import esphome.config_validation as cv
from esphome.components import text_sensor
from . import CONF_OPTOMA_RS232_ID, OptomaRS232Component
DEPENDENCIES = ["optoma_rs232"]
CONFIG_SCHEMA = text_sensor.text_sensor_schema(
).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 text_sensor.new_text_sensor(config)
cg.add(hub.set_beamer_input_text_sensor(sens))