Need template to automate this volume increase

trying to set this up, this might be the most crucial bit, it would need to follow the template.

checking Timer - Home Assistant though shows no option for a template… which leaves me in the same situation.

or would

timer:
  radio_timer_delay
    name: Radio timer delay
    duration: {{states('input_number.radio_timer_delay')|int}}

do it? If I see this: Setting duration of timer with data_template not working

a timer with a fixed duration is created, and then started with a template in the duration section. Would these be added somehow, or does the template replace the fixed duration…? a bit confusing this is

like:

  - alias: 'Increase volume loop'
    id: 'Increase volume loop'
    initial_state: 'off'
    trigger:
      platform: event
      event_type: timer.finished
      event_data:
        entity_id: timer.radio_timer_delay
#      platform: time #(_pattern)
#      minutes: '/1'
#      seconds: 00
##      seconds: >
##        /{{states('input_number.radio_timer_delay')|int}}
    condition:
      - condition: template
        value_template: >
          {{is_state('input_boolean.snooze','on')}}
      - condition: template
        value_template: >
          {{states('sensor.alarmclock_radio_volume')|float < 1 }}
    action:
      - service: timer.start
        data_template:
          entity_id: timer.radio_timer_delay
          duration: >
            {{states('input_number.radio_timer_delay')|int}}
      - service: media_player.volume_set
        entity_id: media_player.googlehome_master_bedroom
        data_template: 
          volume_level: >
            {% set level = 
               states('sensor.alarmclock_radio_volume')|float + 
               states('input_number.increase_volume')|float %}
            {% if level < 1 %} {{ level }}
            {% else %} 1
            {% endif %}

  - alias: 'Start radio delay timer'
    id: 'Start radio delay timer'
    initial_state: 'off'
    trigger:
      platform: state
      entity_id: input_number.radio_timer_delay
    condition:
    action:
      - service: timer.start
        data_template:
          entity_id: timer.radio_timer_delay
          duration: >
            {{states('input_number.radio_timer_delay')|int}}

timer:
  radio_timer_delay:
    name: Radio timer delay
    duration: 30

started by this script:

  wakeup_radio:
    alias: Wakeup radio
    sequence:
      - service: script.play_wakeup_radio
      - service: automation.turn_on
        entity_id:
          - automation.increase_volume_loop
          - automation.start_radio_delay_timer

new post for clarity: its working!

script:
  radio_timer_delay:
    alias: Radio timer delay
    sequence:
      - service: timer.start
        data_template:
          entity_id: timer.radio_timer_delay
          duration: >
            {{states('input_number.radio_timer_delay')|int}}
automation
  - alias: 'Increase volume loop'
    id: 'Increase volume loop'
    initial_state: 'off'
    trigger:
      platform: event
      event_type: timer.finished
      event_data:
        entity_id: timer.radio_timer_delay
    condition:
      - condition: template
        value_template: >
          {{is_state('input_boolean.snooze','on')}}
      - condition: template
        value_template: >
          {{states('sensor.alarmclock_radio_volume')|float < 1 }}
    action:
      - service: script.radio_timer_delay
      - service: media_player.volume_set
        entity_id: media_player.googlehome_master_bedroom
        data_template: 
          volume_level: >
            {% set level = 
               states('sensor.alarmclock_radio_volume')|float + 
               states('input_number.increase_volume')|float %}
            {% if level < 1 %} {{ level }}
            {% else %} 1
            {% endif %}

timer:
  radio_timer_delay:
    name: Radio timer delay
    duration: 30

all set to fire with this little script:

script:
  wakeup_radio:
    alias: Wakeup radio
    sequence:
      - service: script.play_wakeup_radio
      - service: automation.turn_on
        entity_id: automation.increase_volume_loop
      - service: script.radio_timer_delay

