Stop Faded Volume Changes

I am current utilizing this HA-Fade-Volume-Script by MaxVRAM to fade the volume of my whole-home speaker system entities. The one big modification I made to the original script is I changed the mode from Restart to Parallel. I did this since many of my speakers have long-duration faded volume changes at the same times or events, and using Restart mode essentially killed every run except the last one triggered.

As a result, the problem that now occurs is that when a target speaker is already in a long-period volume fade and is triggered again, the previous fade is fighting against the current run of the script on that same speaker entity. Volume up, down, up, down, up, down… you get the picture. In any event, I can’t seem to figure out how to stop the previous script run on that specific speaker entity. One thought I had was to rely on context_id to identify any previous script running on that particular speaker and kill it, but I’m not sure how to do something like that.

While stopping the previous run in-script may be good, an even better solution would allow ANY activity (even manual volume changes) to stop the script. I suppose I could bight the bullet and create that same script for every single speaker entity and change it back to Restart mode, that would solve some of the proble (but not when manual changes are detected) but I’m looking for a more elegant solution (if it exists). Thanks for the help.

maybe i’m not understanding the question right but what if you just set

mode: restart

to your script.

this will cause the second call to the script to abort the first call.

I ended up duplicating the script for each speaker entity to avoid the issue altogether. Thanks though.

How have you been getting along with the script? Affective?
I’m having difficulty with my Logitech Media Players fading out.