def to_code(config): rhs = App.make_mqtt_subscribe_text_sensor(config[CONF_NAME], config[CONF_TOPIC]) sensor_ = Pvariable(config[CONF_ID], rhs) if CONF_QOS in config: add(sensor_.set_qos(config[CONF_QOS])) text_sensor.setup_text_sensor(sensor_, config) setup_component(sensor_, config)
def to_code(config): rhs = App.make_template_text_sensor(config[CONF_NAME], config.get(CONF_UPDATE_INTERVAL)) template = Pvariable(config[CONF_ID], rhs) text_sensor.setup_text_sensor(template, config) setup_component(template, config) if CONF_LAMBDA in config: for template_ in process_lambda(config[CONF_LAMBDA], [], return_type=optional.template(std_string)): yield add(template.set_template(template_))
def to_code(config): rhs = App.make_homeassistant_text_sensor(config[CONF_NAME], config[CONF_ENTITY_ID]) sensor_ = Pvariable(config[CONF_ID], rhs) text_sensor.setup_text_sensor(sensor_, config)
def to_code(config): rhs = App.make_version_text_sensor(config[CONF_NAME]) sens = Pvariable(config[CONF_ID], rhs) text_sensor.setup_text_sensor(sens, config) setup_component(sens, config)