Increase light/volume level and then return to previous level

I am trying to automate a few things with this idea:

  1. Raise level based on input. Could be set dimmer to 100%, set volume to 7 on Google home for announcements
  2. Return to previous level once completed

I have seen several ideas, but not really simple and clear. Anyone has an idea how to make this happen?

variables and a script:

script:
  announce:
    sequence:
      - service: media_player.set_volume
        data:
          entity_id: "{{ my_media_player_entity_id }}"
          level: 10
      # do notification stuff here
      - service: media_player.set_volume
        data_template:
          entity_id: "{{ my_media_player_entity_id }}"
          level: "{{ original_volume_level }}"

In the automations, your action section will look like this:

  action:
    - service: script.announce:
      data_template:
        my_media_player_entity_id: media_player.xxx
        original_volume_level: "{{ states_attr('media_player.xxx','level') }}"

This method can be used for anything. Lights and whatnot, you just need to make the variables to pass to the script.