| 1 | --- |
| 2 | language: nl |
| 3 | responses: |
| 4 | intents: |
| 5 | HassTimerStatus: |
| 6 | default: | |
| 7 | {% set num_timers = slots.timers | length %} |
| 8 | {% set active_timers = slots.timers | selectattr('is_active') | list %} |
| 9 | {% set num_active_timers = active_timers | length %} |
| 10 | {% set paused_timers = slots.timers | rejectattr('is_active') | list %} |
| 11 | {% set num_paused_timers = paused_timers | length %} |
| 12 | {% set next_timer = None %} |
| 13 | |
| 14 | {% if num_timers == 0: %} |
| 15 | Geen timers. |
| 16 | {% elif num_active_timers == 0: %} |
| 17 | {# No active timers #} |
| 18 | {{ num_paused_timers }} gepauzeerde timer{{ 's' if num_paused_timers > 1 }}. |
| 19 | {% else: %} |
| 20 | {# At least one active timer #} |
| 21 | {% if num_active_timers == 1: %} |
| 22 | {% set next_timer = active_timers[0] %} |
| 23 | {% else: %} |
| 24 | {# Get active timer that will finish soonest #} |
| 25 | {% set sorted_timers = active_timers | sort(attribute='total_seconds_left') %} |
| 26 | {% set next_timer = sorted_timers[0] %} |
| 27 | {{ num_active_timers }} actieve timers. |
| 28 | {% endif %} |
| 29 | |
| 30 | {% if num_paused_timers == 1: %} |
| 31 | 1 gepauzeerde timer. |
| 32 | {% elif num_paused_timers > 0: %} |
| 33 | {{ num_paused_timers }} gepauzeerde timers. |
| 34 | {% endif %} |
| 35 | {% endif %} |
| 36 | |
| 37 | {% if next_timer: %} |
| 38 | {# At least one active timer #} |
| 39 | {% if (next_timer.rounded_hours_left == 1) and (next_timer.rounded_minutes_left > 0): %} |
| 40 | 1 uur en {{ next_timer.rounded_minutes_left }} minuten |
| 41 | {% elif (next_timer.rounded_hours_left == 1): %} |
| 42 | 1 uur |
| 43 | {% elif (next_timer.rounded_hours_left > 1) and (next_timer.rounded_minutes_left > 0): %} |
| 44 | {{ next_timer.rounded_hours_left }} uur en {{ next_timer.rounded_minutes_left }} minuten |
| 45 | {% elif (next_timer.rounded_hours_left > 1): %} |
| 46 | {{ next_timer.rounded_hours_left }} uur |
| 47 | {% elif (next_timer.rounded_minutes_left == 1) and (next_timer.rounded_seconds_left > 0): %} |
| 48 | 1 minuut en {{ next_timer.rounded_seconds_left }} seconden |
| 49 | {% elif (next_timer.rounded_minutes_left == 1): %} |
| 50 | 1 minuut |
| 51 | {% elif (next_timer.rounded_minutes_left > 1) and (next_timer.rounded_seconds_left > 0): %} |
| 52 | {{ next_timer.rounded_minutes_left }} minuten en {{ next_timer.rounded_seconds_left }} seconden |
| 53 | {% elif (next_timer.rounded_minutes_left > 1): %} |
| 54 | {{ next_timer.rounded_minutes_left }} minuten |
| 55 | {% elif (next_timer.rounded_seconds_left == 1): %} |
| 56 | 1 seconde |
| 57 | {% elif (next_timer.rounded_seconds_left > 1): %} |
| 58 | {{ next_timer.rounded_seconds_left }} seconden |
| 59 | {% endif %} |
| 60 | |
| 61 | {% if num_timers > 1: %} |
| 62 | {# Give some extra information to disambiguate #} |
| 63 | over op |
| 64 | {% if (next_timer.start_hours > 0) and (next_timer.start_minutes > 0): %} |
| 65 | {{ next_timer.start_hours }} uur en {{ next_timer.start_minutes }} minuten |
| 66 | {% elif (next_timer.start_hours > 0): %} |
| 67 | {{ next_timer.start_hours }} uur |
| 68 | {% elif (next_timer.start_minutes > 0) and (next_timer.start_seconds > 0): %} |
| 69 | {{ next_timer.start_minutes }} minuten en {{ next_timer.start_seconds }} seconde |
| 70 | {% elif (next_timer.start_minutes > 0): %} |
| 71 | {{ next_timer.start_minutes }} minuten |
| 72 | {% elif (next_timer.start_seconds > 0): %} |
| 73 | {{ next_timer.start_seconds }} seconde |
| 74 | {% endif %} |
| 75 | |
| 76 | {% if next_timer.name: %} |
| 77 | {{ next_timer.name }} |
| 78 | {% elif next_timer.area: %} |
| 79 | {{ next_timer.area }} |
| 80 | {% endif %} |
| 81 | |
| 82 | timer. |
| 83 | {% else: %} |
| 84 | resterend. |
| 85 | {% endif %} |
| 86 | {% endif %} |