Volume_Down Multiple times in one service call

Well… I waited hopeing there was a better way, but got frusterated and just copied the service call 100x for volume down and X times for volume up and learned about splitting the configs as I didn’t want my scripts.yaml to look horrible.

I added the following to configuration.yaml

#script: !include scripts.yaml
#script: !include_dir_named scripts/
script: !include_dir_merge_named scripts/

then inside /scripts/{voldown100.yaml & volup20.yaml}

Eg:

voldown100.yaml

'100voldown':
  alias: VolDown100
  sequence:
  - data: {}
    entity_id: media_player.freesoftwareservers
    service: media_player.volume_down
  - data: {}
    entity_id: media_player.freesoftwareservers
    service: media_player.volume_down

x 100 repeats

And volume up is the opposite!

There has got to be a better way, but I don’t really understand yaml and how this coding language works TBH.

I won’t be accepting my answer as copying code blocks 100x is NOT what I was hoping to do. Here is where I will be updating on my site for what it’s worth.

https://www.freesoftwareservers.com/display/FREES/Split+Scripts+into+Multiple+Files+in+Directory+with+Home-Assistant