Script not working: media player volume decrease

Hi i have written the following script, that is ought to decrease the volume of the media player by 5% in reference to the current volume as the main idea. but it does not work. As the media player im using a denon avr. thank you for any suggestions/support

service: media_player.volume_set
data:
  volume_level: >
    {% set decrease_factor = 0.95 %}
    {% set current_volume = state_attr('media_player.living_room', 'volume_level') | default(0) | float %}
    {{ [current_volume * decrease_factor, 0.01] | max }}
target:
  entity_id: media_player.living_room

Can you be more specific as what doesn’t work? I have gotten this to work with multiple media devices.

To be honest…it didn’t work after multiple tries, but it does work now. No idea why but i guess there is no issue and never was.

Thank you and sorry for the confusion

No worries, I found it to be an interesting and creative approach!

1 Like