Help With Setting TImer with Voice Assistant

Hello, following code is for setting up a timer for specified number of minutes

alias: Set Timer
description: Set a custom timer
triggers:
  - trigger: conversation
    command:
      - book a timer for {minute} minute[s]
conditions: []
actions:
  - action: timer.start
    metadata: {}
    data:
      duration: < "00:00:{{ minute }}"
    target:
      entity_id: timer.variable_timer
  - variables:
      minute: 1
      lists:
        minute:
          range:
            from: 1
            to: 120
mode: single

But the trace gives me the following error

Executed: December 17, 2024 at 6:44:05 PM

Error: offset < “00:00:” should be format ‘HH:MM’, ‘HH:MM:SS’ or ‘HH:MM:SS.F’ for dictionary value @ data[‘duration’]

Another question related to that, i tried using the * set a timer for 5 minutes command from Talking to Assist - Sentences starter pack - Home Assistant

Got a confirmation that a timer is started, how do i tap on to the timer finished event.

Thank you for your time and help

Please post your code as preformatted text (</> in the cogwheel menu).

didnt know that, edited, thank you

1 Like

Hi hawalker,

I think that’s your problem.
If that accepts a template at all, the entire field would have to be a template, not the mash-up you have there. And TBH I’m not sure that field accepts templates, you would have to check in the Docs or someone here will know.

Thank you for taking time to go through, the aim is to set variable timers based on sentences via automation. I could either use the templating for duration or the voice assistant timer. Looking for a solution in either direction

Sorted it out , the issue was to capture the right variable from the sentence and then validate it proper, to set the duration for timer.

alias: Set Timer
description: Set a custom timer
triggers:
  - trigger: conversation
    command:
      - book a timer for {minute} minute[s]
      - book a timer for {second} second[s]
      - book a timer for {hour} hours[s]
      - book a timer for {hour} hours[s] and {minute} minute[s]
      - book a timer for {minute} minute[s] and {second} second[s]
conditions: []
actions:
  - action: input_boolean.turn_on
    metadata: {}
    data: {}
    target:
      entity_id: input_boolean.alarm_play
  - action: timer.start
    metadata: {}
    data:
      duration: |
        {% set t_hour = trigger.slots.hour | default(0) | int %}
        {% set t_sec = trigger.slots.second | default(0) | int %}
        {% set t_min = trigger.slots.minute | default(0) | int %}
        {{t_hour}}:{{t_min}}:{{t_sec}}
    target:
      entity_id: timer.variable_timer
mode: single