Set a timer using HA Assist

I use Alexa to set countdown timers for things in the oven. It would be great if I could ask Assist to do this instead. Is this already possible via some sort of integration?

4 Likes

I’m doing some coding to get this to work. To summarize, I created 3 timers (I barely use multiple timers, so 3 is enough for me) that assist can control; start, stop and ask the remaining time on one or all timers at once. I think my script could be more efficient and cleaner, but it works. I’m working on pausing a timer now. The responses are also written in Dutch, but translating wouldn’t be that much work.

5 Likes

Are you willing to share your script, @DonNL?

1 Like

If you wouldn’t mind sharing the scripts, that would be great.

Sure. Again it’s probably not the most efficient way of handling it, but it works so far.

config_assist_intent_script.yaml

  TimerStart:
    speech:
      text: >
        {{ (["Geen probleem. ", "Goed. ", "Natuurlijk. ", ""] | random) + (["Ik start de timer voor ", "Timer gestart voor ", "Ik zet een timer voor ", "Timer geactiveerd voor "] | random)}}{% if (hours | int(default=0)) == 1 %}{{ (hours | int)}} uur{% elif (hours | int(default=0)) > 1 %}{{ (hours | int)}} uren{% endif %}{% if (hours | int(default=0)) > 0 and ((minutes | int(default=0)) > 0 or (seconds | int(default=0)) > 0) %} en {% endif %}{% if (minutes | int(default=0)) == 1 %}{{ (minutes | int)}} minuut{% elif (minutes | int(default=0)) > 1 %}{{ (minutes | int)}} minuten{% endif %}{% if (minutes | int(default=0)) > 0 and (seconds | int(default=0)) > 0 %} en {% endif %}{% if (seconds | int(default=0)) == 1 %}{{ (seconds | int)}} seconde{% elif (seconds | int(default=0)) > 1 %}{{ (seconds | int)}} seconden{% endif %}.
    action:
      service: script.start_timer
      data_template:
        duration: "{{hours | int(default=0)}}:{{ minutes | int(default=0) }}:{{ seconds | int(default=0) }}"
        entity_id: >
          {% if states('timer.timer1') != 'active' and states('timer.timer1') != 'paused' %} timer.timer1
          {% elif states('timer.timer2') != 'active' and states('timer.timer2') != 'paused' %} timer.timer2
          {% else %} timer.timer3{% endif%}

  TimerStop:
    speech:
      text: >       
        {% if states.timer|selectattr('state','eq','active')|list|length == 0 %}
        Er zijn momenteel geen timers actief.
        {% elif (states.timer|selectattr('state','eq','active')|list|length -1 == 1) or (timer != 'timer.timer0') and states(timer) == 'active'%}
        {{ (["Akkoord. ", "Begrepen. ", "Goed. ", ""] | random) }}{{ (["Geannuleerd.", "Timer geannuleerd.", "Gestopt.", "Timer gestopt.", "Gedeactiveerd.", "Timer gedeactiveerd.", "Timer uitgeschakeld.", "Uitgeschakeld."] | random) }}
        {% elif (states.timer|selectattr('state','eq','active')|list|length > 1) and (timer == 'timer.timer1, timer.timer2, timer.timer3') %}
        {{ (["Akkoord. ", "Begrepen. ", "Goed. ", ""] | random) }}{{ (["Geannuleerd.", "Alle timers geannuleerd.", "Gestopt.", "Alle timers gestopt.", "Gedeactiveerd.", "Alle timers gedeactiveerd.", "Alle timers uitgeschakeld.", "Uitgeschakeld."] | random) }}
        {% else %}{% if states(timer) != 'active' %}Deze timer is momenteel niet actief. {% endif %}{% if states.timer|selectattr('state','eq','active')|list|length == 2 %}Er is momenteel {{ states.timer|selectattr('state','eq','active')|list|length - 1}} timer actief. {% 
                     else %}Er zijn momenteel {{ states.timer|selectattr('state','eq','active')|list|length - 1}} timers actief. {% endif %}{% 
            if states.timer.timer1.state == 'active' %}{% 
              set duration = "" %}{% 
              if states.timer.timer1.attributes.duration[:2] | int(default=0) > 9 %}{%
              set hr = states.timer.timer1.attributes.duration[:2] %}{% else %}{%
              set hr = states.timer.timer1.attributes.duration[:1] %}{% endif %}{%
              if states.timer.timer1.attributes.duration[3:][:2] | int(default=0) > 9 %}{%
              set min = states.timer.timer1.attributes.duration[3:][:2] %}{% else %}{%
              set min = states.timer.timer1.attributes.duration[3:][:1] %}{% endif %}{%
              if states.timer.timer1.attributes.duration[5:] | int(default=0) > 9 %}{%
              set sec = states.timer.timer1.attributes.duration[5:] %}{% else %}{%
              set sec = states.timer.timer1.attributes.duration[6:] %}{% endif %}{%
              
              if hr | int(default=0) > 0 %}{% set duration = duration + hr + " uur " %}{% endif %}{%
              if min | int(default=0) == 1 %}{% set duration = duration + min + " minuut " %}{%
              elif min | int(default=0) > 1 %}{% set duration = duration + min + " minuten " %}{% endif %}{%
              if sec | int(default=0) == 1 %}{% set duration = duration + sec + " seconde " %}{%
              elif sec | int(default=0) > 1 %}{% set duration = duration + sec + " seconden " %}{% endif %}De {%
              if (states.timer|selectattr('state','eq','active')|list|length - 1) != 1%}eerste {% endif %}timer van {{ duration }}is actief met nog {%
              if (states['timer.timer1'].attributes.duration != "none") or (states['timer.timer1'].state == "active") -%}{%
              if (as_datetime(state_attr('timer.timer1', 'finishes_at')) - now()).total_seconds() | timestamp_custom('%H', false) | int > 0 %}{{ (as_datetime(state_attr('timer.timer1', 'finishes_at')) - now()).total_seconds() | timestamp_custom('%H', false) | int }} uur {% endif %}{%
              if (as_datetime(state_attr('timer.timer1', 'finishes_at')) - now()).total_seconds() | timestamp_custom('%M', false) | int == 1 %} 1 minuut{%
              elif (as_datetime(state_attr('timer.timer1', 'finishes_at')) - now()).total_seconds() | timestamp_custom('%M', false) | int > 1 %}{{ (as_datetime(state_attr('timer.timer1', 'finishes_at')) - now()).total_seconds() | timestamp_custom('%M', false) | int }} minuten {% endif %}{%
              if (as_datetime(state_attr('timer.timer1', 'finishes_at')) - now()).total_seconds() | timestamp_custom('%H', false) | int > 0 %}{%
              elif (as_datetime(state_attr('timer.timer1', 'finishes_at')) - now()).total_seconds() | timestamp_custom('%S', false) | int == 1 %} 1 seconde{%
              elif (as_datetime(state_attr('timer.timer1', 'finishes_at')) - now()).total_seconds() | timestamp_custom('%S', false) | int > 1 %}{{ (as_datetime(state_attr('timer.timer1', 'finishes_at')) - now()).total_seconds() | timestamp_custom('%S', false) | int }} seconden {% endif %}{% endif %}te gaan. {%
            endif %}{%
            if states.timer.timer2.state == 'active' %}{% 
              set duration = "" %}{% 
              if states.timer.timer2.attributes.duration[:2] | int(default=0) > 9 %}{%
              set hr = states.timer.timer2.attributes.duration[:2] %}{% else %}{%
              set hr = states.timer.timer2.attributes.duration[:1] %}{% endif %}{%
              if states.timer.timer2.attributes.duration[3:][:2] | int(default=0) > 9 %}{%
              set min = states.timer.timer2.attributes.duration[3:][:2] %}{% else %}{%
              set min = states.timer.timer2.attributes.duration[3:][:1] %}{% endif %}{%
              if states.timer.timer2.attributes.duration[5:] | int(default=0) > 9 %}{%
              set sec = states.timer.timer2.attributes.duration[5:] %}{% else %}{%
              set sec = states.timer.timer2.attributes.duration[6:] %}{% endif %}{%
              
              if hr | int(default=0) > 0 %}{% set duration = duration + hr + " uur " %}{% endif %}{%
              if min | int(default=0) == 1 %}{% set duration = duration + min + " minuut " %}{%
              elif min | int(default=0) > 1 %}{% set duration = duration + min + " minuten " %}{% endif %}{%
              if sec | int(default=0) == 1 and hr | int(default=0) == 0 %}{% set duration = duration + sec + " seconde " %}{%
              elif sec | int(default=0) > 1 and hr | int(default=0) == 0 %}{% set duration = duration + sec + " seconden " %}{% endif %}De {%
              if (states.timer|selectattr('state','eq','active')|list|length - 1) != 1%}tweede {% endif %}timer van {{ duration }}is actief met nog {%
              if (states['timer.timer2'].attributes.duration != "none") or (states['timer.timer2'].state == "active") -%}{%
              if (as_datetime(state_attr('timer.timer2', 'finishes_at')) - now()).total_seconds() | timestamp_custom('%H', false) | int > 0 %}{{ (as_datetime(state_attr('timer.timer2', 'finishes_at')) - now()).total_seconds() | timestamp_custom('%H', false) | int }} uur {% endif %}{%
              if (as_datetime(state_attr('timer.timer2', 'finishes_at')) - now()).total_seconds() | timestamp_custom('%M', false) | int == 1 %} 1 minuut{%
              elif (as_datetime(state_attr('timer.timer2', 'finishes_at')) - now()).total_seconds() | timestamp_custom('%M', false) | int > 1 %}{{ (as_datetime(state_attr('timer.timer2', 'finishes_at')) - now()).total_seconds() | timestamp_custom('%M', false) | int }} minuten {% endif %}{%
              if (as_datetime(state_attr('timer.timer2', 'finishes_at')) - now()).total_seconds() | timestamp_custom('%H', false) | int > 0 %}{%
              elif (as_datetime(state_attr('timer.timer2', 'finishes_at')) - now()).total_seconds() | timestamp_custom('%S', false) | int == 1 %} 1 seconde{%
              elif (as_datetime(state_attr('timer.timer2', 'finishes_at')) - now()).total_seconds() | timestamp_custom('%S', false) | int > 1 %}{{ (as_datetime(state_attr('timer.timer2', 'finishes_at')) - now()).total_seconds() | timestamp_custom('%S', false) | int }} seconden {% endif %}{% endif %}te gaan. {%
            endif %}{%
            
            if states.timer.timer3.state == 'active' %}{% 
              set duration = "" %}{% 
              if states.timer.timer3.attributes.duration[:2] | int(default=0) > 9 %}{%
              set hr = states.timer.timer3.attributes.duration[:2] %}{% else %}{%
              set hr = states.timer.timer3.attributes.duration[:1] %}{% endif %}{%
              if states.timer.timer3.attributes.duration[3:][:2] | int(default=0) > 9 %}{%
              set min = states.timer.timer3.attributes.duration[3:][:2] %}{% else %}{%
              set min = states.timer.timer3.attributes.duration[3:][:1] %}{% endif %}{%
              if states.timer.timer3.attributes.duration[5:] | int(default=0) > 9 %}{%
              set sec = states.timer.timer3.attributes.duration[5:] %}{% else %}{%
              set sec = states.timer.timer3.attributes.duration[6:] %}{% endif %}{%
              
              if hr | int(default=0) > 0 %}{% set duration = duration + hr + " uur " %}{% endif %}{%
              if min | int(default=0) == 1 %}{% set duration = duration + min + " minuut " %}{%
              elif min | int(default=0) > 1 %}{% set duration = duration + min + " minuten " %}{% endif %}{%
              if sec | int(default=0) == 1 %}{% set duration = duration + sec + " seconde " %}{%
              elif sec | int(default=0) > 1 %}{% set duration = duration + sec + " seconden " %}{% endif %}De {%
              if (states.timer|selectattr('state','eq','active')|list|length - 1) != 1%}derde {% endif %}timer van {{ duration }}is actief met nog {%
              if (states['timer.timer3'].attributes.duration != "none") or (states['timer.timer3'].state == "active") -%}{%
              if (as_datetime(state_attr('timer.timer3', 'finishes_at')) - now()).total_seconds() | timestamp_custom('%H', false) | int > 0 %}{{ (as_datetime(state_attr('timer.timer3', 'finishes_at')) - now()).total_seconds() | timestamp_custom('%H', false) | int }} uur {% endif %}{%
              if (as_datetime(state_attr('timer.timer3', 'finishes_at')) - now()).total_seconds() | timestamp_custom('%M', false) | int == 1 %} 1 minuut{%
              elif (as_datetime(state_attr('timer.timer3', 'finishes_at')) - now()).total_seconds() | timestamp_custom('%M', false) | int > 1 %}{{ (as_datetime(state_attr('timer.timer3', 'finishes_at')) - now()).total_seconds() | timestamp_custom('%M', false) | int }} minuten {% endif %}{%
              if (as_datetime(state_attr('timer.timer3', 'finishes_at')) - now()).total_seconds() | timestamp_custom('%H', false) | int > 0 %}{%
              elif (as_datetime(state_attr('timer.timer3', 'finishes_at')) - now()).total_seconds() | timestamp_custom('%S', false) | int == 1 %} 1 seconde{%
              elif (as_datetime(state_attr('timer.timer3', 'finishes_at')) - now()).total_seconds() | timestamp_custom('%S', false) | int > 1 %}{{ (as_datetime(state_attr('timer.timer3', 'finishes_at')) - now()).total_seconds() | timestamp_custom('%S', false) | int }} seconden {% endif %}{% endif %}te gaan. {%
            endif %}{{ (["Specificeer alstublieft welke timer u wilt stoppen.", "Geef alstublieft aan welke timer u wilt stoppen.", "Benoem alstublieft welke timer u wilt stoppen.", ""] | random) }}{% endif %}
    action:
      service: script.stop_timer
      data_template:
        entity_id: "{{ timer }}"
               
  TimerDuration:
    speech:
      text: >       
        {% if states.timer|selectattr('state','eq','active')|list|length == 0 %}
        Er zijn momenteel geen timers actief.
        {% else %}{% if states.timer|selectattr('state','eq','active')|list|length == 2 and timer == 'timer.timer0' %}Er is momenteel {{ states.timer|selectattr('state','eq','active')|list|length - 1}} timer actief. {% 
                     elif timer == 'timer.timer0' %}
                     Er zijn momenteel {{ states.timer|selectattr('state','eq','active')|list|length - 1}} timers actief. {% endif %}{% 
            if states.timer.timer1.state == 'active' and (timer == 'timer.timer1' or timer == 'timer.timer0') %}{% 
              set duration = "" %}{% 
              if states.timer.timer1.attributes.duration[:2] | int(default=0) > 9 %}{%
              set hr = states.timer.timer1.attributes.duration[:2] %}{% else %}{%
              set hr = states.timer.timer1.attributes.duration[:1] %}{% endif %}{%
              if states.timer.timer1.attributes.duration[3:][:2] | int(default=0) > 9 %}{%
              set min = states.timer.timer1.attributes.duration[3:][:2] %}{% else %}{%
              set min = states.timer.timer1.attributes.duration[3:][:1] %}{% endif %}{%
              if states.timer.timer1.attributes.duration[5:] | int(default=0) > 9 %}{%
              set sec = states.timer.timer1.attributes.duration[5:] %}{% else %}{%
              set sec = states.timer.timer1.attributes.duration[6:] %}{% endif %}{%
              
              if hr | int(default=0) > 0 %}{% set duration = duration + hr + " uur " %}{% endif %}{%
              if min | int(default=0) == 1 %}{% set duration = duration + min + " minuut " %}{%
              elif min | int(default=0) > 1 %}{% set duration = duration + min + " minuten " %}{% endif %}{%
              if sec | int(default=0) == 1 %}{% set duration = duration + sec + " seconde " %}{%
              elif sec | int(default=0) > 1 %}{% set duration = duration + sec + " seconden " %}{% endif %}De eerste timer van {{ duration }}is actief met nog {%
              if (states['timer.timer1'].attributes.duration != "none") or (states['timer.timer1'].state == "active") -%}{%
              if (as_datetime(state_attr('timer.timer1', 'finishes_at')) - now()).total_seconds() | timestamp_custom('%H', false) | int > 0 %}{{ (as_datetime(state_attr('timer.timer1', 'finishes_at')) - now()).total_seconds() | timestamp_custom('%H', false) | int }} uur {% endif %}{%
              if (as_datetime(state_attr('timer.timer1', 'finishes_at')) - now()).total_seconds() | timestamp_custom('%M', false) | int == 1 %} 1 minuut{%
              elif (as_datetime(state_attr('timer.timer1', 'finishes_at')) - now()).total_seconds() | timestamp_custom('%M', false) | int > 1 %}{{ (as_datetime(state_attr('timer.timer1', 'finishes_at')) - now()).total_seconds() | timestamp_custom('%M', false) | int }} minuten {% endif %}{%
              if (as_datetime(state_attr('timer.timer1', 'finishes_at')) - now()).total_seconds() | timestamp_custom('%S', false) | int == 1 %} 1 seconde{%
              elif (as_datetime(state_attr('timer.timer1', 'finishes_at')) - now()).total_seconds() | timestamp_custom('%S', false) | int > 1 %}{{ (as_datetime(state_attr('timer.timer1', 'finishes_at')) - now()).total_seconds() | timestamp_custom('%S', false) | int }} seconden {% endif %}{% endif %}te gaan. {%
            endif %}{%
            if states.timer.timer2.state == 'active' and (timer == 'timer.timer2' or timer == 'timer.timer0') %}{% 
              set duration = "" %}{% 
              if states.timer.timer2.attributes.duration[:2] | int(default=0) > 9 %}{%
              set hr = states.timer.timer2.attributes.duration[:2] %}{% else %}{%
              set hr = states.timer.timer2.attributes.duration[:1] %}{% endif %}{%
              if states.timer.timer2.attributes.duration[3:][:2] | int(default=0) > 9 %}{%
              set min = states.timer.timer2.attributes.duration[3:][:2] %}{% else %}{%
              set min = states.timer.timer2.attributes.duration[3:][:1] %}{% endif %}{%
              if states.timer.timer2.attributes.duration[5:] | int(default=0) > 9 %}{%
              set sec = states.timer.timer2.attributes.duration[5:] %}{% else %}{%
              set sec = states.timer.timer2.attributes.duration[6:] %}{% endif %}{%
              
              if hr | int(default=0) > 0 %}{% set duration = duration + hr + " uur " %}{% endif %}{%
              if min | int(default=0) == 1 %}{% set duration = duration + min + " minuut " %}{%
              elif min | int(default=0) > 1 %}{% set duration = duration + min + " minuten " %}{% endif %}{%
              if sec | int(default=0) == 1 %}{% set duration = duration + sec + " seconde " %}{%
              elif sec | int(default=0) > 1 %}{% set duration = duration + sec + " seconden " %}{% endif %}De tweede timer van {{ duration }}is actief met nog {%
              if (states['timer.timer2'].attributes.duration != "none") or (states['timer.timer2'].state == "active") -%}{%
              if (as_datetime(state_attr('timer.timer2', 'finishes_at')) - now()).total_seconds() | timestamp_custom('%H', false) | int > 0 %}{{ (as_datetime(state_attr('timer.timer2', 'finishes_at')) - now()).total_seconds() | timestamp_custom('%H', false) | int }} uur {% endif %}{%
              if (as_datetime(state_attr('timer.timer2', 'finishes_at')) - now()).total_seconds() | timestamp_custom('%M', false) | int == 1 %} 1 minuut{%
              elif (as_datetime(state_attr('timer.timer2', 'finishes_at')) - now()).total_seconds() | timestamp_custom('%M', false) | int > 1 %}{{ (as_datetime(state_attr('timer.timer2', 'finishes_at')) - now()).total_seconds() | timestamp_custom('%M', false) | int }} minuten {% endif %}{%
              if (as_datetime(state_attr('timer.timer2', 'finishes_at')) - now()).total_seconds() | timestamp_custom('%S', false) | int == 1 %} 1 seconde{%
              elif (as_datetime(state_attr('timer.timer2', 'finishes_at')) - now()).total_seconds() | timestamp_custom('%S', false) | int > 1 %}{{ (as_datetime(state_attr('timer.timer2', 'finishes_at')) - now()).total_seconds() | timestamp_custom('%S', false) | int }} seconden {% endif %}{% endif %}te gaan. {%
            endif %}{%
            
            if states.timer.timer3.state == 'active' and (timer == 'timer.timer3' or timer == 'timer.timer0') %}{% 
              set duration = "" %}{% 
              if states.timer.timer3.attributes.duration[:2] | int(default=0) > 9 %}{%
              set hr = states.timer.timer3.attributes.duration[:2] %}{% else %}{%
              set hr = states.timer.timer3.attributes.duration[:1] %}{% endif %}{%
              if states.timer.timer3.attributes.duration[3:][:2] | int(default=0) > 9 %}{%
              set min = states.timer.timer3.attributes.duration[3:][:2] %}{% else %}{%
              set min = states.timer.timer3.attributes.duration[3:][:1] %}{% endif %}{%
              if states.timer.timer3.attributes.duration[5:] | int(default=0) > 9 %}{%
              set sec = states.timer.timer3.attributes.duration[5:] %}{% else %}{%
              set sec = states.timer.timer3.attributes.duration[6:] %}{% endif %}{%
              
              if hr | int(default=0) > 0 %}{% set duration = duration + hr + " uur " %}{% endif %}{%
              if min | int(default=0) == 1 %}{% set duration = duration + min + " minuut " %}{%
              elif min | int(default=0) > 1 %}{% set duration = duration + min + " minuten " %}{% endif %}{%
              if sec | int(default=0) == 1 %}{% set duration = duration + sec + " seconde " %}{%
              elif sec | int(default=0) > 1 %}{% set duration = duration + sec + " seconden " %}{% endif %}De derde timer van {{ duration }}is actief met nog {%
              if (states['timer.timer3'].attributes.duration != "none") or (states['timer.timer3'].state == "active") -%}{%
              if (as_datetime(state_attr('timer.timer3', 'finishes_at')) - now()).total_seconds() | timestamp_custom('%H', false) | int > 0 %}{{ (as_datetime(state_attr('timer.timer3', 'finishes_at')) - now()).total_seconds() | timestamp_custom('%H', false) | int }} uur {% endif %}{%
              if (as_datetime(state_attr('timer.timer3', 'finishes_at')) - now()).total_seconds() | timestamp_custom('%M', false) | int == 1 %} 1 minuut{%
              elif (as_datetime(state_attr('timer.timer3', 'finishes_at')) - now()).total_seconds() | timestamp_custom('%M', false) | int > 1 %}{{ (as_datetime(state_attr('timer.timer3', 'finishes_at')) - now()).total_seconds() | timestamp_custom('%M', false) | int }} minuten {% endif %}{%
              if (as_datetime(state_attr('timer.timer3', 'finishes_at')) - now()).total_seconds() | timestamp_custom('%S', false) | int == 1 %} 1 seconde{%
              elif (as_datetime(state_attr('timer.timer3', 'finishes_at')) - now()).total_seconds() | timestamp_custom('%S', false) | int > 1 %}{{ (as_datetime(state_attr('timer.timer3', 'finishes_at')) - now()).total_seconds() | timestamp_custom('%S', false) | int }} seconden {% endif %}{% endif %}te gaan. {%
            endif %}{% endif %}