made a kill_switch to rule them all:

  - alias: 'Alarm clock off'
    id: 'Alarm clock off'
    initial_state: 'on'
    trigger:
      platform: state
      entity_id:
        - input_boolean.snooze
        - input_boolean.alarmclock_wd_enabled
        - input_boolean.alarmclock_we_enabled
        - input_boolean.lullaby_radio
        - input_boolean.wakeup_radio
      to: 'off'
    condition:
      condition: template
      value_template: >
        {{states('media_player.googlehome_master_bedroom') == 'playing'}}
    action:
      - service: media_player.turn_off
        entity_id: media_player.googlehome_master_bedroom
      - service: timer.cancel
        entity_id: timer.radio_timer_delay
      - service: automation.turn_off
        entity_id: automation.increase_volume_loop

thanks @123 for inspiring me. Was able to cut your second bullet :wink: KISS, as possible.

I’m looking to do something similar.
Im not sure if i should use timer or not.

What i have so far.
2 input booleans, one for wekkermode and one for wekkeractief
these automations


- id: 'wekker_slaapkamer_detecteer_tijd'
  alias: Wekker slaapkamer tijd
  description: 'Detecteer wekker tijd'
  trigger:
    platform: template
    value_template: "{{ states('sensor.time') == states('sensor.wekker_tijd_slaapkamer') }}"
  condition:
    condition: state
    entity_id: input_boolean.wekkermode_slaapkamer
    state: 'on'
  action:
    service: input_boolean.turn_on
    entity_id: input_boolean.wekkeractief_slaapkamer

- id: 'wekker_slaapkamer_geactiveerd'
  alias: 'Wekker slaapkamer geactiveerd'
  trigger:
    platform: state
    entity_id: input_boolean.wekkeractief_slaapkamer
    from: 'off'
    to: 'on'
  action:
    service: timer.start
    entity_id: timer.wekker_slaapkamer

When the wekker(alarm) is active… i want to have a button “turn off” or “snooze”
When the alarm goes off i want my hub to play music and turn on nightlight.
I think i m gonna add this in a script and as condition have it my boolean alarm active
However the music should have the sound go up from 0 to for example 5 (google hub)
and stay at 5 until i press snooze or off

Pressing of isnt hard, but snooze is

Need some help here…
Especially to turn music up from 0 to 5 and keep 5
(in steps)
And how to snooze and then it redoes the same thing

Hope its clear

using this nowadays:

  play_wakeup_radio:
    alias: Play wakeup radio
    mode: restart
    sequence:
      - service: media_player.volume_set
        data:
          entity_id: >
            {{states('sensor.wakeup_radio')}}
          volume_level: >
            {{states('input_number.wakeup_radio_volume')}}
      - service: media_player.play_media
        data:
          entity_id: >
            {{states('sensor.wakeup_radio')}}
          media_content_id: >
            {{states('sensor.radio_station_wake_up')}}
          media_content_type: music
      - delay: >
          {{states('input_number.increase_volume_delay')|int}}
      - alias: Increase volume AS LONG AS the conditions are true
        repeat:
          while:
            - condition: state
              entity_id:
                - input_boolean.increase_volume
                - input_boolean.snooze
              state: 'on'
            - >
                {{states(states('sensor.wakeup_radio')) == 'playing'}}
            - >
                {{states('sensor.wakeup_radio_volume')|float < 1}}
          sequence:
            - service: media_player.volume_set
              data:
                entity_id: >
                  {{states('sensor.wakeup_radio')}}
                volume_level: >
                  {% set level =
                     states('sensor.wakeup_radio_volume')|float +
                     states('input_number.increase_volume')|float %}
                  {% if level < 1 %} {{level|round(2)}}
                  {% else %} 1
                  {% endif %}
            - delay: >
                {{states('input_number.increase_volume_delay')|int}}
      - delay: >
          {% set delay = states('input_number.snooze_delay')|int * 60 %}
          {% set spent = (now() - state_attr('script.play_wakeup_radio','last_triggered')).total_seconds() %}
          {{ [0, delay-spent] | max }}

      - service: media_player.turn_off
        data:
          entity_id: >
            {{states('sensor.wakeup_radio')}}

please see if this does what yo want?