| 1 | language: he |
| 2 | responses: |
| 3 | intents: |
| 4 | HassTimerStatus: |
| 5 | default: | |
| 6 | {% set num_timers = slots.timers | length %} |
| 7 | {% set active_timers = slots.timers | selectattr('is_active') | list %} |
| 8 | {% set num_active_timers = active_timers | length %} |
| 9 | {% set paused_timers = slots.timers | rejectattr('is_active') | list %} |
| 10 | {% set num_paused_timers = paused_timers | length %} |
| 11 | {% set next_timer = None %} |
| 12 | |
| 13 | {% if num_timers == 0: %} |
| 14 | אין טיימרים. |
| 15 | {% elif num_active_timers == 0: %} |
| 16 | {# אין טיימרים פעילים #} |
| 17 | {% if num_paused_timers == 1: %} |
| 18 | {% set next_timer = paused_timers[0] %} |
| 19 | טיימר מושהה. |
| 20 | {% else: %} |
| 21 | {{ num_paused_timers }} טיימרים מושהים. |
| 22 | {% endif %} |
| 23 | {% else: %} |
| 24 | {# לפחות טיימר פעיל אחד #} |
| 25 | {% if num_active_timers == 1: %} |
| 26 | {% set next_timer = active_timers[0] %} |
| 27 | {% else: %} |
| 28 | {# קבלת הטיימר הפעיל שיסתיים בקרוב ביותר #} |
| 29 | {% set sorted_timers = active_timers | sort(attribute='total_seconds_left') %} |
| 30 | {% set next_timer = sorted_timers[0] %} |
| 31 | {{ num_active_timers }} טיימרים פעילים. |
| 32 | {% endif %} |
| 33 | |
| 34 | {% if num_paused_timers == 1: %} |
| 35 | 1 טיימר מושהה. |
| 36 | {% elif num_paused_timers > 0: %} |
| 37 | {{ num_paused_timers }} טיימרים מושהים. |
| 38 | {% endif %} |
| 39 | {% endif %} |
| 40 | |
| 41 | {% if next_timer: %} |
| 42 | {# לפחות טיימר פעיל אחד #} |
| 43 | {% if (next_timer.rounded_hours_left == 1) and (next_timer.rounded_minutes_left > 0): %} |
| 44 | שעה אחת ו{{ next_timer.rounded_minutes_left }} דקות |
| 45 | {% elif (next_timer.rounded_hours_left == 1): %} |
| 46 | שעה אחת |
| 47 | {% elif (next_timer.rounded_hours_left > 1) and (next_timer.rounded_minutes_left > 0): %} |
| 48 | {{ next_timer.rounded_hours_left }} שעות ו{{ next_timer.rounded_minutes_left }} דקות |
| 49 | {% elif (next_timer.rounded_hours_left > 1): %} |
| 50 | {{ next_timer.rounded_hours_left }} שעות |
| 51 | {% elif (next_timer.rounded_minutes_left == 1) and (next_timer.rounded_seconds_left > 0): %} |
| 52 | דקה אחת ו{{ next_timer.rounded_seconds_left }} שניות |
| 53 | {% elif (next_timer.rounded_minutes_left == 1): %} |
| 54 | דקה אחת |
| 55 | {% elif (next_timer.rounded_minutes_left > 1) and (next_timer.rounded_seconds_left > 0): %} |
| 56 | {{ next_timer.rounded_minutes_left }} דקות ו{{ next_timer.rounded_seconds_left }} שניות |
| 57 | {% elif (next_timer.rounded_minutes_left > 1): %} |
| 58 | {{ next_timer.rounded_minutes_left }} דקות |
| 59 | {% elif (next_timer.rounded_seconds_left == 1): %} |
| 60 | שנייה אחת |
| 61 | {% elif (next_timer.rounded_seconds_left > 1): %} |
| 62 | {{ next_timer.rounded_seconds_left }} שניות |
| 63 | {% endif %} |
| 64 | |
| 65 | {% if num_timers > 1: %} |
| 66 | {# מידע נוסף להבחנה בין טיימרים #} |
| 67 | נשאר |
| 68 | {% if (next_timer.start_hours > 0) and (next_timer.start_minutes > 0): %} |
| 69 | {{ next_timer.start_hours }} שעה ו{{ next_timer.start_minutes }} דקה |
| 70 | {% elif (next_timer.start_hours > 0): %} |
| 71 | {{ next_timer.start_hours }} שעה |
| 72 | {% elif (next_timer.start_minutes > 0) and (next_timer.start_seconds > 0): %} |
| 73 | {{ next_timer.start_minutes }} דקה ו{{ next_timer.start_seconds }} שנייה |
| 74 | {% elif (next_timer.start_minutes > 0): %} |
| 75 | {{ next_timer.start_minutes }} דקה |
| 76 | {% elif (next_timer.start_seconds > 0): %} |
| 77 | {{ next_timer.start_seconds }} שנייה |
| 78 | {% endif %} |
| 79 | |
| 80 | {% if next_timer.name: %} |
| 81 | {{ next_timer.name }} |
| 82 | {% elif next_timer.area: %} |
| 83 | {{ next_timer.area }} |
| 84 | {% endif %} |
| 85 | |
| 86 | טיימר. |
| 87 | {% else: %} |
| 88 | נשאר. |
| 89 | {% endif %} |
| 90 | {% endif %} |