Remote_transmitter Compile error

How do I make ‘protocol’ a variable in a service?

When I use this code

  services:
    - service: send_rf_code_prot
      variables:
        protocol: int
        code: string
      then:
        - remote_transmitter.transmit_rc_switch_raw: 
            code: !lambda 'return code;'
            protocol: !lambda 'return protocol;'
            repeat:
              times: 5
              wait_time: 0s

I get this error during compile

/config/sonoff-rf-bridge.yaml:42:14: error: could not convert ‘protocol’ from ‘int32_t’ {aka ‘int’} to ‘esphome::remote_base::RCSwitchBase’

I’ve tried string also and get a similar error.