| 1 | language: ne |
| 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 | {# No active timers #} |
| 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 | {# At least one active timer #} |
| 25 | {% if num_active_timers == 1 %} |
| 26 | {% set next_timer = active_timers[0] %} |
| 27 | {% else %} |
| 28 | {# Get active timer that will finish soonest #} |
| 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 | एउटा टाइमर रोकिएको छ। |
| 36 | {% elif num_paused_timers > 0 %} |
| 37 | {{ num_paused_timers }} ओटा टाइमरहरू रोकिएका छन्। |
| 38 | {% endif %} |
| 39 | {% endif %} |
| 40 | |
| 41 | {% if next_timer %} |
| 42 | {# Create the string for the time left #} |
| 43 | {% set time_left_str %} |
| 44 | {%- if (next_timer.rounded_hours_left > 0) and (next_timer.rounded_minutes_left > 0) -%} |
| 45 | {{ next_timer.rounded_hours_left }} घण्टा र {{ next_timer.rounded_minutes_left }} मिनेट |
| 46 | {%- elif (next_timer.rounded_hours_left > 0) -%} |
| 47 | {{ next_timer.rounded_hours_left }} घण्टा |
| 48 | {%- elif (next_timer.rounded_minutes_left > 0) and (next_timer.rounded_seconds_left > 0) -%} |
| 49 | {{ next_timer.rounded_minutes_left }} मिनेट र {{ next_timer.rounded_seconds_left }} सेकेन्ड |
| 50 | {%- elif (next_timer.rounded_minutes_left > 0) -%} |
| 51 | {{ next_timer.rounded_minutes_left }} मिनेट |
| 52 | {%- elif (next_timer.rounded_seconds_left > 0) -%} |
| 53 | {{ next_timer.rounded_seconds_left }} सेकेन्ड |
| 54 | {%- endif -%} |
| 55 | {% endset %} |
| 56 | |
| 57 | {# Check if we need to specify which timer we are talking about #} |
| 58 | {% if num_timers > 1 and next_timer.is_active %} |
| 59 | {# Create the string that identifies the timer, e.g., "Kitchen's 5 minute" #} |
| 60 | {% set timer_id_str %} |
| 61 | {%- if next_timer.name -%} |
| 62 | {{ next_timer.name }}को |
| 63 | {%- elif next_timer.area -%} |
| 64 | {{ next_timer.area }}को |
| 65 | {%- endif -%} |
| 66 | {%- if (next_timer.start_hours > 0) and (next_timer.start_minutes > 0) -%} |
| 67 | {{ " " }}{{ next_timer.start_hours }} घण्टा र {{ next_timer.start_minutes }} मिनेटको |
| 68 | {%- elif (next_timer.start_hours > 0) -%} |
| 69 | {{ " " }}{{ next_timer.start_hours }} घण्टाको |
| 70 | {%- elif (next_timer.start_minutes > 0) and (next_timer.start_seconds > 0) -%} |
| 71 | {{ " " }}{{ next_timer.start_minutes }} मिनेट र {{ next_timer.start_seconds }} सेकेन्डको |
| 72 | {%- elif (next_timer.start_minutes > 0) -%} |
| 73 | {{ " " }}{{ next_timer.start_minutes }} मिनेटको |
| 74 | {%- elif (next_timer.start_seconds > 0) -%} |
| 75 | {{ " " }}{{ next_timer.start_seconds }} सेकेन्डको |
| 76 | {%- endif -%} |
| 77 | {% endset %} |
| 78 | |
| 79 | {# Combine for the final sentence #} |
| 80 | {{- timer_id_str | trim }} टाइमरमा {{ time_left_str }} बाँकी छ। |
| 81 | |
| 82 | {% elif time_left_str | trim | length > 0 %} |
| 83 | {# Simple response for a single timer #} |
| 84 | {{ time_left_str }} बाँकी छ। |
| 85 | {% endif %} |
| 86 | {% endif %} |