custom_sentences/nl/timer_start.yaml

language: "nl"
intents:
  TimerStart:
    data:
#Alle tijden
      - sentences:
          - "(start|zet|<zou>) [een] timer (voor|van) {hours} (uur|uren) [en] {minutes} (minuut|minuten) [en] {seconds} (seconde|seconden) [[willen|kunnen] <doe>] [starten]"
#Alleen uur
      - sentences:
          - "(start|zet|<zou>) [een] timer (voor|van) {hours} (uur|uren) [[willen|kunnen] <doe>] [starten]"
        slots:
          seconds: 0
          minutes: 0
#Alleen minuut
      - sentences:
          - "(start|zet|<zou>) [een] timer (voor|van) {minutes} (minuut|minuten) [[willen|kunnen] <doe>] [starten]"
        slots:
          seconds: 0
          hours: 0
#Alleen seconde
      - sentences:
          - "(start|zet|<zou>) [een] timer (voor|van) {seconds} (seconde|seconden) [[willen|kunnen] <doe>] [starten]"
        slots:
          minutes: 0
          hours: 0
#Geen uur, wel minuten en seconden
      - sentences:
          - "(start|zet|<zou>) [een] timer (voor|van) {minutes} (minuut|minuten) [en] {seconds} (seconde|seconden) [[willen|kunnen] <doe>] [starten]"
        slots:
          hours: 0          
