I have a script which gets called any time I start playing media on my Emby media server. It automatically adjusts the volume depending on which media is playing, because some movies are mixed at louder or quieter volumes. It’s jus a “choose between actions” with a list of each title I want to adjust for:
- conditions:
- alias: Impossible Voyage
condition: template
value_template: >-
{{ states('input_text.moviepath') is search('Impossible Voyage,
The') }}
sequence:
- action: media_player.volume_set
target:
entity_id: media_player.denon_avc_x3800h
data:
volume_level: >-
{{ [state_attr('media_player.denon_avc_x3800h','volume_level') |
float(0) - 0.05, 1.0] | min }}
enabled: true
alias: Decrease volume by 5dB
alias: Impossible Voyage
It gets the path of the file from the JSON webhook sent by Emby when the movie starts.
At the moment, if I encounter a movie I need to tweak the volume on, I have to make a mental note of the volume I end up being happy with and then go in and manually edit the script, which is a bit of a pain especially given I don’t have a volume display on-screen and the OSD of my AVR isn’t visible from my seat. So if possible, I’d like to have a widget on my dashboard which simply allows me to tap a button and have it automatically create a new entry for the current movie at the current volume. I do already have a stored variable for what the volume was when the movie started—for the purposes of returning to that volume after playback is finished—so the fact that it’s a relative rather than absolute target shouldn’t be an issue.