| 1 |
--- |
| 2 |
language: it |
| 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 |
Nessun timer. |
| 16 |
{% elif num_active_timers == 0: %} |
| 17 |
{# No active timers #} |
| 18 |
{% if num_paused_timers == 1: %} |
| 19 |
{% set next_timer = paused_timers[0] %} |
| 20 |
Timer in pausa. |
| 21 |
{% else: %} |
| 22 |
{{ num_paused_timers }} timer in pausa. |
| 23 |
{% endif %} |
| 24 |
{% else: %} |
| 25 |
{# At least one active timer #} |
| 26 |
{% if num_active_timers == 1: %} |
| 27 |
{% set next_timer = active_timers[0] %} |
| 28 |
{% else: %} |
| 29 |
{# Get active timer that will finish soonest #} |
| 30 |
{% set sorted_timers = active_timers | sort(attribute='total_seconds_left') %} |
| 31 |
{% set next_timer = sorted_timers[0] %} |
| 32 |
{{ num_active_timers }} timer in esecuzione. |
| 33 |
{% endif %} |
| 34 |
|
| 35 |
{% if num_paused_timers == 1: %} |
| 36 |
1 timer in pausa. |
| 37 |
{% elif num_paused_timers > 0: %} |
| 38 |
{{ num_paused_timers }} timer in pausa. |
| 39 |
{% endif %} |
| 40 |
{% endif %} |
| 41 |
|
| 42 |
{% if next_timer: %} |
| 43 |
{# At least one active timer #} |
| 44 |
{% if (next_timer.rounded_hours_left == 1) and (next_timer.rounded_minutes_left > 0): %} |
| 45 |
1 ora e {{ next_timer.rounded_minutes_left }} minuti |
| 46 |
{% elif (next_timer.rounded_hours_left == 1): %} |
| 47 |
1 ora |
| 48 |
{% elif (next_timer.rounded_hours_left > 1) and (next_timer.rounded_minutes_left > 0): %} |
| 49 |
{{ next_timer.rounded_hours_left }} ore e {{ next_timer.rounded_minutes_left }} minuti |
| 50 |
{% elif (next_timer.rounded_hours_left > 1): %} |
| 51 |
{{ next_timer.rounded_hours_left }} ore |
| 52 |
{% elif (next_timer.rounded_minutes_left == 1) and (next_timer.rounded_seconds_left > 0): %} |
| 53 |
1 minuto e {{ next_timer.rounded_seconds_left }} secondi |
| 54 |
{% elif (next_timer.rounded_minutes_left == 1): %} |
| 55 |
1 minuto |
| 56 |
{% elif (next_timer.rounded_minutes_left > 1) and (next_timer.rounded_seconds_left > 0): %} |
| 57 |
{{ next_timer.rounded_minutes_left }} minuti e {{ next_timer.rounded_seconds_left }} secondi |
| 58 |
{% elif (next_timer.rounded_minutes_left > 1): %} |
| 59 |
{{ next_timer.rounded_minutes_left }} minuti |
| 60 |
{% elif (next_timer.rounded_seconds_left == 1): %} |
| 61 |
1 secondo |
| 62 |
{% elif (next_timer.rounded_seconds_left > 1): %} |
| 63 |
{{ next_timer.rounded_seconds_left }} secondi |
| 64 |
{% endif %} |
| 65 |
|
| 66 |
{% if num_timers > 1: %} |
| 67 |
{# Give some extra information to disambiguate #} |
| 68 |
rimanenti sul timer |
| 69 |
{% if (next_timer.start_hours > 0) and (next_timer.start_minutes > 0): %} |
| 70 |
da {{ next_timer.start_hours }} ore e {{ next_timer.start_minutes }} minuti |
| 71 |
{% elif (next_timer.start_hours > 0): %} |
| 72 |
da {{ next_timer.start_hours }} ore |
| 73 |
{% elif (next_timer.start_minutes > 0) and (next_timer.start_seconds > 0): %} |
| 74 |
da {{ next_timer.start_minutes }} minuti e {{ next_timer.start_seconds }} secondi |
| 75 |
{% elif (next_timer.start_minutes > 0): %} |
| 76 |
da {{ next_timer.start_minutes }} minuti |
| 77 |
{% elif (next_timer.start_seconds > 0): %} |
| 78 |
da {{ next_timer.start_seconds }} secondi |
| 79 |
{% endif %} |
| 80 |
|
| 81 |
{% if next_timer.name: %} |
| 82 |
chiamato {{ next_timer.name }} |
| 83 |
{% elif next_timer.area: %} |
| 84 |
in {{ next_timer.area }}. |
| 85 |
{% endif %} |
| 86 |
{% else: %} |
| 87 |
rimanenti. |
| 88 |
{% endif %} |
| 89 |
{% endif %} |