| 1 |
--- |
| 2 |
language: ca |
| 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 hi ha cap temporitzador. |
| 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 temporitzador és en pausa. |
| 21 |
{% else: %} |
| 22 |
{{ num_paused_timers }} temporitzadors 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 }} temporitzadors actius. |
| 33 |
{% endif %} |
| 34 |
|
| 35 |
{% if num_paused_timers == 1: %} |
| 36 |
1 temporitzador en pausa. |
| 37 |
{% elif num_paused_timers > 0: %} |
| 38 |
{{ num_paused_timers }} temporitzadors en pausa. |
| 39 |
{% endif %} |
| 40 |
{% endif %} |
| 41 |
|
| 42 |
{% if next_timer: %} |
| 43 |
|
| 44 |
{% if num_timers > 1: %} |
| 45 |
|
| 46 |
Al temporitzador |
| 47 |
|
| 48 |
{% if next_timer.name: %} |
| 49 |
{{ next_timer.name }} |
| 50 |
{% elif next_timer.area: %} |
| 51 |
de l'àrea {{ next_timer.area }} |
| 52 |
{% endif %} |
| 53 |
|
| 54 |
de |
| 55 |
|
| 56 |
{# Give some extra information to disambiguate #} |
| 57 |
{% if (next_timer.start_hours == 1) and (next_timer.start_minutes == 1): %} |
| 58 |
1 hora i 1 minut |
| 59 |
{% elif (next_timer.start_hours == 1) and (next_timer.start_minutes > 1): %} |
| 60 |
1 hora i {{ next_timer.start_minutes }} minuts |
| 61 |
{% elif (next_timer.start_hours > 0) and (next_timer.start_minutes == 1): %} |
| 62 |
{{ next_timer.start_hours }} hores i 1 minut |
| 63 |
{% elif (next_timer.start_hours > 0) and (next_timer.start_minutes > 1): %} |
| 64 |
{{ next_timer.start_hours }} hores i {{ next_timer.start_minutes }} minuts |
| 65 |
{% elif (next_timer.start_hours == 1): %} |
| 66 |
{{ next_timer.start_hours }} hora |
| 67 |
{% elif (next_timer.start_hours > 1): %} |
| 68 |
{{ next_timer.start_hours }} hores |
| 69 |
{% elif (next_timer.start_minutes > 0) and (next_timer.start_seconds > 0): %} |
| 70 |
{{ next_timer.start_minutes }} minut{{ "s" if next_timer.start_minutes != 1 }} i {{ next_timer.start_seconds }} segon{{ "s" if next_timer.start_seconds != 1 }} |
| 71 |
{% elif (next_timer.start_minutes > 0): %} |
| 72 |
{{ next_timer.start_minutes }} minut{{ "s" if next_timer.start_minutes != 1 }} |
| 73 |
{% elif (next_timer.start_seconds > 0): %} |
| 74 |
{{ next_timer.start_seconds }} segon{{ "s" if next_timer.start_seconds != 1 }} |
| 75 |
{% endif %} |
| 76 |
|
| 77 |
hi queden |
| 78 |
{% else %} |
| 79 |
Hi queden |
| 80 |
{% endif %} |
| 81 |
|
| 82 |
{# At least one active timer #} |
| 83 |
{% if (next_timer.rounded_hours_left == 1) and (next_timer.rounded_minutes_left > 0): %} |
| 84 |
1 hora i {{ next_timer.rounded_minutes_left }} minuts. |
| 85 |
{% elif (next_timer.rounded_hours_left == 1): %} |
| 86 |
1 hora. |
| 87 |
{% elif (next_timer.rounded_hours_left > 1) and (next_timer.rounded_minutes_left > 0): %} |
| 88 |
{{ next_timer.rounded_hours_left }} hores i {{ next_timer.rounded_minutes_left }} minuts. |
| 89 |
{% elif (next_timer.rounded_hours_left > 1): %} |
| 90 |
{{ next_timer.rounded_hours_left }} hores. |
| 91 |
{% elif (next_timer.rounded_minutes_left == 1) and (next_timer.rounded_seconds_left > 0): %} |
| 92 |
1 minut i {{ next_timer.rounded_seconds_left }} segons. |
| 93 |
{% elif (next_timer.rounded_minutes_left == 1): %} |
| 94 |
1 minut. |
| 95 |
{% elif (next_timer.rounded_minutes_left > 1) and (next_timer.rounded_seconds_left > 0): %} |
| 96 |
{{ next_timer.rounded_minutes_left }} minuts i {{ next_timer.rounded_seconds_left }} segons. |
| 97 |
{% elif (next_timer.rounded_minutes_left > 1): %} |
| 98 |
{{ next_timer.rounded_minutes_left }} minuts. |
| 99 |
{% elif (next_timer.rounded_seconds_left == 1): %} |
| 100 |
1 segon. |
| 101 |
{% elif (next_timer.rounded_seconds_left > 1): %} |
| 102 |
{{ next_timer.rounded_seconds_left }} segons. |
| 103 |
{% endif %} |
| 104 |
|
| 105 |
{% endif %} |