#Geen seconden, wel uren en minuten
      - sentences:
          - "(start|zet|<zou>) [een] timer (voor|van) {hours} (uur|uren) [en] {minutes} (minuut|minuten) [[willen|kunnen] <doe>] [starten]"
        slots:
          seconds: 0
#Halven
      - sentences:
          - "(start|zet|<zou>) [een] timer (voor|van) [{minutes}][ ]([en] [een] half | [en] [een] halve) minuut [[willen|kunnen] <doe>] [starten]"
          - "(start|zet|<zou>) [een] timer (voor|van) (0,5|0.5) minuut [[willen|kunnen] <doe>] [starten]"
        slots:
          hours: 0
          seconds: 30
      - sentences:
          - "(start|zet|<zou>) [een] timer (voor|van) (anderhalve|anderhalf) minuut [[willen|kunnen] <doe>] [starten]"
          - "(start|zet|<zou>) [een] timer (voor|van) (1,5|1.5) minuut [[willen|kunnen] <doe>] [starten]"
        slots:
          hours: 0
          seconds: 30
          minutes: 1
      - sentences:
          - "(start|zet|<zou>) [een] timer (voor|van) [{hours}][ ]([en] [een] half | [en] [een] halve) uur [[willen|kunnen] <doe>] [starten]"
        slots:
          minutes: 30
          seconds: 0
      - sentences:
          - "(start|zet|<zou>) [een] timer (voor|van) (anderhalve|anderhalf) uur [[willen|kunnen] <doe>] [starten]"
          - "(start|zet|<zou>) [een] timer (voor|van) (1,5|1.5) uur [[willen|kunnen] <doe>] [starten]"
        slots:
          hours: 1
          seconds: 0
          minutes: 30
lists:
  seconds:
    range:
      from: 0
      to: 120    
  minutes:
    range:
      from: 0
      to: 120
  hours:
    range:
      from: 0
      to: 24

custom_sentences/nl/timer_stop.yaml

language: "nl"
intents:
  TimerStop:
    data:
      - sentences:
          - "(stop|annuleer|<zou>) [de] {timer} timer[s] [[willen|kunnen] <doe>] [stoppen|annuleren|uitzetten]"
      - sentences:
          - "(stop|annuleer|<zou>) [de] timer [[willen|kunnen] <doe>] [stoppen|annuleren|uitzetten]"
        slots:
          timer: "timer.timer0"
lists:
  timer:
    values:
      - in: "eerste"
        out: "timer.timer1"
      - in: "tweede"
        out: "timer.timer2"
      - in: "derde"
        out: "timer.timer3"
      - in: "alle"
        out: "timer.timer1, timer.timer2, timer.timer3"

custom_sentences/nl/timer_duration.yaml

language: "nl"
intents:
  TimerDuration:
    data:
      - sentences:
          - "(hoe lang|hoeveel tijd) nog op de {timer} timer"
          - "hoe lang duurt de {timer} timer nog"
      - sentences:
          - "(hoe lang|hoeveel tijd) nog op de timer[s]"
          - "hoe lang [duurt|duren] de timer[s] nog"
        slots:
          timer: "timer.timer0"
lists:
  timer:
    values:
      - in: "eerste"
        out: "timer.timer1"
      - in: "tweede"
        out: "timer.timer2"
      - in: "derde"
        out: "timer.timer3"
      - in: "alle"
        out: "timer.timer1, timer.timer2, timer.timer3"

scripts.yaml

start_timer:
  alias: Start Timer
  mode: single
  sequence:
  - service: timer.start
    data_template:
      duration: "{{ duration }}"
    target:
      entity_id: >
        {% if states('timer.timer1') != 'active' and states('timer.timer1') != 'paused' %}
        timer.timer1
        {% elif states('timer.timer2') != 'active' and states('timer.timer2') != 'paused' %}
        timer.timer2
        {% else %}
        timer.timer3
        {% endif%}
  - service: input_boolean.turn_on
    target:
      entity_id: >
        {% if states('timer.timer1') != 'active' and states('timer.timer1') != 'paused' %}
        input_boolean.timer1_actief
        {% elif states('timer.timer2') != 'active' and states('timer.timer2') != 'paused' %}
        input_boolean.timer2_actief
        {% else %}
        input_boolean.timer3_actief
        {% endif%}
stop_timer:
  alias: Stop Timer
  mode: single
  sequence:
  - choose:
    - conditions:
      - condition: template
        value_template: "{{ (states.timer|selectattr('state','eq','active')|list|length > 2 and entity_id != 'timer.timer0') or (states.timer|selectattr('state','eq','active')|list|length == 2 and entity_id == 'timer.timer0') or (entity_id == 'timer.timer1, timer.timer2, timer.timer3') }}"
      - condition: template
        value_template: "{{ states(entity_id) == 'active' or entity_id == 'timer.timer1, timer.timer2, timer.timer3' }}"
      sequence:
      - service: input_boolean.turn_off
        target:
          entity_id: >
            {% if entity_id == 'timer.timer1, timer.timer2, timer.timer3' %}
            input_boolean.timer1_actief, input_boolean.timer2_actief, input_boolean.timer3_actief
            {% elif states(entity_id) == 'active' and entity_id != 'timer.timer0'%}
            {{ "input_boolean." + entity_id[6:] + "_actief"}}
            {% else %}
            input_boolean.timer1_actief, input_boolean.timer2_actief, input_boolean.timer3_actief
            {% endif %}
    default:
    - service: script.nothing
2 Likes

