Multiple Custom Text Sensors

I have a header .h file and I’m trying to bring a new module to esphome (TX510).
There I read the serial, get the data packets and then do some actions like sending text and state to Sensors.
In this file I have:

class UARTSensor : public Component, public UARTDevice {
  public:
  UARTSensor(UARTComponent *parent) : UARTDevice(parent) {}
  Sensor* presence_sensor = new Sensor();
  TextSensor* text_userid = new TextSensor();
  TextSensor* text_reply = new TextSensor();

and then when I publish the state for the sensors like:

presence_sensor->publish_state(0);
text_userid->publish_state("None");
text_reply->publish_state("Failed");

In yaml I have:

sensor:
  - platform: custom
    lambda: |-
      auto my_sensor = new UARTSensor(id(uart_bus)); 
      App.register_component(my_sensor);
      return {my_sensor->presence_sensor};
    sensors:
      - id: presence_sensor
        name: "internal_presense_sensor_to_binary_template"
        internal: true
        on_value:
          - binary_sensor.template.publish:
              id: presence_template
              state: !lambda return x > 0;

binary_sensor:
  - platform: template
    id: presence_template
    name: "${device_name_pretty} Presence"
    device_class: presence

Which always works, but the text sensors never get the values and stay unknown:

text_sensor:
  - platform: custom
    lambda: |-
      auto my_text_sensor = new UARTSensor(id(uart_bus)); 
      App.register_component(my_text_sensor);
      return {my_text_sensor->text_userid, my_text_sensor->text_reply};
    text_sensors:
      - name: "text_userid"
        internal: true
        on_value:
           then:
              - text_sensor.template.publish:
                  id: user_id_template
                  state: !lambda 'return x;'
      - name: "text_reply"
        internal: true
        on_value:
           then:
              - text_sensor.template.publish:
                  id: reply_template
                  state: !lambda 'return x;'
  - platform: template
    id: user_id_template
    name: "${device_name_pretty} User ID"
  - platform: template
    id: reply_template
    name: "${device_name_pretty} Responce"

In the logs I see something like:

[text_sensor:xx] '' : Published state: 'Failed'

So it gets the value but no sending it anywhere.
What am I doing wrong?
Everything else works as intended and that’s the only missing part to finish the component.

It seems that you can’t have Sensors from variable domains.
I just made them all TextSensor and it worked

I’m trying to have 2 text_sensors would you be willing to elaborate on how you gat 2 to work? is it the last code you have in the earlier post or a is there a different solution.
this is what I have/trying to have but this is not working

text_sensor:
  - platform: custom

  text_sensors:

    - platform: homeassistant
     - name: "Selected Message"
       entity_id: input_select.esp_display_messages
       id: selected_message

    - platform: homeassistant
     - name: "Message State"
       entity_id: input_text.display_message_state
       id: display_message_state

do you have any pointers?

Update: I figured it out for my setup. This is what is working to recieve text input from home assistant,

text_sensor:
  - platform: homeassistant
    name: "selected_message"
    entity_id: input_select.esp_display_messages
    id: selected_message

  - platform: homeassistant
    name: "message_state"
    entity_id: input_text.display_message_state
    id: display_message_state