"Teach" ESPHome new infrared remote transmitter string

Hello everybody, I have a question about if it is possible to replace ESPHome configuration without home assistant interaction

Let’s say I have:

remote_transmitter:
  pin: GPIO0
  carrier_duty_percent: 50%

remote_receiver:
  pin:
    number: GPIO2
    inverted: True
  dump: all

switch:
  - platform: template
    name: Lg Power Button
    turn_on_action:
      - remote_transmitter.transmit_lg:
          data: 0x20DF10EF
          nbits: 32

Is it possible to replace the data and nbits parameter so that always the remote_receiver receives a new code it substitutes the one that’s active?

My goal is to have a push button on one GPIO that when pressed put’s the ESPHome in “learning mode” and substitutes the IR code I will use in a timer based script to turn off my air conditioner…

Thanks