Thanks so much for this!
I’ve tried my best to configure it, but I suspect perhaps something has been lost in translation as I get this error:
Traceback (most recent call last):
File “/usr/src/homeassistant/homeassistant/components/assist_pipeline/pipeline.py”, line 518, in recognize_intent
conversation_result = await conversation.async_converse(
File “/usr/src/homeassistant/homeassistant/components/conversation/init.py”, line 373, in async_converse
result = await agent.async_process(
File “/usr/src/homeassistant/homeassistant/components/conversation/default_agent.py”, line 177, in async_process
result = await self.hass.async_add_executor_job(
File “/usr/local/lib/python3.10/concurrent/futures/thread.py”, line 58, in run
result = self.fn(*self.args, **self.kwargs)
File “/usr/src/homeassistant/homeassistant/components/conversation/default_agent.py”, line 252, in _recognize
for result in recognize_all(
File “/usr/local/lib/python3.10/site-packages/hassil/recognize.py”, line 258, in recognize_all
for maybe_match_context in maybe_match_contexts:
File “/usr/local/lib/python3.10/site-packages/hassil/recognize.py”, line 500, in match_expression
group_contexts = [
File “/usr/local/lib/python3.10/site-packages/hassil/recognize.py”, line 500, in
group_contexts = [
File “/usr/local/lib/python3.10/site-packages/hassil/recognize.py”, line 492, in match_expression
yield from match_expression(settings, context, item)
File “/usr/local/lib/python3.10/site-packages/hassil/recognize.py”, line 500, in match_expression
group_contexts = [
File “/usr/local/lib/python3.10/site-packages/hassil/recognize.py”, line 500, in <listcomp>
group_contexts = [
File “/usr/local/lib/python3.10/site-packages/hassil/recognize.py”, line 615, in match_expression
raise MissingRuleError(f"Missing expansion rule <{rule_ref.rule_name}>")
hassil.recognize.MissingRuleError: Missing expansion rule <would>

I suspect somewhere in translation I’ve missed something up, especially around perhaps the meaning of “would”. :-/

This is what my configurations look like:
configuration.yaml

intent_script: !include config_assist_intent_script.yaml

config_assist_intent_script.yaml

TimerStart:
    speech:
      text: >
        {{ (["No problem. ", "Good. ", "Of course. ", ""] | random) + (["I'll start the timer for ", "Timer started for ", "I'll set a timer for ", "Timer activated for "] | random)}}{% if (hours | int(default=0)) == 1 %}{{ (hours | int)}} hour{% elif (hours | int(default=0)) > 1 %}{{ (hours | int)}} hours{% endif %}{% if (hours | int(default=0)) > 0 and ((minutes | int(default=0)) > 0 or (seconds | int(default=0)) > 0) %} en {% endif %}{% if (minutes | int(default=0)) == 1 %}{{ (minutes | int)}} minute{% elif (minutes | int(default=0)) > 1 %}{{ (minutes | int)}} minutes{% endif %}{% if (minutes | int(default=0)) > 0 and (seconds | int(default=0)) > 0 %} en {% endif %}{% if (seconds | int(default=0)) == 1 %}{{ (seconds | int)}} second{% elif (seconds | int(default=0)) > 1 %}{{ (seconds | int)}} seconds{% endif %}.
    action:
      service: script.voice_start_timer
      data_template:
        duration: "{{hours | int(default=0)}}:{{ minutes | int(default=0) }}:{{ seconds | int(default=0) }}"
        entity_id: >
          {% if states('timer.timer1') != 'active' and states('timer.timer1') != 'paused' %} timer.timer1
          {% elif states('timer.timer2') != 'active' and states('timer.timer2') != 'paused' %} timer.timer2
          {% else %} timer.timer3{% endif%}

TimerStop:
    speech:
      text: >       
        {% if states.timer|selectattr('state','eq','active')|list|length == 0 %}
        There are currently no timers active.
        {% elif (states.timer|selectattr('state','eq','active')|list|length -1 == 1) or (timer != 'timer.timer0') and states(timer) == 'active'%}
        {{ (["Agreement. ", "Understood. ", "Good. ", ""] | random) }}{{ (["Cancelled.", "Timer cancelled.", "Stopped.", "Timer stopped.", "Deactivated.", "Timer deactivated.", "Timer disabled.", "Disabled."] | random) }}
        {% elif (states.timer|selectattr('state','eq','active')|list|length > 1) and (timer == 'timer.timer1, timer.timer2, timer.timer3') %}
        {{ (["Agreement. ", "Understood. ", "Good. ", ""] | random) }}{{ (["Cancelled.", "All timers cancelled.", "Stopped.", "All timers stopped.", "Deactivated.", "All timers deactivated.", "All timers disabled.", "Disabled."] | random) }}
        {% else %}{% if states(timer) != 'active' %}This timer is currently not active. {% endif %}{% if states.timer|selectattr('state','eq','active')|list|length == 2 %}There is currently {{ states.timer|selectattr('state','eq','active')|list|length - 1}} timer active. {% 
                     else %}There are currently {{ states.timer|selectattr('state','eq','active')|list|length - 1}} timers active. {% endif %}{% 
            if states.timer.timer1.state == 'active' %}{% 
              set duration = "" %}{% 
              if states.timer.timer1.attributes.duration[:2] | int(default=0) > 9 %}{%
              set hr = states.timer.timer1.attributes.duration[:2] %}{% else %}{%
              set hr = states.timer.timer1.attributes.duration[:1] %}{% endif %}{%
              if states.timer.timer1.attributes.duration[3:][:2] | int(default=0) > 9 %}{%
              set min = states.timer.timer1.attributes.duration[3:][:2] %}{% else %}{%
              set min = states.timer.timer1.attributes.duration[3:][:1] %}{% endif %}{%
              if states.timer.timer1.attributes.duration[5:] | int(default=0) > 9 %}{%
              set sec = states.timer.timer1.attributes.duration[5:] %}{% else %}{%
              set sec = states.timer.timer1.attributes.duration[6:] %}{% endif %}{%
              
              if hr | int(default=0) > 0 %}{% set duration = duration + hr + " hour " %}{% endif %}{%
              if min | int(default=0) == 1 %}{% set duration = duration + min + " minute " %}{%
              elif min | int(default=0) > 1 %}{% set duration = duration + min + " minutes " %}{% endif %}{%
              if sec | int(default=0) == 1 %}{% set duration = duration + sec + " second " %}{%
              elif sec | int(default=0) > 1 %}{% set duration = duration + sec + " seconds " %}{% endif %}The {%
              if (states.timer|selectattr('state','eq','active')|list|length - 1) != 1%}first {% endif %}timer of {{ duration }}is active with still {%
              if (states['timer.timer1'].attributes.duration != "none") or (states['timer.timer1'].state == "active") -%}{%
              if (as_datetime(state_attr('timer.timer1', 'finishes_at')) - now()).total_seconds() | timestamp_custom('%H', false) | int > 0 %}{{ (as_datetime(state_attr('timer.timer1', 'finishes_at')) - now()).total_seconds() | timestamp_custom('%H', false) | int }} hour {% endif %}{%
              if (as_datetime(state_attr('timer.timer1', 'finishes_at')) - now()).total_seconds() | timestamp_custom('%M', false) | int == 1 %} 1 minute{%
              elif (as_datetime(state_attr('timer.timer1', 'finishes_at')) - now()).total_seconds() | timestamp_custom('%M', false) | int > 1 %}{{ (as_datetime(state_attr('timer.timer1', 'finishes_at')) - now()).total_seconds() | timestamp_custom('%M', false) | int }} minutes {% endif %}{%
              if (as_datetime(state_attr('timer.timer1', 'finishes_at')) - now()).total_seconds() | timestamp_custom('%H', false) | int > 0 %}{%
              elif (as_datetime(state_attr('timer.timer1', 'finishes_at')) - now()).total_seconds() | timestamp_custom('%S', false) | int == 1 %} 1 second{%
              elif (as_datetime(state_attr('timer.timer1', 'finishes_at')) - now()).total_seconds() | timestamp_custom('%S', false) | int > 1 %}{{ (as_datetime(state_attr('timer.timer1', 'finishes_at')) - now()).total_seconds() | timestamp_custom('%S', false) | int }} seconds {% endif %}{% endif %}to go. {%
            endif %}{%
            if states.timer.timer2.state == 'active' %}{% 
              set duration = "" %}{% 
              if states.timer.timer2.attributes.duration[:2] | int(default=0) > 9 %}{%
              set hr = states.timer.timer2.attributes.duration[:2] %}{% else %}{%
              set hr = states.timer.timer2.attributes.duration[:1] %}{% endif %}{%
              if states.timer.timer2.attributes.duration[3:][:2] | int(default=0) > 9 %}{%
              set min = states.timer.timer2.attributes.duration[3:][:2] %}{% else %}{%
              set min = states.timer.timer2.attributes.duration[3:][:1] %}{% endif %}{%
              if states.timer.timer2.attributes.duration[5:] | int(default=0) > 9 %}{%
              set sec = states.timer.timer2.attributes.duration[5:] %}{% else %}{%
              set sec = states.timer.timer2.attributes.duration[6:] %}{% endif %}{%
              
              if hr | int(default=0) > 0 %}{% set duration = duration + hr + " hour " %}{% endif %}{%
              if min | int(default=0) == 1 %}{% set duration = duration + min + " minute " %}{%
              elif min | int(default=0) > 1 %}{% set duration = duration + min + " minutes " %}{% endif %}{%
              if sec | int(default=0) == 1 and hr | int(default=0) == 0 %}{% set duration = duration + sec + " second " %}{%
              elif sec | int(default=0) > 1 and hr | int(default=0) == 0 %}{% set duration = duration + sec + " seconds " %}{% endif %}De {%
              if (states.timer|selectattr('state','eq','active')|list|length - 1) != 1%}second {% endif %}timer van {{ duration }}is active with still {%
              if (states['timer.timer2'].attributes.duration != "none") or (states['timer.timer2'].state == "active") -%}{%
              if (as_datetime(state_attr('timer.timer2', 'finishes_at')) - now()).total_seconds() | timestamp_custom('%H', false) | int > 0 %}{{ (as_datetime(state_attr('timer.timer2', 'finishes_at')) - now()).total_seconds() | timestamp_custom('%H', false) | int }} hour {% endif %}{%
              if (as_datetime(state_attr('timer.timer2', 'finishes_at')) - now()).total_seconds() | timestamp_custom('%M', false) | int == 1 %} 1 minute{%
              elif (as_datetime(state_attr('timer.timer2', 'finishes_at')) - now()).total_seconds() | timestamp_custom('%M', false) | int > 1 %}{{ (as_datetime(state_attr('timer.timer2', 'finishes_at')) - now()).total_seconds() | timestamp_custom('%M', false) | int }} minutes {% endif %}{%
              if (as_datetime(state_attr('timer.timer2', 'finishes_at')) - now()).total_seconds() | timestamp_custom('%H', false) | int > 0 %}{%
              elif (as_datetime(state_attr('timer.timer2', 'finishes_at')) - now()).total_seconds() | timestamp_custom('%S', false) | int == 1 %} 1 second{%
              elif (as_datetime(state_attr('timer.timer2', 'finishes_at')) - now()).total_seconds() | timestamp_custom('%S', false) | int > 1 %}{{ (as_datetime(state_attr('timer.timer2', 'finishes_at')) - now()).total_seconds() | timestamp_custom('%S', false) | int }} seconds {% endif %}{% endif %}to go. {%
            endif %}{%
            
            if states.timer.timer3.state == 'active' %}{% 
              set duration = "" %}{% 
              if states.timer.timer3.attributes.duration[:2] | int(default=0) > 9 %}{%
              set hr = states.timer.timer3.attributes.duration[:2] %}{% else %}{%
              set hr = states.timer.timer3.attributes.duration[:1] %}{% endif %}{%
              if states.timer.timer3.attributes.duration[3:][:2] | int(default=0) > 9 %}{%
              set min = states.timer.timer3.attributes.duration[3:][:2] %}{% else %}{%
              set min = states.timer.timer3.attributes.duration[3:][:1] %}{% endif %}{%
              if states.timer.timer3.attributes.duration[5:] | int(default=0) > 9 %}{%
              set sec = states.timer.timer3.attributes.duration[5:] %}{% else %}{%
              set sec = states.timer.timer3.attributes.duration[6:] %}{% endif %}{%
              
              if hr | int(default=0) > 0 %}{% set duration = duration + hr + " hour " %}{% endif %}{%
              if min | int(default=0) == 1 %}{% set duration = duration + min + " minute " %}{%
              elif min | int(default=0) > 1 %}{% set duration = duration + min + " minutes " %}{% endif %}{%
              if sec | int(default=0) == 1 %}{% set duration = duration + sec + " second " %}{%
              elif sec | int(default=0) > 1 %}{% set duration = duration + sec + " seconds " %}{% endif %}De {%
              if (states.timer|selectattr('state','eq','active')|list|length - 1) != 1%}derde {% endif %}timer of {{ duration }}is active with still {%
              if (states['timer.timer3'].attributes.duration != "none") or (states['timer.timer3'].state == "active") -%}{%
              if (as_datetime(state_attr('timer.timer3', 'finishes_at')) - now()).total_seconds() | timestamp_custom('%H', false) | int > 0 %}{{ (as_datetime(state_attr('timer.timer3', 'finishes_at')) - now()).total_seconds() | timestamp_custom('%H', false) | int }} hour {% endif %}{%
              if (as_datetime(state_attr('timer.timer3', 'finishes_at')) - now()).total_seconds() | timestamp_custom('%M', false) | int == 1 %} 1 minute{%
              elif (as_datetime(state_attr('timer.timer3', 'finishes_at')) - now()).total_seconds() | timestamp_custom('%M', false) | int > 1 %}{{ (as_datetime(state_attr('timer.timer3', 'finishes_at')) - now()).total_seconds() | timestamp_custom('%M', false) | int }} minutes {% endif %}{%
              if (as_datetime(state_attr('timer.timer3', 'finishes_at')) - now()).total_seconds() | timestamp_custom('%H', false) | int > 0 %}{%
              elif (as_datetime(state_attr('timer.timer3', 'finishes_at')) - now()).total_seconds() | timestamp_custom('%S', false) | int == 1 %} 1 second{%
              elif (as_datetime(state_attr('timer.timer3', 'finishes_at')) - now()).total_seconds() | timestamp_custom('%S', false) | int > 1 %}{{ (as_datetime(state_attr('timer.timer3', 'finishes_at')) - now()).total_seconds() | timestamp_custom('%S', false) | int }} seconds {% endif %}{% endif %}to go. {%
            endif %}{{ (["Please specify which timer you want to stop.", "Please tell me which timer you want to stop.", "Please name which timer you want to stop.", ""] | random) }}{% endif %}
    action:
      service: script.voice_stop_timer
      data_template:
        entity_id: "{{ timer }}"
               
TimerDuration:
    speech:
      text: >       
        {% if states.timer|selectattr('state','eq','active')|list|length == 0 %}
        There are currently no timers active.
        {% else %}{% if states.timer|selectattr('state','eq','active')|list|length == 2 and timer == 'timer.timer0' %}There is currently {{ states.timer|selectattr('state','eq','active')|list|length - 1}} timer active. {% 
        elif timer == 'timer.timer0' %}
        There are currently {{ states.timer|selectattr('state','eq','active')|list|length - 1}} timers active. {% endif %}{% 
        if states.timer.timer1.state == 'active' and (timer == 'timer.timer1' or timer == 'timer.timer0') %}{% 
        set duration = "" %}{% 
        if states.timer.timer1.attributes.duration[:2] | int(default=0) > 9 %}{%
        set hr = states.timer.timer1.attributes.duration[:2] %}{% else %}{%
        set hr = states.timer.timer1.attributes.duration[:1] %}{% endif %}{%
        if states.timer.timer1.attributes.duration[3:][:2] | int(default=0) > 9 %}{%
        set min = states.timer.timer1.attributes.duration[3:][:2] %}{% else %}{%
        set min = states.timer.timer1.attributes.duration[3:][:1] %}{% endif %}{%
        if states.timer.timer1.attributes.duration[5:] | int(default=0) > 9 %}{%
        set sec = states.timer.timer1.attributes.duration[5:] %}{% else %}{%
        set sec = states.timer.timer1.attributes.duration[6:] %}{% endif %}{%
        
        if hr | int(default=0) > 0 %}{% set duration = duration + hr + " hour " %}{% endif %}{%
        if min | int(default=0) == 1 %}{% set duration = duration + min + " minute " %}{%
        elif min | int(default=0) > 1 %}{% set duration = duration + min + " minutes " %}{% endif %}{%
        if sec | int(default=0) == 1 %}{% set duration = duration + sec + " second " %}{%
        elif sec | int(default=0) > 1 %}{% set duration = duration + sec + " seconds " %}{% endif %}The first timer of {{ duration }}is active with still {%
        if (states['timer.timer1'].attributes.duration != "none") or (states['timer.timer1'].state == "active") -%}{%
        if (as_datetime(state_attr('timer.timer1', 'finishes_at')) - now()).total_seconds() | timestamp_custom('%H', false) | int > 0 %}{{ (as_datetime(state_attr('timer.timer1', 'finishes_at')) - now()).total_seconds() | timestamp_custom('%H', false) | int }} hour {% endif %}{%
        if (as_datetime(state_attr('timer.timer1', 'finishes_at')) - now()).total_seconds() | timestamp_custom('%M', false) | int == 1 %} 1 minute{%
        elif (as_datetime(state_attr('timer.timer1', 'finishes_at')) - now()).total_seconds() | timestamp_custom('%M', false) | int > 1 %}{{ (as_datetime(state_attr('timer.timer1', 'finishes_at')) - now()).total_seconds() | timestamp_custom('%M', false) | int }} minutes {% endif %}{%
        if (as_datetime(state_attr('timer.timer1', 'finishes_at')) - now()).total_seconds() | timestamp_custom('%S', false) | int == 1 %} 1 second{%
        elif (as_datetime(state_attr('timer.timer1', 'finishes_at')) - now()).total_seconds() | timestamp_custom('%S', false) | int > 1 %}{{ (as_datetime(state_attr('timer.timer1', 'finishes_at')) - now()).total_seconds() | timestamp_custom('%S', false) | int }} seconds {% endif %}{% endif %}to go. {%
        endif %}{%
        if states.timer.timer2.state == 'active' and (timer == 'timer.timer2' or timer == 'timer.timer0') %}{% 
        	set duration = "" %}{% 
        	if states.timer.timer2.attributes.duration[:2] | int(default=0) > 9 %}{%
        	set hr = states.timer.timer2.attributes.duration[:2] %}{% else %}{%
        	set hr = states.timer.timer2.attributes.duration[:1] %}{% endif %}{%
        	if states.timer.timer2.attributes.duration[3:][:2] | int(default=0) > 9 %}{%
        	set min = states.timer.timer2.attributes.duration[3:][:2] %}{% else %}{%
        	set min = states.timer.timer2.attributes.duration[3:][:1] %}{% endif %}{%
        	if states.timer.timer2.attributes.duration[5:] | int(default=0) > 9 %}{%
        	set sec = states.timer.timer2.attributes.duration[5:] %}{% else %}{%
        	set sec = states.timer.timer2.attributes.duration[6:] %}{% endif %}{%
        	
        	if hr | int(default=0) > 0 %}{% set duration = duration + hr + " hour " %}{% endif %}{%
        	if min | int(default=0) == 1 %}{% set duration = duration + min + " minute " %}{%
        	elif min | int(default=0) > 1 %}{% set duration = duration + min + " minutes " %}{% endif %}{%
        	if sec | int(default=0) == 1 %}{% set duration = duration + sec + " second " %}{%
        	elif sec | int(default=0) > 1 %}{% set duration = duration + sec + " seconds " %}{% endif %}The second timer of {{ duration }}is active with still {%
        	if (states['timer.timer2'].attributes.duration != "none") or (states['timer.timer2'].state == "active") -%}{%
        	if (as_datetime(state_attr('timer.timer2', 'finishes_at')) - now()).total_seconds() | timestamp_custom('%H', false) | int > 0 %}{{ (as_datetime(state_attr('timer.timer2', 'finishes_at')) - now()).total_seconds() | timestamp_custom('%H', false) | int }} hour {% endif %}{%
        	if (as_datetime(state_attr('timer.timer2', 'finishes_at')) - now()).total_seconds() | timestamp_custom('%M', false) | int == 1 %} 1 minute{%
        	elif (as_datetime(state_attr('timer.timer2', 'finishes_at')) - now()).total_seconds() | timestamp_custom('%M', false) | int > 1 %}{{ (as_datetime(state_attr('timer.timer2', 'finishes_at')) - now()).total_seconds() | timestamp_custom('%M', false) | int }} minutes {% endif %}{%
        	if (as_datetime(state_attr('timer.timer2', 'finishes_at')) - now()).total_seconds() | timestamp_custom('%S', false) | int == 1 %} 1 second{%
        	elif (as_datetime(state_attr('timer.timer2', 'finishes_at')) - now()).total_seconds() | timestamp_custom('%S', false) | int > 1 %}{{ (as_datetime(state_attr('timer.timer2', 'finishes_at')) - now()).total_seconds() | timestamp_custom('%S', false) | int }} seconds {% endif %}{% endif %}to go. {%
        endif %}{%
        
        if states.timer.timer3.state == 'active' and (timer == 'timer.timer3' or timer == 'timer.timer0') %}{% 
        	set duration = "" %}{% 
        	if states.timer.timer3.attributes.duration[:2] | int(default=0) > 9 %}{%
        	set hr = states.timer.timer3.attributes.duration[:2] %}{% else %}{%
        	set hr = states.timer.timer3.attributes.duration[:1] %}{% endif %}{%
        	if states.timer.timer3.attributes.duration[3:][:2] | int(default=0) > 9 %}{%
        	set min = states.timer.timer3.attributes.duration[3:][:2] %}{% else %}{%
        	set min = states.timer.timer3.attributes.duration[3:][:1] %}{% endif %}{%
        	if states.timer.timer3.attributes.duration[5:] | int(default=0) > 9 %}{%
        	set sec = states.timer.timer3.attributes.duration[5:] %}{% else %}{%
        	set sec = states.timer.timer3.attributes.duration[6:] %}{% endif %}{%
        	
        	if hr | int(default=0) > 0 %}{% set duration = duration + hr + " hour " %}{% endif %}{%
        	if min | int(default=0) == 1 %}{% set duration = duration + min + " minute " %}{%
        	elif min | int(default=0) > 1 %}{% set duration = duration + min + " minutes " %}{% endif %}{%
        	if sec | int(default=0) == 1 %}{% set duration = duration + sec + " second " %}{%
        	elif sec | int(default=0) > 1 %}{% set duration = duration + sec + " seconds " %}{% endif %}The third timer of {{ duration }}is active with still {%
        	if (states['timer.timer3'].attributes.duration != "none") or (states['timer.timer3'].state == "active") -%}{%
        	if (as_datetime(state_attr('timer.timer3', 'finishes_at')) - now()).total_seconds() | timestamp_custom('%H', false) | int > 0 %}{{ (as_datetime(state_attr('timer.timer3', 'finishes_at')) - now()).total_seconds() | timestamp_custom('%H', false) | int }} hour {% endif %}{%
        	if (as_datetime(state_attr('timer.timer3', 'finishes_at')) - now()).total_seconds() | timestamp_custom('%M', false) | int == 1 %} 1 minute{%
        	elif (as_datetime(state_attr('timer.timer3', 'finishes_at')) - now()).total_seconds() | timestamp_custom('%M', false) | int > 1 %}{{ (as_datetime(state_attr('timer.timer3', 'finishes_at')) - now()).total_seconds() | timestamp_custom('%M', false) | int }} minutes {% endif %}{%
        	if (as_datetime(state_attr('timer.timer3', 'finishes_at')) - now()).total_seconds() | timestamp_custom('%S', false) | int == 1 %} 1 second{%
        	elif (as_datetime(state_attr('timer.timer3', 'finishes_at')) - now()).total_seconds() | timestamp_custom('%S', false) | int > 1 %}{{ (as_datetime(state_attr('timer.timer3', 'finishes_at')) - now()).total_seconds() | timestamp_custom('%S', false) | int }} seconds {% endif %}{% endif %}to go. {%
        endif %}{% endif %}

custom_sentences/en/timer_start.yaml

language: "en"
intents:
  TimerStart:
    data:
#All times
      - sentences:
          - "(start|set|<would>) [a] timer (for|from) {hours} (hour|hours) [and] {minutes} (minute|minutes) [and] {seconds} (second|seconds) [[want|can] <do>] [start]"
#All one hour
      - sentences:
          - "(start|set|<would>) [a] timer (for|from) {hours} (hour|hours) [[want|can] <do>] [start]"
        slots:
          seconds: 0
          minutes: 0
#All one minute
      - sentences:
          - "(start|set|<would>) [a] timer (for|from) {minutes} (minute|minutes) [[want|can] <do>] [start]"
        slots:
          seconds: 0
          hours: 0
#All one second
      - sentences:
          - "(start|set|<would>) [a] timer (for|from) {seconds} (second|seconds) [[want|can] <do>] [start]"
        slots:
          minutes: 0
          hours: 0
#Gone hour, wel minutes and seconds
      - sentences:
          - "(start|set|<would>) [a] timer (for|from) {minutes} (minute|minutes) [en] {seconds} (second|seconds) [[want|can] <do>] [start]"
        slots:
          hours: 0          
#Gone seconds, wel hours and minutes
      - sentences:
          - "(start|set|<would>) [a] timer (for|from) {hours} (hour|hours) [en] {minutes} (minute|minutes) [[want|can] <do>] [start]"
        slots:
          seconds: 0
#Halven
      - sentences:
          - "(start|set|<would>) [a] timer (for|from) [{minutes}][ ]([en] [one] half | [en] [one] halve) minute [[want|can] <do>] [start]"
          - "(start|set|<would>) [a] timer (for|from) (0,5|0.5) minute [[want|can] <do>] [start]"
        slots:
          hours: 0
          seconds: 30
      - sentences:
          - "(start|set|<would>) [a] timer (for|from) (anderhalve|anderhalf) minute [[want|can] <do>] [start]"
          - "(start|set|<would>) [a] timer (for|from) (1,5|1.5) minute [[want|can] <do>] [start]"
        slots:
          hours: 0
          seconds: 30
          minutes: 1
      - sentences:
          - "(start|move|<would>) [a] timer (for|from) [{hours}][ ]([en] [one] half | [en] [one] halve) hour [[want|can] <do>] [start]"
        slots:
          minutes: 30
          seconds: 0
      - sentences:
          - "(start|move|<would>) [a] timer (for|from) (anderhalve|anderhalf) hour [[want|can] <do>] [start]"
          - "(start|move|<would>) [a] timer (for|from) (1,5|1.5) hour [[want|can] <do>] [start]"
        slots:
          hours: 1
          seconds: 0
          minutes: 30
lists:
  seconds:
    range:
      from: 0
      to: 120    
  minutes:
    range:
      from: 0
      to: 120
  hours:
    range:
      from: 0
      to: 24

custom_sentences/en/timer_stop.yaml

language: "en"
intents:
  TimerStop:
    data:
      - sentences:
          - "(stop|cancel|<would>) [the] {timer} timer[s] [[want|can] <do>] [stop|annul|turn off]"
      - sentences:
          - "(stop|cancel|<would>) [the] timer [[want|can] <do>] [stop|annul|turn off]"
        slots:
          timer: "timer.timer0"
lists:
  timer:
    values:
      - in: "first"
        out: "timer.timer1"
      - in: "second"
        out: "timer.timer2"
      - in: "third"
        out: "timer.timer3"
      - in: "all"
        out: "timer.timer1, timer.timer2, timer.timer3"

custom_sentences/en/timer_duration.yaml

language: "en"
intents:
  TimerDuration:
    data:
      - sentences:
          - "(how long|how much time) still on the {timer} timer"
          - "how long does the {timer} timer still"
      - sentences:
          - "(how long|how much time) still on the timer[s]"
          - "how long [takes|last] the timer[s] still"
        slots:
          timer: "timer.timer0"
lists:
  timer:
    values:
      - in: "first"
        out: "timer.timer1"
      - in: "second"
        out: "timer.timer2"
      - in: "third"
        out: "timer.timer3"
      - in: "all"
        out: "timer.timer1, timer.timer2, timer.timer3"

scripts.yaml

voice_start_timer:
  alias: VOICE - Start timer
  sequence:
  - service: timer.start
    data_template:
      duration: '{{ duration }}'
    target:
      entity_id: '{% if states(''timer.timer1'') != ''active'' and states(''timer.timer1'')
        != ''paused'' %} timer.timer1 {% elif states(''timer.timer2'') != ''active''
        and states(''timer.timer2'') != ''paused'' %} timer.timer2 {% else %} timer.timer3
        {% endif%}

        '
  - service: input_boolean.turn_on
    target:
      entity_id: '{% if states(''timer.timer1'') != ''active'' and states(''timer.timer1'')
        != ''paused'' %} input_boolean.timer1_actief {% elif states(''timer.timer2'')
        != ''active'' and states(''timer.timer2'') != ''paused'' %} input_boolean.timer2_active
        {% else %} input_boolean.timer3_active {% endif%}

        '
  mode: single
voice_stop_timer:
  alias: VOICE - Stop timer
  sequence:
  - choose:
    - conditions:
      - condition: template
        value_template: '{{ (states.timer|selectattr(''state'',''eq'',''active'')|list|length
          > 2 and entity_id != ''timer.timer0'') or (states.timer|selectattr(''state'',''eq'',''active'')|list|length
          == 2 and entity_id == ''timer.timer0'') or (entity_id == ''timer.timer1,
          timer.timer2, timer.timer3'') }}'
      - condition: template
        value_template: '{{ states(entity_id) == ''active'' or entity_id == ''timer.timer1,
          timer.timer2, timer.timer3'' }}'
      sequence:
      - service: input_boolean.turn_off
        target:
          entity_id: '{% if entity_id == ''timer.timer1, timer.timer2, timer.timer3''
            %} input_boolean.timer1_active, input_boolean.timer2_active, input_boolean.timer3_active
            {% elif states(entity_id) == ''active'' and entity_id != ''timer.timer0''%}
            {{ "input_boolean." + entity_id[6:] + "_active"}} {% else %} input_boolean.timer1_active,
            input_boolean.timer2_active, input_boolean.timer3_active {% endif %}

            '
    default:
    - service: script.nothing
  mode: single

