| 1 | --- |
| 2 | language: ru |
| 3 | responses: |
| 4 | intents: |
| 5 | HassStartTimer: |
| 6 | default: > |
| 7 | {% set h = slots.hours if slots.hours is defined else none %} |
| 8 | {% set m = slots.minutes if slots.minutes is defined else none %} |
| 9 | {% set s = slots.seconds if slots.seconds is defined else none %} |
| 10 | {% set h_text = h ~ (' час' if (h | int % 10 == 1 and h | int != 11) |
| 11 | else (' часа' if (h | int % 10 in [2, 3, 4] and h | int not in [12, 13, 14]) |
| 12 | else ' часов')) if h else '' %} |
| 13 | {% set m_text = m ~ (' минуту' if (m | int % 10 == 1 and m | int != 11) |
| 14 | else (' минуты' if (m | int % 10 in [2, 3, 4] and m | int not in [12, 13, 14]) |
| 15 | else ' минут')) if m else '' %} |
| 16 | {% set s_text = s ~ (' секунду' if (s | int % 10 == 1 and s | int != 11) |
| 17 | else (' секунды' if (s | int % 10 in [2, 3, 4] and s | int not in [12, 13, 14]) |
| 18 | else ' секунд')) if s else '' %} |
| 19 | {% set text_list = [ h_text, m_text, s_text] | select() | list %} |
| 20 | {% set text = text_list[:-1] | join(' ') ~ ' и ' ~ text_list[-1] if text_list | count > 2 else text_list | join(' и ') %} |
| 21 | {% set name = (slots.name | trim) if slots.name is defined else '' %} |
| 22 | Таймер {{ name }} на {{ text }} запущен |
| 23 | command: > |
| 24 | {% set h = slots.hours if slots.hours is defined else none %} |
| 25 | {% set m = slots.minutes if slots.minutes is defined else none %} |
| 26 | {% set s = slots.seconds if slots.seconds is defined else none %} |
| 27 | {% set h_text = h ~ (' час' if (h | int % 10 == 1 and h | int != 11) |
| 28 | else (' часа' if (h | int % 10 in [2, 3, 4] and h | int not in [12, 13, 14]) |
| 29 | else ' часов')) if h else '' %} |
| 30 | {% set m_text = m ~ (' минуту' if (m | int % 10 == 1 and m | int != 11) |
| 31 | else (' минуты' if (m | int % 10 in [2, 3, 4] and m | int not in [12, 13, 14]) |
| 32 | else ' минут')) if m else '' %} |
| 33 | {% set s_text = s ~ (' секунду' if (s | int % 10 == 1 and s | int != 11) |
| 34 | else (' секунды' if (s | int % 10 in [2, 3, 4] and s | int not in [12, 13, 14]) |
| 35 | else ' секунд')) if s else '' %} |
| 36 | {% set text_list = [ h_text, m_text, s_text] | select() | list %} |
| 37 | {% set text = text_list[:-1] | join(' ') ~ ' и ' ~ text_list[-1] if text_list | count > 2 else text_list | join(' и ') %} |
| 38 | Команда будет выполнена через {{ text }} |