language: pl responses: intents: HassTimerStatus: default: | {% set num_timers = slots.timers | length %} {% set active_timers = slots.timers | selectattr('is_active') | list %} {% set num_active_timers = active_timers | length %} {% set paused_timers = slots.timers | rejectattr('is_active') | list %} {% set num_paused_timers = paused_timers | length %} {% set next_timer = None %} {% if num_timers == 0: %} Brak uruchomionych minutników. {% elif num_active_timers == 0: %} {# No active timers #} {% if num_paused_timers == 1: %} {% set next_timer = paused_timers[0] %} Minutnik jest wstrzymany. {% else: %} {# 2,3,4 wstrzymane minutniki #} {# 5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21 wstrzymanych minutników #} {# 22,23,24 wstrzymane minutniki #} {% if (num_paused_timers|string)[-1] in ["2", "3", "4"]: %} {{ num_paused_timers }} wstrzymane minutniki. {% else: %} {{ num_paused_timers }} wstrzymanych minutników. {% endif %} {% endif %} {% else: %} {# At least one active timer #} {% if num_active_timers == 1: %} {% set next_timer = active_timers[0] %} {% else: %} {# Get active timer that will finish soonest #} {% set sorted_timers = active_timers | sort(attribute='total_seconds_left') %} {% set next_timer = sorted_timers[0] %} {# 2,3,4 uruchomione minutniki #} {# 5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21 uruchomionych minutników #} {# 22,23,24 wstrzymane minutniki #} {% if (num_active_timers|string)[-1] in ["2", "3", "4"]: %} {{ num_active_timers }} uruchomione minutniki. {% else: %} {{ num_active_timers }} uruchomionych minutników. {% endif %} {% endif %} {% if num_paused_timers == 1: %} 1 wstrzymany minutnik. {% elif num_paused_timers > 0: %} {# 2,3,4 wstrzymane minutniki #} {# 5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21 wstrzymanych minutników #} {# 22,23,24 wstrzymane minutniki #} {% if (num_paused_timers|string)[-1] in ["2", "3", "4"]: %} {{ num_paused_timers }} wstrzymane minutniki. {% else: %} {{ num_paused_timers }} wstrzymanych minutników. {% endif %} {% endif %} {% endif %} {% if next_timer: %} {# At least one active timer #} {% if (next_timer.rounded_hours_left == 1) and (next_timer.rounded_minutes_left > 0): %} Pozostała jedna godzina i {{ next_timer.rounded_minutes_left }} {% if next_timer.rounded_minutes_left == 1: %}minuta{% elif (next_timer.rounded_minutes_left|string)[-1] in ["2", "3", "4"]: %}minuty{% else: %}minut{% endif %} {% elif (next_timer.rounded_hours_left == 1): %} Pozostała jedna godzina {% elif (next_timer.rounded_hours_left > 1) and (next_timer.rounded_minutes_left > 0): %} {# 2,3,4 godziny #} {# 5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21 godzin #} {# 22,23,24 godziny #}} {# 1 minuta #} {# 2,3,4 minuty #} {# 5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21 minut #} {# 22,23,24 minuty #} {# 25,26,27,28,29,30,31 minut #} {# pozostała 1 #} {# pozostały 2, 3, 4 #} {# pozostało 5, 6 ... #} {% if next_timer.rounded_hours_left == 1: %}Pozostała{% elif (next_timer.rounded_hours_left|string)[-1] in ["2", "3", "4"]: %}Pozostały{% else: %}Pozostało{% endif %} {{ next_timer.rounded_hours_left }} {% if (next_timer.rounded_hours_left|string)[-1] in ["2", "3", "4"]: %}godziny{% else: %}godzin{% endif %} i {{ next_timer.rounded_minutes_left }} {% if next_timer.rounded_minutes_left == 1: %}minuta{% elif (next_timer.rounded_minutes_left|string)[-1] in ["2", "3", "4"]: %}minuty{% else: %}minut{% endif %} {% elif (next_timer.rounded_hours_left > 1): %} {% if next_timer.rounded_hours_left == 1: %}Pozostała{% elif (next_timer.rounded_hours_left|string)[-1] in ["2", "3", "4"]: %}Pozostały{% else: %}Pozostało{% endif %} {{ next_timer.rounded_hours_left }} {% if (next_timer.rounded_hours_left|string)[-1] in ["2", "3", "4"]: %}godziny{% else: %}godzin{% endif %} {% elif (next_timer.rounded_minutes_left == 1) and (next_timer.rounded_seconds_left > 0): %} Pozostała jedna minuta i {{ next_timer.rounded_seconds_left }} {% if next_timer.rounded_seconds_left == 1: %}sekunda{% elif (next_timer.rounded_seconds_left|string)[-1] in ["2", "3", "4"]: %}sekundy{% else: %}sekund{% endif %} {% elif (next_timer.rounded_minutes_left == 1): %} Pozostała jedna minuta {% elif (next_timer.rounded_minutes_left > 1) and (next_timer.rounded_seconds_left > 0): %} {% if next_timer.rounded_minutes_left == 1: %}Pozostała{% elif (next_timer.rounded_minutes_left|string)[-1] in ["2", "3", "4"]: %}Pozostały{% else: %}Pozostało{% endif %} {{ next_timer.rounded_minutes_left }} {% if (next_timer.rounded_minutes_left|string)[-1] in ["2", "3", "4"]: %}minuty{% else: %}minut{% endif %} i {{ next_timer.rounded_seconds_left }} {% if next_timer.rounded_seconds_left == 1: %}sekunda{% elif (next_timer.rounded_seconds_left|string)[-1] in ["2", "3", "4"]: %}sekundy{% else: %}sekund{% endif %} {% elif (next_timer.rounded_minutes_left > 1): %} {% if next_timer.rounded_minutes_left == 1: %}Pozostała{% elif (next_timer.rounded_minutes_left|string)[-1] in ["2", "3", "4"]: %}Pozostały{% else: %}Pozostało{% endif %} {{ next_timer.rounded_minutes_left }} {% if next_timer.rounded_minutes_left == 1: %}minuta{% elif (next_timer.rounded_minutes_left|string)[-1] in ["2", "3", "4"]: %}minuty{% else: %}minut{% endif %} {% elif (next_timer.rounded_seconds_left == 1): %} Pozostała jedna sekunda {% elif (next_timer.rounded_seconds_left > 1): %} {% if next_timer.rounded_seconds_left == 1: %}Pozostała{% elif (next_timer.rounded_seconds_left|string)[-1] in ["2", "3", "4"]: %}Pozostały{% else: %}Pozostało{% endif %} {{ next_timer.rounded_seconds_left }} {% if (next_timer.rounded_seconds_left|string)[-1] in ["2", "3", "4"]: %}sekundy{% else: %}sekund{% endif %} {% endif %} {% if num_timers > 1: %} {# Give some extra information to disambiguate #} {% if (next_timer.start_hours > 0) and (next_timer.start_minutes > 0): %} na {{ next_timer.start_hours }} godzinnym i {{ next_timer.start_minutes }} minutowym minutniku {% elif (next_timer.start_hours > 0): %} na {{ next_timer.start_hours }} godzinnym minutniku {% elif (next_timer.start_minutes > 0) and (next_timer.start_seconds > 0): %} na {{ next_timer.start_minutes }} minutowym i {{ next_timer.start_seconds }} sekundowym minutniku {% elif (next_timer.start_minutes > 0): %} na {{ next_timer.start_minutes }} minutowym minutniku {% elif (next_timer.start_seconds > 0): %} na {{ next_timer.start_seconds }} sekundowym minutniku {% endif %} {% if next_timer.name: %} na minutniku {{ next_timer.name }}. {% elif next_timer.area: %} w {{ next_timer.area }}. {% endif %} {% else: %} do zakończenia. {% endif %} {% endif %}