The Dutch intents have “zou” in its “library” with several options pre-figured. I think the error is that would doesnt have that. Remove the <>.

So it’s:
(start|set|would) …

Does that help?

That’s progress, now getting this at least:
image

I think I might play with the structure of the sentences a bit, as I’m not sure if the [start] is required?

Can you show the log output again?
And these [ ] brackets mean the word is optional in a sentence

Maybe try this:

- "[could|would] [you] (start|set) [a] timer (for|from|of) {minutes} (minute|minutes)"

Oddly enough, I’ve made it incredibly specific (as we have been trained using Alexa for years, so always set a timer with the same command), and still get the same error:

I wonder if I’m missing something else?

Hmm… then im not sure. Where did you place the files? What folders?

I got this working, thanks @DonNL & thanks @DeLorean for the translation work. When I ask how long is left on my timer, it tells me I have 0 timers active but then proceeds to tell me the time left on the timer. Weird bug, I’ll try to look into it.

1 Like

Did you actually get it working via voice?
I still wasn’t able to get it to do anything. :frowning:

Yes, it work with voice (apart from bug mentioned) you need to manually create the timers themselves (In helpers) you obviously need an automation for when the timer expires. I had a few problems with it not finding the scripts and Had to recreate them.

Since this was my first play with voice, I created a very simple intent where I say ‘test’ and I get phone notification confirming. That helped me understand how it all works.

