Sending several volume up commands in one call to remote.send_command

I have one of the Cube controllers
I can get the number of times I want the volume to be raised using
{{(trigger.event.data.args.relative_degrees *-1 / 360 * 45) | int()}}
I have it working using a repeat at the yaml level but this is a bit slow

Ideally what I want is to use a template to add the number of lines of
VolumeUp or VolumeDown that I want.

Would repeat the number of times computerd above so a value of 3 would return

command:
  - VolumeUp
  - VolumeUp
  - VolumeUp
device: 60329136

what do you mean , slow? I use codes sending to remotes/media player entities , and it works fine. Maybe it’s your receiver.

It’s probably the Harmony, which is why I want to invoke the remote call once and then send several codes at once.

I have ended up with


command: >
  {% set r = (trigger.event.data.args.relative_degrees / 360 * 45) %}
  {% set i =  r|int() %} 
  {% set x = ['VolumeUp']|batch(i, 'VolumeUp')%} 
  {%- for row in x %}
    {{ row }}
  {%- endfor  %}

Which works much quicker. Is there a simpler way?