I have several media_player devices. I also have several 5-button scene controllers in the various rooms these media_player devices are in. My goal is to with have two of the 5-button scene controller buttons trigger 5% volume increases or decreases on the media_player in that room. I could go writing a lot of automations and copying and pasting, but this will get out of hand and will be hard to maintain.
One idea is if there's an existing service I could call just specify the name of the media_player and the percentage, e.g. 5% and tie that event to the button press event. I believe there's already one for 10% (just volume_up or volume_down)? Is there one for 10%? What if 5% is important? I often find the UI volume up and down (10%) is not granular enough for my preferences.
If I had to create this myself I'd probably write a script. I've never written one before, but I'd like it to take a variable for the media_player name and the percentage change and it would do it. Is there any examples I could build off of for something like this? Also which docs are the ones I want to use to understand how to pass in the variable name and value when I call the script from my automation triggered on button-press?