1 Like

Any chance you can share your intents and intent scripts please?
I’ll see if they work for me, as mine didn’t. :frowning:

contents of /config/config_assist_intent_script.yaml

TimerStart:
    speech:
      text: >
        {{ (["No problem. ", "Good. ", "Of course. ", ""] | random) + (["I'll start the timer for ", "Timer started for ", "I'll set a timer for ", "Timer activated for "] | random)}}{% if (hours | int(default=0)) == 1 %}{{ (hours | int)}} hour{% elif (hours | int(default=0)) > 1 %}{{ (hours | int)}} hours{% endif %}{% if (hours | int(default=0)) > 0 and ((minutes | int(default=0)) > 0 or (seconds | int(default=0)) > 0) %} en {% endif %}{% if (minutes | int(default=0)) == 1 %}{{ (minutes | int)}} minute{% elif (minutes | int(default=0)) > 1 %}{{ (minutes | int)}} minutes{% endif %}{% if (minutes | int(default=0)) > 0 and (seconds | int(default=0)) > 0 %} en {% endif %}{% if (seconds | int(default=0)) == 1 %}{{ (seconds | int)}} second{% elif (seconds | int(default=0)) > 1 %}{{ (seconds | int)}} seconds{% endif %}.
    action:
      service: script.1689339465689
      data_template:
        duration: "{{hours | int(default=0)}}:{{ minutes | int(default=0) }}:{{ seconds | int(default=0) }}"
        entity_id: >
          {% if states('timer.timer1') != 'active' and states('timer.timer1') != 'paused' %} timer.timer1
          {% elif states('timer.timer2') != 'active' and states('timer.timer2') != 'paused' %} timer.timer2
          {% else %} timer.timer3{% endif%}

