How to use attribute and state in script

I am trying to use my google home as a doorbell chime by making it play sound form the web
It currently work without the volume changing part (just play the sound at current volume) but I’m trying to make it so, For example The Volume before it ring is 56 When it ring the volume will go to 100% and go back to 56% when It stop ringing
I am using input_number as a variable but It seem to not work
My current config
In Script
alias: Ring Doorbell

  • data:
    entity_id: input_number.bedroom_googlehome_mini_volume_cache
    value: {{ state_attr(‘media_player.bedroom_speaker’,‘volume_level’) | float }}
    service: input_number.set_value
  • data:
    entity_id: media_player.bedroom_speaker
    volume_level: 1
    service: media_player.volume_set
  • data:
    entity_id: media_player.bedroom_speaker
    media_content_id: https://[NOT GOING TO TELL YOU]:1952/doorbell.mp3
    media_content_type: music
    service: media_player.play_media
  • data:
    entity_id: media_player.bedroom_speaker
    volume_level: {{ states(‘input_number.bedroom_googlehome_mini_volume_cache’) | float }}
    service: media_player.volume_set
    The input_number part
    name: “Bedroom Google Home Mini Volume Cache”
    initial: 0.5
    min: 0
    max: 1
    step: 0.01