import esphome.codegen as cg import esphome.config_validation as cv from esphome.components import select from . import CONF_OPTOMA_RS232_ID, OptomaRS232Component, optoma_ns DEPENDENCIES = ["optoma_rs232"] Inputs = optoma_ns.enum("Inputs") INPUT_OPTIONS = { "Unknown": 0, "VGA": 2, "HDMI 1": 7, "HDMI 2": 8, } CONFIG_SCHEMA = select.select_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 select.new_select(config, options=list(INPUT_OPTIONS)) cg.add(hub.set_beamer_input_select(sens))