TimerStop:
    speech:
      text: >       
        {% if states.timer|selectattr('state','eq','active')|list|length == 0 %}
        There are currently no timers active.
        {% elif (states.timer|selectattr('state','eq','active')|list|length -1 == 1) or (timer != 'timer.timer0') and states(timer) == 'active'%}
        {{ (["Agreement. ", "Understood. ", "Good. ", ""] | random) }}{{ (["Cancelled.", "Timer cancelled.", "Stopped.", "Timer stopped.", "Deactivated.", "Timer deactivated.", "Timer disabled.", "Disabled."] | random) }}
        {% elif (states.timer|selectattr('state','eq','active')|list|length > 1) and (timer == 'timer.timer1, timer.timer2, timer.timer3') %}
        {{ (["Agreement. ", "Understood. ", "Good. ", ""] | random) }}{{ (["Cancelled.", "All timers cancelled.", "Stopped.", "All timers stopped.", "Deactivated.", "All timers deactivated.", "All timers disabled.", "Disabled."] | random) }}
        {% else %}{% if states(timer) != 'active' %}This timer is currently not active. {% endif %}{% if states.timer|selectattr('state','eq','active')|list|length == 2 %}There is currently {{ states.timer|selectattr('state','eq','active')|list|length - 1}} timer active. {% 
                     else %}There are currently {{ states.timer|selectattr('state','eq','active')|list|length - 1}} timers active. {% endif %}{% 
            if states.timer.timer1.state == 'active' %}{% 
              set duration = "" %}{% 
              if states.timer.timer1.attributes.duration[:2] | int(default=0) > 9 %}{%
              set hr = states.timer.timer1.attributes.duration[:2] %}{% else %}{%
              set hr = states.timer.timer1.attributes.duration[:1] %}{% endif %}{%
              if states.timer.timer1.attributes.duration[3:][:2] | int(default=0) > 9 %}{%
              set min = states.timer.timer1.attributes.duration[3:][:2] %}{% else %}{%
              set min = states.timer.timer1.attributes.duration[3:][:1] %}{% endif %}{%
              if states.timer.timer1.attributes.duration[5:] | int(default=0) > 9 %}{%
              set sec = states.timer.timer1.attributes.duration[5:] %}{% else %}{%
              set sec = states.timer.timer1.attributes.duration[6:] %}{% endif %}{%
              
              if hr | int(default=0) > 0 %}{% set duration = duration + hr + " hour " %}{% endif %}{%
              if min | int(default=0) == 1 %}{% set duration = duration + min + " minute " %}{%
              elif min | int(default=0) > 1 %}{% set duration = duration + min + " minutes " %}{% endif %}{%
              if sec | int(default=0) == 1 %}{% set duration = duration + sec + " second " %}{%
              elif sec | int(default=0) > 1 %}{% set duration = duration + sec + " seconds " %}{% endif %}The {%
              if (states.timer|selectattr('state','eq','active')|list|length - 1) != 1%}first {% endif %}timer of {{ duration }}is active with still {%
              if (states['timer.timer1'].attributes.duration != "none") or (states['timer.timer1'].state == "active") -%}{%
              if (as_datetime(state_attr('timer.timer1', 'finishes_at')) - now()).total_seconds() | timestamp_custom('%H', false) | int > 0 %}{{ (as_datetime(state_attr('timer.timer1', 'finishes_at')) - now()).total_seconds() | timestamp_custom('%H', false) | int }} hour {% endif %}{%
              if (as_datetime(state_attr('timer.timer1', 'finishes_at')) - now()).total_seconds() | timestamp_custom('%M', false) | int == 1 %} 1 minute{%
              elif (as_datetime(state_attr('timer.timer1', 'finishes_at')) - now()).total_seconds() | timestamp_custom('%M', false) | int > 1 %}{{ (as_datetime(state_attr('timer.timer1', 'finishes_at')) - now()).total_seconds() | timestamp_custom('%M', false) | int }} minutes {% endif %}{%
              if (as_datetime(state_attr('timer.timer1', 'finishes_at')) - now()).total_seconds() | timestamp_custom('%H', false) | int > 0 %}{%
              elif (as_datetime(state_attr('timer.timer1', 'finishes_at')) - now()).total_seconds() | timestamp_custom('%S', false) | int == 1 %} 1 second{%
              elif (as_datetime(state_attr('timer.timer1', 'finishes_at')) - now()).total_seconds() | timestamp_custom('%S', false) | int > 1 %}{{ (as_datetime(state_attr('timer.timer1', 'finishes_at')) - now()).total_seconds() | timestamp_custom('%S', false) | int }} seconds {% endif %}{% endif %}to go. {%
            endif %}{%
            if states.timer.timer2.state == 'active' %}{% 
              set duration = "" %}{% 
              if states.timer.timer2.attributes.duration[:2] | int(default=0) > 9 %}{%
              set hr = states.timer.timer2.attributes.duration[:2] %}{% else %}{%
              set hr = states.timer.timer2.attributes.duration[:1] %}{% endif %}{%
              if states.timer.timer2.attributes.duration[3:][:2] | int(default=0) > 9 %}{%
              set min = states.timer.timer2.attributes.duration[3:][:2] %}{% else %}{%
              set min = states.timer.timer2.attributes.duration[3:][:1] %}{% endif %}{%
              if states.timer.timer2.attributes.duration[5:] | int(default=0) > 9 %}{%
              set sec = states.timer.timer2.attributes.duration[5:] %}{% else %}{%
              set sec = states.timer.timer2.attributes.duration[6:] %}{% endif %}{%
              
              if hr | int(default=0) > 0 %}{% set duration = duration + hr + " hour " %}{% endif %}{%
              if min | int(default=0) == 1 %}{% set duration = duration + min + " minute " %}{%
              elif min | int(default=0) > 1 %}{% set duration = duration + min + " minutes " %}{% endif %}{%
              if sec | int(default=0) == 1 and hr | int(default=0) == 0 %}{% set duration = duration + sec + " second " %}{%
              elif sec | int(default=0) > 1 and hr | int(default=0) == 0 %}{% set duration = duration + sec + " seconds " %}{% endif %}De {%
              if (states.timer|selectattr('state','eq','active')|list|length - 1) != 1%}second {% endif %}timer van {{ duration }}is active with still {%
              if (states['timer.timer2'].attributes.duration != "none") or (states['timer.timer2'].state == "active") -%}{%
              if (as_datetime(state_attr('timer.timer2', 'finishes_at')) - now()).total_seconds() | timestamp_custom('%H', false) | int > 0 %}{{ (as_datetime(state_attr('timer.timer2', 'finishes_at')) - now()).total_seconds() | timestamp_custom('%H', false) | int }} hour {% endif %}{%
              if (as_datetime(state_attr('timer.timer2', 'finishes_at')) - now()).total_seconds() | timestamp_custom('%M', false) | int == 1 %} 1 minute{%
              elif (as_datetime(state_attr('timer.timer2', 'finishes_at')) - now()).total_seconds() | timestamp_custom('%M', false) | int > 1 %}{{ (as_datetime(state_attr('timer.timer2', 'finishes_at')) - now()).total_seconds() | timestamp_custom('%M', false) | int }} minutes {% endif %}{%
              if (as_datetime(state_attr('timer.timer2', 'finishes_at')) - now()).total_seconds() | timestamp_custom('%H', false) | int > 0 %}{%
              elif (as_datetime(state_attr('timer.timer2', 'finishes_at')) - now()).total_seconds() | timestamp_custom('%S', false) | int == 1 %} 1 second{%
              elif (as_datetime(state_attr('timer.timer2', 'finishes_at')) - now()).total_seconds() | timestamp_custom('%S', false) | int > 1 %}{{ (as_datetime(state_attr('timer.timer2', 'finishes_at')) - now()).total_seconds() | timestamp_custom('%S', false) | int }} seconds {% endif %}{% endif %}to go. {%
            endif %}{%
            
            if states.timer.timer3.state == 'active' %}{% 
              set duration = "" %}{% 
              if states.timer.timer3.attributes.duration[:2] | int(default=0) > 9 %}{%
              set hr = states.timer.timer3.attributes.duration[:2] %}{% else %}{%
              set hr = states.timer.timer3.attributes.duration[:1] %}{% endif %}{%
              if states.timer.timer3.attributes.duration[3:][:2] | int(default=0) > 9 %}{%
              set min = states.timer.timer3.attributes.duration[3:][:2] %}{% else %}{%
              set min = states.timer.timer3.attributes.duration[3:][:1] %}{% endif %}{%
              if states.timer.timer3.attributes.duration[5:] | int(default=0) > 9 %}{%
              set sec = states.timer.timer3.attributes.duration[5:] %}{% else %}{%
              set sec = states.timer.timer3.attributes.duration[6:] %}{% endif %}{%
              
              if hr | int(default=0) > 0 %}{% set duration = duration + hr + " hour " %}{% endif %}{%
              if min | int(default=0) == 1 %}{% set duration = duration + min + " minute " %}{%
              elif min | int(default=0) > 1 %}{% set duration = duration + min + " minutes " %}{% endif %}{%
              if sec | int(default=0) == 1 %}{% set duration = duration + sec + " second " %}{%
              elif sec | int(default=0) > 1 %}{% set duration = duration + sec + " seconds " %}{% endif %}De {%
              if (states.timer|selectattr('state','eq','active')|list|length - 1) != 1%}derde {% endif %}timer of {{ duration }}is active with still {%
              if (states['timer.timer3'].attributes.duration != "none") or (states['timer.timer3'].state == "active") -%}{%
              if (as_datetime(state_attr('timer.timer3', 'finishes_at')) - now()).total_seconds() | timestamp_custom('%H', false) | int > 0 %}{{ (as_datetime(state_attr('timer.timer3', 'finishes_at')) - now()).total_seconds() | timestamp_custom('%H', false) | int }} hour {% endif %}{%
              if (as_datetime(state_attr('timer.timer3', 'finishes_at')) - now()).total_seconds() | timestamp_custom('%M', false) | int == 1 %} 1 minute{%
              elif (as_datetime(state_attr('timer.timer3', 'finishes_at')) - now()).total_seconds() | timestamp_custom('%M', false) | int > 1 %}{{ (as_datetime(state_attr('timer.timer3', 'finishes_at')) - now()).total_seconds() | timestamp_custom('%M', false) | int }} minutes {% endif %}{%
              if (as_datetime(state_attr('timer.timer3', 'finishes_at')) - now()).total_seconds() | timestamp_custom('%H', false) | int > 0 %}{%
              elif (as_datetime(state_attr('timer.timer3', 'finishes_at')) - now()).total_seconds() | timestamp_custom('%S', false) | int == 1 %} 1 second{%
              elif (as_datetime(state_attr('timer.timer3', 'finishes_at')) - now()).total_seconds() | timestamp_custom('%S', false) | int > 1 %}{{ (as_datetime(state_attr('timer.timer3', 'finishes_at')) - now()).total_seconds() | timestamp_custom('%S', false) | int }} seconds {% endif %}{% endif %}to go. {%
            endif %}{{ (["Please specify which timer you want to stop.", "Please tell me which timer you want to stop.", "Please name which timer you want to stop.", ""] | random) }}{% endif %}
    action:
      service: script.1689339492373
      data_template:
        entity_id: "{{ timer }}"
               
TimerDuration:
    speech:
      text: >       
        {% if states.timer|selectattr('state','eq','active')|list|length == 0 %}
        There are currently no timers active.
        {% else %}{% if states.timer|selectattr('state','eq','active')|list|length == 2 and timer == 'timer.timer0' %}There is currently {{ states.timer|selectattr('state','eq','active')|list|length - 1}} timer active. {% 
        elif timer == 'timer.timer0' %}
        There are currently {{ states.timer|selectattr('state','eq','active')|list|length - 1}} timers active. {% endif %}{% 
        if states.timer.timer1.state == 'active' and (timer == 'timer.timer1' or timer == 'timer.timer0') %}{% 
        set duration = "" %}{% 
        if states.timer.timer1.attributes.duration[:2] | int(default=0) > 9 %}{%
        set hr = states.timer.timer1.attributes.duration[:2] %}{% else %}{%
        set hr = states.timer.timer1.attributes.duration[:1] %}{% endif %}{%
        if states.timer.timer1.attributes.duration[3:][:2] | int(default=0) > 9 %}{%
        set min = states.timer.timer1.attributes.duration[3:][:2] %}{% else %}{%
        set min = states.timer.timer1.attributes.duration[3:][:1] %}{% endif %}{%
        if states.timer.timer1.attributes.duration[5:] | int(default=0) > 9 %}{%
        set sec = states.timer.timer1.attributes.duration[5:] %}{% else %}{%
        set sec = states.timer.timer1.attributes.duration[6:] %}{% endif %}{%
        
        if hr | int(default=0) > 0 %}{% set duration = duration + hr + " hour " %}{% endif %}{%
        if min | int(default=0) == 1 %}{% set duration = duration + min + " minute " %}{%
        elif min | int(default=0) > 1 %}{% set duration = duration + min + " minutes " %}{% endif %}{%
        if sec | int(default=0) == 1 %}{% set duration = duration + sec + " second " %}{%
        elif sec | int(default=0) > 1 %}{% set duration = duration + sec + " seconds " %}{% endif %}The first timer of {{ duration }}is active with still {%
        if (states['timer.timer1'].attributes.duration != "none") or (states['timer.timer1'].state == "active") -%}{%
        if (as_datetime(state_attr('timer.timer1', 'finishes_at')) - now()).total_seconds() | timestamp_custom('%H', false) | int > 0 %}{{ (as_datetime(state_attr('timer.timer1', 'finishes_at')) - now()).total_seconds() | timestamp_custom('%H', false) | int }} hour {% endif %}{%
        if (as_datetime(state_attr('timer.timer1', 'finishes_at')) - now()).total_seconds() | timestamp_custom('%M', false) | int == 1 %} 1 minute{%
        elif (as_datetime(state_attr('timer.timer1', 'finishes_at')) - now()).total_seconds() | timestamp_custom('%M', false) | int > 1 %}{{ (as_datetime(state_attr('timer.timer1', 'finishes_at')) - now()).total_seconds() | timestamp_custom('%M', false) | int }} minutes {% endif %}{%
        if (as_datetime(state_attr('timer.timer1', 'finishes_at')) - now()).total_seconds() | timestamp_custom('%S', false) | int == 1 %} 1 second{%
        elif (as_datetime(state_attr('timer.timer1', 'finishes_at')) - now()).total_seconds() | timestamp_custom('%S', false) | int > 1 %}{{ (as_datetime(state_attr('timer.timer1', 'finishes_at')) - now()).total_seconds() | timestamp_custom('%S', false) | int }} seconds {% endif %}{% endif %}to go. {%
        endif %}{%
        if states.timer.timer2.state == 'active' and (timer == 'timer.timer2' or timer == 'timer.timer0') %}{% 
        	set duration = "" %}{% 
        	if states.timer.timer2.attributes.duration[:2] | int(default=0) > 9 %}{%
        	set hr = states.timer.timer2.attributes.duration[:2] %}{% else %}{%
        	set hr = states.timer.timer2.attributes.duration[:1] %}{% endif %}{%
        	if states.timer.timer2.attributes.duration[3:][:2] | int(default=0) > 9 %}{%
        	set min = states.timer.timer2.attributes.duration[3:][:2] %}{% else %}{%
        	set min = states.timer.timer2.attributes.duration[3:][:1] %}{% endif %}{%
        	if states.timer.timer2.attributes.duration[5:] | int(default=0) > 9 %}{%
        	set sec = states.timer.timer2.attributes.duration[5:] %}{% else %}{%
        	set sec = states.timer.timer2.attributes.duration[6:] %}{% endif %}{%
        	
        	if hr | int(default=0) > 0 %}{% set duration = duration + hr + " hour " %}{% endif %}{%
        	if min | int(default=0) == 1 %}{% set duration = duration + min + " minute " %}{%
        	elif min | int(default=0) > 1 %}{% set duration = duration + min + " minutes " %}{% endif %}{%
        	if sec | int(default=0) == 1 %}{% set duration = duration + sec + " second " %}{%
        	elif sec | int(default=0) > 1 %}{% set duration = duration + sec + " seconds " %}{% endif %}The second timer of {{ duration }}is active with still {%
        	if (states['timer.timer2'].attributes.duration != "none") or (states['timer.timer2'].state == "active") -%}{%
        	if (as_datetime(state_attr('timer.timer2', 'finishes_at')) - now()).total_seconds() | timestamp_custom('%H', false) | int > 0 %}{{ (as_datetime(state_attr('timer.timer2', 'finishes_at')) - now()).total_seconds() | timestamp_custom('%H', false) | int }} hour {% endif %}{%
        	if (as_datetime(state_attr('timer.timer2', 'finishes_at')) - now()).total_seconds() | timestamp_custom('%M', false) | int == 1 %} 1 minute{%
        	elif (as_datetime(state_attr('timer.timer2', 'finishes_at')) - now()).total_seconds() | timestamp_custom('%M', false) | int > 1 %}{{ (as_datetime(state_attr('timer.timer2', 'finishes_at')) - now()).total_seconds() | timestamp_custom('%M', false) | int }} minutes {% endif %}{%
        	if (as_datetime(state_attr('timer.timer2', 'finishes_at')) - now()).total_seconds() | timestamp_custom('%S', false) | int == 1 %} 1 second{%
        	elif (as_datetime(state_attr('timer.timer2', 'finishes_at')) - now()).total_seconds() | timestamp_custom('%S', false) | int > 1 %}{{ (as_datetime(state_attr('timer.timer2', 'finishes_at')) - now()).total_seconds() | timestamp_custom('%S', false) | int }} seconds {% endif %}{% endif %}to go. {%
        endif %}{%
        
        if states.timer.timer3.state == 'active' and (timer == 'timer.timer3' or timer == 'timer.timer0') %}{% 
        	set duration = "" %}{% 
        	if states.timer.timer3.attributes.duration[:2] | int(default=0) > 9 %}{%
        	set hr = states.timer.timer3.attributes.duration[:2] %}{% else %}{%
        	set hr = states.timer.timer3.attributes.duration[:1] %}{% endif %}{%
        	if states.timer.timer3.attributes.duration[3:][:2] | int(default=0) > 9 %}{%
        	set min = states.timer.timer3.attributes.duration[3:][:2] %}{% else %}{%
        	set min = states.timer.timer3.attributes.duration[3:][:1] %}{% endif %}{%
        	if states.timer.timer3.attributes.duration[5:] | int(default=0) > 9 %}{%
        	set sec = states.timer.timer3.attributes.duration[5:] %}{% else %}{%
        	set sec = states.timer.timer3.attributes.duration[6:] %}{% endif %}{%
        	
        	if hr | int(default=0) > 0 %}{% set duration = duration + hr + " hour " %}{% endif %}{%
        	if min | int(default=0) == 1 %}{% set duration = duration + min + " minute " %}{%
        	elif min | int(default=0) > 1 %}{% set duration = duration + min + " minutes " %}{% endif %}{%
        	if sec | int(default=0) == 1 %}{% set duration = duration + sec + " second " %}{%
        	elif sec | int(default=0) > 1 %}{% set duration = duration + sec + " seconds " %}{% endif %}The third timer of {{ duration }}is active with still {%
        	if (states['timer.timer3'].attributes.duration != "none") or (states['timer.timer3'].state == "active") -%}{%
        	if (as_datetime(state_attr('timer.timer3', 'finishes_at')) - now()).total_seconds() | timestamp_custom('%H', false) | int > 0 %}{{ (as_datetime(state_attr('timer.timer3', 'finishes_at')) - now()).total_seconds() | timestamp_custom('%H', false) | int }} hour {% endif %}{%
        	if (as_datetime(state_attr('timer.timer3', 'finishes_at')) - now()).total_seconds() | timestamp_custom('%M', false) | int == 1 %} 1 minute{%
        	elif (as_datetime(state_attr('timer.timer3', 'finishes_at')) - now()).total_seconds() | timestamp_custom('%M', false) | int > 1 %}{{ (as_datetime(state_attr('timer.timer3', 'finishes_at')) - now()).total_seconds() | timestamp_custom('%M', false) | int }} minutes {% endif %}{%
        	if (as_datetime(state_attr('timer.timer3', 'finishes_at')) - now()).total_seconds() | timestamp_custom('%S', false) | int == 1 %} 1 second{%
        	elif (as_datetime(state_attr('timer.timer3', 'finishes_at')) - now()).total_seconds() | timestamp_custom('%S', false) | int > 1 %}{{ (as_datetime(state_attr('timer.timer3', 'finishes_at')) - now()).total_seconds() | timestamp_custom('%S', false) | int }} seconds {% endif %}{% endif %}to go. {%
        endif %}{% endif %}
        
