| 1 | --- |
| 2 | language: es |
| 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 | No hay temporizadores. |
| 16 | {% elif num_active_timers == 0: %} |
| 17 | {# No active timers #} |
| 18 | {% if num_paused_timers == 1: %} |
| 19 | {% set next_timer = paused_timers[0] %} |
| 20 | El temporizador está en pausa. |
| 21 | {% else: %} |
| 22 | {{ num_paused_timers }} temporizadores en 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 }} temporizadores activos. |
| 33 | {% endif %} |
| 34 | |
| 35 | {% if num_paused_timers == 1: %} |
| 36 | 1 temporizador en pausa. |
| 37 | {% elif num_paused_timers > 0: %} |
| 38 | {{ num_paused_timers }} temporizadores en pausa. |
| 39 | {% endif %} |
| 40 | {% endif %} |
| 41 | |
| 42 | {% if next_timer: %} |
| 43 | |
| 44 | {% if num_timers > 1: %} |
| 45 | |
| 46 | Al temporizador |
| 47 | |
| 48 | {% if next_timer.name: %} |
| 49 | {{ next_timer.name }} |
| 50 | {% elif next_timer.area: %} |
| 51 | del área {{ next_timer.area }} |
| 52 | {% endif %} |
| 53 | |
| 54 | de |
| 55 | |
| 56 | {# Give some extra information to disambiguate #} |
| 57 | {% if (next_timer.start_hours > 0) and (next_timer.start_minutes > 0): %} |
| 58 | {{ next_timer.start_hours }} hora{{ "s" if next_timer.start_hours != 1 }} y {{ next_timer.start_minutes }} minuto{{ "s" if next_timer.start_minutes != 1 }} |
| 59 | {% elif (next_timer.start_hours > 0): %} |
| 60 | {{ next_timer.start_hours }} hora{{ "s" if next_timer.start_hours != 1 }} |
| 61 | {% elif (next_timer.start_minutes > 0) and (next_timer.start_seconds > 0): %} |
| 62 | {{ next_timer.start_minutes }} minuto{{ "s" if next_timer.start_minutes != 1 }} y {{ next_timer.start_seconds }} segundo{{ "s" if next_timer.start_seconds != 1 }} |
| 63 | {% elif (next_timer.start_minutes > 0): %} |
| 64 | {{ next_timer.start_minutes }} minuto{{ "s" if next_timer.start_minutes != 1 }} |
| 65 | {% elif (next_timer.start_seconds > 0): %} |
| 66 | {{ next_timer.start_seconds }} segundo{{ "s" if next_timer.start_seconds != 1 }} |
| 67 | {% endif %} |
| 68 | |
| 69 | le quedan |
| 70 | {% else %} |
| 71 | Le quedan |
| 72 | {% endif %} |
| 73 | |
| 74 | {# At least one active timer #} |
| 75 | {% if (next_timer.rounded_hours_left == 1) and (next_timer.rounded_minutes_left > 0): %} |
| 76 | 1 hora y {{ next_timer.rounded_minutes_left }} minutos. |
| 77 | {% elif (next_timer.rounded_hours_left == 1): %} |
| 78 | 1 hora. |
| 79 | {% elif (next_timer.rounded_hours_left > 1) and (next_timer.rounded_minutes_left > 0): %} |
| 80 | {{ next_timer.rounded_hours_left }} horas y {{ next_timer.rounded_minutes_left }} minutos. |
| 81 | {% elif (next_timer.rounded_hours_left > 1): %} |
| 82 | {{ next_timer.rounded_hours_left }} horas. |
| 83 | {% elif (next_timer.rounded_minutes_left == 1) and (next_timer.rounded_seconds_left > 0): %} |
| 84 | 1 minuto y {{ next_timer.rounded_seconds_left }} segundos. |
| 85 | {% elif (next_timer.rounded_minutes_left == 1): %} |
| 86 | 1 minuto. |
| 87 | {% elif (next_timer.rounded_minutes_left > 1) and (next_timer.rounded_seconds_left > 0): %} |
| 88 | {{ next_timer.rounded_minutes_left }} minutos y {{ next_timer.rounded_seconds_left }} segundos. |
| 89 | {% elif (next_timer.rounded_minutes_left > 1): %} |
| 90 | {{ next_timer.rounded_minutes_left }} minutos. |
| 91 | {% elif (next_timer.rounded_seconds_left == 1): %} |
| 92 | 1 segundo. |
| 93 | {% elif (next_timer.rounded_seconds_left > 1): %} |
| 94 | {{ next_timer.rounded_seconds_left }} segundos. |
| 95 | {% endif %} |
| 96 | |
| 97 | {% endif %} |