How to send repeat value to Home Assistant Native API?

Hi. I just started learning ESPHome. I have a Tuya IR remote that I flashed to the ESPHome platform. I’m trying to send code from Home Assistant to the remote, but I don’t understand how to set the repeat parameter. If I change the repeat value, the remote sends signals instantly without delay. I want to set the wait_time parameter, but I don’t understand how to pass it through the API
Example of my YAML file:

    - service: send_nec
      variables:
        address: string
        command: string
        repeat: int
      then:
      - remote_transmitter.transmit_nec:
          address: !lambda 'return (int)strtol(address.c_str(), NULL, 16);'
          command: !lambda 'return (int)strtol(command.c_str(), NULL, 16);'
          repeat: !lambda 'return repeat;'   

If I add a variable and output it, I get an error:

[wait_time] is an invalid option for [remote_transmitter.transmit_nec]. Please check the indentation.

What can I do to send wait_time via Home Assistant API?
P.S. Sorry for possible errors in the text, I use Google Translate

You have to add it under repeat. Like this:

repeat:
  times: 3
  wait_time: 15ms

I tired it, but no result. I get error:

mapping values are not allowed here

my code:

    - service: send_nec
      variables:
        address: string
        command: string
        repeat: int
          times: int
          wait_time: string

Maybe I explained what I want a little incorrectly. I want to enter the signal parameters (address and command) in Home Assistant and send these values ​​to ESPHome via API so that the remote control sends the values ​​I specified. I do not want to store the command data in the remote control firmware. I do not understand how to send the times and wait_time commands in such a case.

My full yaml code:

esphome:
  name: ir-remote
  friendly_name: IR Remote

esp8266:
  board: esp8285

# Enable logger
logger:

# Enable Home Assistant API
api:
  encryption:
    key: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
  services:
    - service: send_pronto
      variables:
        data: string
        repeat: int
      then:
      - remote_transmitter.transmit_pronto:
          data: !lambda 'return data;'
          repeat: !lambda 'return repeat;'
    
    - service: send_nec
      variables:
        address: string
        command: string
        repeat: int
      then:
      - remote_transmitter.transmit_nec:
          address: !lambda 'return (int)strtol(address.c_str(), NULL, 16);'
          command: !lambda 'return (int)strtol(command.c_str(), NULL, 16);'
          repeat: !lambda 'return repeat;'

    - service: send_lg
      variables:
        data: string
        nbits: int
        repeat: int
      then:
      - remote_transmitter.transmit_lg:
          data: !lambda 'return (int)strtol(data.c_str(), NULL, 16);'
          nbits: !lambda 'return nbits;'
          repeat: !lambda 'return repeat;'

    - service: send_jvc
      variables:
        data: string
        repeat: int
      then:
      - remote_transmitter.transmit_jvc:
          data: !lambda 'return (int)strtol(data.c_str(), NULL, 16);'
          repeat: !lambda 'return repeat;'

    - service: send_pioneer
      variables:
        rc_code_1: string
        rc_code_2: string        
        repeat: int
      then:
      - remote_transmitter.transmit_pioneer:
          rc_code_1: !lambda 'return (int)strtol(rc_code_1.c_str(), NULL, 16);'
          rc_code_2: !lambda 'return (int)strtol(rc_code_1.c_str(), NULL, 16);'          
          repeat: !lambda 'return repeat;'

    - service: send_rc5
      variables:
        address: string
        command: string
        repeat: int
      then:
      - remote_transmitter.transmit_rc5:
          address: !lambda 'return (int)strtol(address.c_str(), NULL, 16);'
          command: !lambda 'return (int)strtol(command.c_str(), NULL, 16);'          
          repeat: !lambda 'return repeat;'          

    - service: send_rc6
      variables:
        address: string
        command: string
        repeat: int
      then:
      - remote_transmitter.transmit_rc6:
          address: !lambda 'return (int)strtol(address.c_str(), NULL, 16);'
          command: !lambda 'return (int)strtol(command.c_str(), NULL, 16);'          
          repeat: !lambda 'return repeat;'        

ota:
  - platform: esphome
    password: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Ir-Remote Fallback Hotspot"
    password: "xxxxxxxxxxxxxxx"

captive_portal:

remote_receiver:
  pin: 
    number: GPIO5
    inverted: true
  dump: all
remote_transmitter:
  pin: 
    number: GPIO14
    inverted: false
  carrier_duty_percent: 50%
        repeat:
          times: 3
          wait_time: 5s

You need to remove the int to the right of repeat:, if you’re using the subsection to specify things.

That’s not working. I get this error:

        string value cannot be dictionary or list.
        repeat: 
          times: int
          wait_time: string

I’m not sure if the parameters are all templatable.

I’m not sure why you want to use the API service call anyway. I would just create a button template in ESPHome for each command I wanted to send.

Something like this:

It doesnt make any sense to “send the commands from HA”. The transmitter and receiver both are on the esp device as well as the codes you want it to send/receive.

You dont want to split up the device or hardware sending/receiving the codes(esp) from the codes themselves. Doing it the wsy your trying, if HA has an issue then no more IR codes being transmitted. If you put them in something like template buttons then you can just as easily “push” those buttons from inside HA but, HA isnt necessary for it to work and will 100% work from the esp alone.