ShoppingListAddItem:
    action:
      service: "shopping_list.add_item"
      data:
        name: "{{shop_item}}"
    speech:
      text: "{{shop_item}} added to shopping list"
      
      
TestIntent:
    action:
      service: notify.mobile_app_galaxy_watch4_classic_5epz
      data:
       message: test
    speech:
      text: "Test completed"

contents of : /config/custom_sentences/en/timer_start.yaml

language: "en"
intents:
  TimerStart:
    data:
#All times
      - sentences:
          - "(start|set|would) [a] timer (for|from) {hours} (hour|hours) [and] {minutes} (minute|minutes) [and] {seconds} (second|seconds) [[want|can] do] [start]"
#All one hour
      - sentences:
          - "(start|set|would) [a] timer (for|from) {hours} (hour|hours) [[want|can] do] [start]"
        slots:
          seconds: 0
          minutes: 0
#All one minute
      - sentences:
          - "(start|set|would) [a] timer (for|from) {minutes} (minute|minutes) [[want|can] do] [start]"
        slots:
          seconds: 0
          hours: 0
#All one second
      - sentences:
          - "(start|set|would) [a] timer (for|from) {seconds} (second|seconds) [[want|can] do] [start]"
        slots:
          minutes: 0
          hours: 0
#Gone hour, wel minutes and seconds
      - sentences:
          - "(start|set|would) [a] timer (for|from) {minutes} (minute|minutes) [en] {seconds} (second|seconds) [[want|can] do] [start]"
        slots:
          hours: 0          
#Gone seconds, wel hours and minutes
      - sentences:
          - "(start|set|would) [a] timer (for|from) {hours} (hour|hours) [en] {minutes} (minute|minutes) [[want|can] do] [start]"
        slots:
          seconds: 0
#Halven
      - sentences:
          - "(start|set|would) [a] timer (for|from) [{minutes}][ ]([en] [one] half | [en] [one] halve) minute [[want|can] do] [start]"
          - "(start|set|would) [a] timer (for|from) (0,5|0.5) minute [[want|can] do] [start]"
        slots:
          hours: 0
          seconds: 30
      - sentences:
          - "(start|set|would) [a] timer (for|from) (anderhalve|anderhalf) minute [[want|can] do] [start]"
          - "(start|set|would) [a] timer (for|from) (1,5|1.5) minute [[want|can] do] [start]"
        slots:
          hours: 0
          seconds: 30
          minutes: 1
      - sentences:
          - "(start|move|would) [a] timer (for|from) [{hours}][ ]([en] [one] half | [en] [one] halve) hour [[want|can] do] [start]"
        slots:
          minutes: 30
          seconds: 0
      - sentences:
          - "(start|move|would) [a] timer (for|from) (anderhalve|anderhalf) hour [[want|can] do] [start]"
          - "(start|move|would) [a] timer (for|from) (1,5|1.5) hour [[want|can] do] [start]"
        slots:
          hours: 1
          seconds: 0
          minutes: 30
lists:
  seconds:
    range:
      from: 0
      to: 120    
  minutes:
    range:
      from: 0
      to: 120
  hours:
    range:
      from: 0
      to: 24

contents of : /config/custom_sentences/en/timer_stop.yaml

language: "en"
intents:
  TimerStop:
    data:
      - sentences:
          - "(stop|cancel|would) [the|my] {timer} timer[s] [[want|can] do] [stop|turn off]"
      - sentences:
          - "(stop|cancel|would) [the|my] timer [[want|can] do] [stop|turn off]"
        slots:
          timer: "timer.timer0"
lists:
  timer:
    values:
      - in: "first"
        out: "timer.timer1"
      - in: "second"
        out: "timer.timer2"
      - in: "third"
        out: "timer.timer3"
      - in: "all"
        out: "timer.timer1, timer.timer2, timer.timer3"

contents of /config/custom_sentences/en/timer_duration.yaml

language: "en"
intents:
  TimerDuration:
    data:
      - sentences:
          - "(how long|how much time) is left on [my|the] {timer} timer"
          - "how long does the {timer} timer have left"
      - sentences:
          - "(how long|how much time) is left on [my|the] timer[s]"
          - "show my timer[s]"
        slots:
          timer: "timer.timer0"
lists:
  timer:
    values:
      - in: "first"
        out: "timer.timer1"
      - in: "second"
        out: "timer.timer2"
      - in: "third"
        out: "timer.timer3"
      - in: "all"
        out: "timer.timer1, timer.timer2, timer.timer3"

contents of timer start script :

alias: VOICE - Start timer
sequence:
  - service: timer.start
    data_template:
      duration: "{{ duration }}"
    target:
      entity_id: >
        {% if states('timer.timer1') != 'active' and states('timer.timer1') !=
        'paused' %} timer.timer1 {% elif states('timer.timer2') != 'active' and
        states('timer.timer2') != 'paused' %} timer.timer2 {% else %}
        timer.timer3 {% endif%}
  - service: input_boolean.turn_on
    target:
      entity_id: >
        {% if states('timer.timer1') != 'active' and states('timer.timer1') !=
        'paused' %} input_boolean.timer1_actief {% elif states('timer.timer2')
        != 'active' and states('timer.timer2') != 'paused' %}
        input_boolean.timer2_active {% else %} input_boolean.timer3_active {%
        endif%}
mode: single

contents of timer stop script :

alias: VOICE - Stop timer
sequence:
  - choose:
      - conditions:
          - condition: template
            value_template: >-
              {{ (states.timer|selectattr('state','eq','active')|list|length > 2
              and entity_id != 'timer.timer0') or
              (states.timer|selectattr('state','eq','active')|list|length == 2
              and entity_id == 'timer.timer0') or (entity_id == 'timer.timer1,
              timer.timer2, timer.timer3') }}
          - condition: template
            value_template: >-
              {{ states(entity_id) == 'active' or entity_id == 'timer.timer1,
              timer.timer2, timer.timer3' }}
        sequence:
          - service: input_boolean.turn_off
            target:
              entity_id: >
                {% if entity_id == 'timer.timer1, timer.timer2, timer.timer3' %}
                input_boolean.timer1_active, input_boolean.timer2_active,
                input_boolean.timer3_active {% elif states(entity_id) ==
                'active' and entity_id != 'timer.timer0'%} {{ "input_boolean." +
                entity_id[6:] + "_active"}} {% else %}
                input_boolean.timer1_active, input_boolean.timer2_active,
                input_boolean.timer3_active {% endif %}
    default:
      - service: script.nothing
mode: single

3 Likes

Here’s the custom sentence to test the watch notification :

contents of : /config/custom_sentences/en/test.yaml

      
language: "en"
intents:
  TestIntent:
    data:
      - sentences:
        - "testing intent[s]"  
        
1 Like

Hi everyone,

For those interested, I updated the timer script. I dug into Assist’s functionality a bit more.
I created files for both Dutch and English.

don86nl/ha_intent_timers: This script adds timer functionality to Home Assistant’s Assist. (github.com)

Currently, there is an error when stopping timers. Assist will respond the timer is not running, but stops the timer(s) anyway.

P.s. This is my first attempt at a Github repo, please be nice :).

4 Likes

I want to be nice, and let you know your github link does not appear to work.
:grin:

2 Likes

It seems your repository is set on private. Set it to public and the link should work. :slight_smile:

2 Likes