Service call for Broadlink RM4 PRO with parameters

I have a Broadlink RM4 PRO i am using to control a heatpump. The automation uses a service call where the command is calling a previously reccorded learned command from the heatpump remote. It works but i want to make the service call parameterized so i can have helpers for the target temperature and fan speed. I have named the reccorded commands to prepare for this so if i want to set temperature 22 degrees and fanspeed 4 the command would look like this command: heat_fan4_t22 and i have saved commands for relevant temperatures and fan speeds.

My prefered solution would use the values 22 and 4 and call the right learned command based on that. Any suggestions? The code for my ”hardcoded” service is simple, see below.

alias: Boost heatpump
description: Boost heatpump early morning
trigger:

  • platform: state
    entity_id:
    • schedule.heatpump_schedule
      from: “off”
      to: “on”
      condition: []
      action:
  • service: remote.send_command
    data:
    device: heatpump
    num_repeats: 2
    command: heat_fan4_t22
    target:
    device_id: xxxxx removed xxxxx
    mode: single

Managed to solve it myself after some playing around. New code looks like this if anyone wants to do something similar

action:

  • service: remote.send_command
    data:
    device: heatpump
    command: >-
    heat_fan{{ states(‘input_number.heatpump_normal_speed’) | int }}_t{{
    states(‘input_number.heatpump_normal_temp’) | int }}