Skip to content

Commit

Permalink
[BG] Added timers (home-assistant#2338)
Browse files Browse the repository at this point in the history
  • Loading branch information
kyutov authored Sep 2, 2024
1 parent fa15e89 commit 766bb51
Show file tree
Hide file tree
Showing 23 changed files with 794 additions and 0 deletions.
6 changes: 6 additions & 0 deletions responses/bg/HassCancelTimer.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
language: bg
responses:
intents:
HassCancelTimer:
default: "Спрях таймера"
6 changes: 6 additions & 0 deletions responses/bg/HassDecreaseTimer.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
language: bg
responses:
intents:
HassDecreaseTimer:
default: "Обнових таймера"
6 changes: 6 additions & 0 deletions responses/bg/HassIncreaseTimer.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
language: bg
responses:
intents:
HassIncreaseTimer:
default: "Обнових таймера"
6 changes: 6 additions & 0 deletions responses/bg/HassPauseTimer.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
language: bg
responses:
intents:
HassPauseTimer:
default: "Паузирах таймера"
7 changes: 7 additions & 0 deletions responses/bg/HassStartTimer.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
language: bg
responses:
intents:
HassStartTimer:
default: "Стартирах таймер"
command: "Приех командата"
116 changes: 116 additions & 0 deletions responses/bg/HassTimerStatus.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
---
language: bg
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: %}
Няма таймери.
{% elif num_active_timers == 0: %}
{% if num_paused_timers == 1: %}
{% set next_timer = paused_timers[0] %}
Таймерът е паузиран.
{% else: %}
{{ num_paused_timers }} таймера са паузирани.
{% endif %}
{% else: %}
{% if num_active_timers == 1: %}
{% set next_timer = active_timers[0] %}
{% else: %}
{% set sorted_timers = active_timers | sort(attribute='total_seconds_left') %}
{% set next_timer = sorted_timers[0] %}
{{ num_active_timers }} работещи таймера.
{% endif %}
{% if num_paused_timers == 1: %}
1 паузиран таймер.
{% elif num_paused_timers > 0: %}
{{ num_paused_timers }} паузирани таймера.
{% endif %}
{% endif %}
{% if next_timer: %}
Остават
{% if (next_timer.rounded_hours_left == 1) and (next_timer.rounded_minutes_left > 0): %}
1 час и {{ next_timer.rounded_minutes_left }} минути
{% elif (next_timer.rounded_hours_left == 1): %}
1 час
{% elif (next_timer.rounded_hours_left > 1) and (next_timer.rounded_minutes_left > 0): %}
{{ next_timer.rounded_hours_left }} часа и {{ next_timer.rounded_minutes_left }} минути
{% elif (next_timer.rounded_hours_left > 1): %}
{{ next_timer.rounded_hours_left }} часа
{% elif (next_timer.rounded_minutes_left == 1) and (next_timer.rounded_seconds_left > 0): %}
1 минута и {{ next_timer.rounded_seconds_left }} секунди
{% elif (next_timer.rounded_minutes_left == 1): %}
1 минута
{% elif (next_timer.rounded_minutes_left > 1) and (next_timer.rounded_seconds_left > 0): %}
{{ next_timer.rounded_minutes_left }} минути и {{ next_timer.rounded_seconds_left }} секунди
{% elif (next_timer.rounded_minutes_left > 1): %}
{{ next_timer.rounded_minutes_left }} минути
{% elif (next_timer.rounded_seconds_left == 1): %}
1 секунда
{% elif (next_timer.rounded_seconds_left > 1): %}
{{ next_timer.rounded_seconds_left }} секунди
{% endif %}
{% if num_timers > 1: %}
от таймера за
{% if (next_timer.start_hours > 0) and (next_timer.start_minutes > 0): %}
{% if (next_timer.start_hours == 1) %}
1 час
{% else: %}
{{ next_timer.start_hours }} часа
{% endif %}
{% if (next_timer.start_minutes == 1) %}
и 1 минута
{% else: %}
и {{ next_timer.start_minutes }} минути
{% endif %}
{% elif (next_timer.start_hours > 0): %}
{% if (next_timer.start_hours == 1) %}
1 час
{% else: %}
{{ next_timer.start_hours }} часа
{% endif %}
{% elif (next_timer.start_minutes > 0) and (next_timer.start_seconds > 0): %}
{% if (next_timer.start_minutes == 1) %}
1 минута
{% else: %}
{{ next_timer.start_minutes }} минути
{% endif %}
{% if (next_timer.start_seconds == 1) %}
и 1 секунда
{% else: %}
и {{ next_timer.start_seconds }} секунди
{% endif %}
{% elif (next_timer.start_minutes > 0): %}
{% if (next_timer.start_minutes == 1) %}
1 минута
{% else: %}
{{ next_timer.start_minutes }} минути
{% endif %}
{% elif (next_timer.start_seconds > 0): %}
{% if (next_timer.start_seconds == 1) %}
1 секунда
{% else: %}
{{ next_timer.start_seconds }} секунди
{% endif %}
{% endif %}
{% if next_timer.name: %}
с име {{ next_timer.name }}.
{% elif next_timer.area: %}
в {{ next_timer.area }}.
{% endif %}
{% else: %}
.
{% endif %}
{% endif %}
6 changes: 6 additions & 0 deletions responses/bg/HassUnpauseTimer.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
language: bg
responses:
intents:
HassUnpauseTimer:
default: "Продължих таймера"
57 changes: 57 additions & 0 deletions sentences/bg/_common.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,51 @@ lists:
shopping_list_item:
wildcard: true

timer_seconds:
range:
from: 1
to: 100

timer_minutes:
range:
from: 1
to: 100

timer_hours:
range:
from: 1
to: 100

timer_half:
values:
- in: "половин"
out: 30
- in: "половина"
out: 30

timer_words_seconds:
values:
- in: "една"
out: 1

timer_words_minutes:
values:
- in: "една"
out: 1

timer_words_hours:
values:
- in: "един"
out: 1
- in: "два"
out: 2

timer_name:
wildcard: true

timer_command:
wildcard: true

expansion_rules:
name: "{name}"
area: "[в|на|във] {area}"
Expand All @@ -307,6 +352,18 @@ expansion_rules:
set: "направи|сложи|постави|смени|промени|настрой|задай|нагласи|тури|навий"
close: "затвори|смъкни|спусни|закрий|свали"
open: "отвори|вдигни|открий"
# Timers
timer_set: "(стартирай|настрой|създай)"
timer_cancel: "(изключи|спри)"
timer_duration_seconds: "({timer_seconds:seconds}|{timer_words_seconds:seconds}) секунд(а|и|ен)"
timer_duration_minutes: "(({timer_minutes:minutes}|{timer_words_minutes:minutes}) минут(а|и|ен)[ [и] ({timer_seconds:seconds}|{timer_words_seconds:seconds}) секунд(а|и)])|(({timer_minutes:minutes}|{timer_words_minutes:minutes}) минут(а|и) и {timer_half:seconds})|({timer_half:seconds} минута)"
timer_duration_hours: "(({timer_hours:hours}|{timer_words_hours:hours}) час[а|ов][ [и] ({timer_minutes:minutes}|{timer_words_minutes:minutes}) минут(а|и)][ [и] ({timer_seconds:seconds}|{timer_words_seconds:seconds}) секунд(а|и)])|(({timer_hours:hours}||{timer_words_hours:hours}) час[а] и {timer_half:minutes})|({timer_half:minutes} час[а])"
timer_duration: "<timer_duration_seconds>|<timer_duration_minutes>|<timer_duration_hours>"
timer_start_seconds: "{timer_seconds:start_seconds} секунд(а|и)"
timer_start_minutes: "{timer_minutes:start_minutes} минут(а|и)[ [и ]{timer_seconds:start_seconds} секунд(а|и)]"
timer_start_hours: "{timer_hours:start_hours} час[а][ [и ]{timer_minutes:start_minutes} минут(а|и)][ [и ]{timer_seconds:start_seconds} секунд(а|и)]"
timer_start: "<timer_start_seconds>|<timer_start_minutes>|<timer_start_hours>"

skip_words:
- "извинявай"
- "можеш ли"
Expand Down
13 changes: 13 additions & 0 deletions sentences/bg/homeassistant_HassCancelTimer.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
language: "bg"
intents:
HassCancelTimer:
data:
- sentences:
- "(изключи| спри)[ моя| моят] таймер[а|ът] [ми]"
- "(изключи| спри)[ моя| моят] <timer_start> таймер"
- "(изключи| спри)[ моя| моят] таймер[а| ът] [ми] (за|от) <timer_start>"
- "(изключи| спри)[ моя| моят] {area} таймер"
- "(изключи| спри)[ моя| моят] таймер[а| ът] [ми] [в|във] <area>"
- "(изключи| спри)[ моя| моят] {timer_name:name} таймер[а|ът] [ми]"
- "(изключи| спри)[ моя| моят] таймер[а| ът] [ми] (с име|на име|за) {timer_name:name}"
20 changes: 20 additions & 0 deletions sentences/bg/homeassistant_HassDecreaseTimer.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
language: "bg"
intents:
HassDecreaseTimer:
data:
- sentences:
- "(махни| премахни| извади) <timer_duration> от [ моя| моят] таймер[а| ът] [ми]"
- "(махни| премахни| извади) <timer_duration> от [ моя| моят] таймер[а| ът] [ми] (за| от) <timer_start>"
- "(махни| премахни| извади) <timer_duration> от [ моя| моят] таймер[а| ът] [ми] (в| във) <area>"
- "(махни| премахни| извади) <timer_duration> от [ моя| моят] таймер[а| ът] [ми] (с име|на име|за) {timer_name:name}"
- "(махни| премахни| извади) <timer_duration> от [ моя| моят] {timer_name:name} таймер[а| ът] [ми]"
- "(махни| премахни| извади) от [ моя| моят] таймер[а|ът] [ми] <timer_duration>"
- "(махни| премахни| извади) от [ моя| моят] таймер[а|ът] [ми] (за|от) <timer_start> <timer_duration>"
- "(махни| премахни| извади) от [ моя| моят] таймер[а|ът] [ми] (в|във) <area> <timer_duration>"
- sentences:
- "намали[ моя| моят] таймер[а| ът] [ми] с <timer_duration>"
- "намали[ моя| моят] таймер[а| ът] [ми] (за| от) <timer_start> (с| със) <timer_duration>"
- "намали[ моя| моят] таймер[а| ът] [ми] (в| във) <area> (с| със) <timer_duration>"
- "намали[ моя| моят] {timer_name:name} таймер[а| ът] [ми] (с| със) <timer_duration>"
- "намали[ моя| моят] таймер[а| ът] [ми] (с име|на име|за) {timer_name:name} (с| със) <timer_duration>"
21 changes: 21 additions & 0 deletions sentences/bg/homeassistant_HassIncreaseTimer.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
language: "bg"
intents:
HassIncreaseTimer:
data:
- sentences:
- "(сложи| добави| прибави) <timer_duration> към[ моя| моят] таймер[а|ът] [ми]"
- "(сложи| добави| прибави) <timer_duration> към[ моя| моят] таймер[а|ът] [ми] (за|от) <timer_start>"
- "(сложи| добави| прибави) <timer_duration> към[ моя| моят] таймер[а|ът] [ми] (в|във) <area>"
- "(сложи| добави| прибави) <timer_duration> към[ моя| моят] {timer_name:name} таймер[а] [ми]"
- "(сложи| добави| прибави) <timer_duration> към[ моя| моят] таймер[а|ът] [ми] (с име|на име|за) {timer_name:name}"
- "(сложи| добави| прибави) <timer_duration> към[ моя| моят] таймер[а|ът] [ми] (за|от) <timer_start>"
- "(сложи| добави| прибави) към[ моя| моят] таймер[а|ът] [ми] <timer_duration>"
- "(сложи| добави| прибави) към[ моя| моят] таймер[а|ът] [ми] (за|от) <timer_start> <timer_duration>"
- "(сложи| добави| прибави) към[ моя| моят] таймер[а|ът] [ми] (в|във) <area> <timer_duration>"
- sentences:
- "увеличи[ моя| моят] таймер[а|ът] [ми] с <timer_duration>"
- "увеличи[ моя| моят] таймер[а|ът] [ми] (за|от) <timer_start> (с|със) <timer_duration>"
- "увеличи[ моя| моят] таймер[а|ът] [ми] (в|във) <area> (с|със) <timer_duration>"
- "увеличи[ моя| моят] {timer_name:name} таймер[а| ът] [ми] (с|със) <timer_duration>"
- "увеличи[ моя| моят] таймер[а|ът] [ми] (с име|на име|за) {timer_name:name} (с|със) <timer_duration>"
12 changes: 12 additions & 0 deletions sentences/bg/homeassistant_HassPauseTimer.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
language: "bg"
intents:
HassPauseTimer:
data:
- sentences:
- "(паузирай |сложи на пауза)[ моя| моят] таймер[а| ът] [ми]"
- "(паузирай |сложи на пауза)[ моя| моят] таймер[а| ът] [ми] от <timer_start>"
- "(паузирай |сложи на пауза)[ моя| моят] {area} таймер"
- "(паузирай |сложи на пауза)[ моя| моят] таймер[а| ът] [ми] (в| във) <area>"
- "(паузирай |сложи на пауза)[ моя| моят] {timer_name:name} таймер[а| ът] [ми]"
- "(паузирай |сложи на пауза)[ моя| моят] таймер[а| ът] [ми] (с име|на име|за) {timer_name:name}"
15 changes: 15 additions & 0 deletions sentences/bg/homeassistant_HassStartTimer.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
language: "bg"
intents:
HassStartTimer:
data:
- sentences:
- "[пусни|включи|стартирай|настрой|задай|създай] таймер (за|от) <timer_duration>"
- "[пусни|включи|стартирай|настрой|задай|създай] <timer_duration> таймер"
- "[пусни|включи|стартирай|настрой|задай|създай] таймер [с име|на име] {timer_name:name} (за|от) <timer_duration>"
- "[пусни|включи|стартирай|настрой|задай|създай] таймер (за|от) <timer_duration> (с име|на име) {timer_name:name}"
- "<timer_duration> таймер (с име|на име|за) {timer_name:name}"
- sentences:
- "{timer_command:conversation_command} след <timer_duration>"
- "след <timer_duration> {timer_command:conversation_command}"
response: command
16 changes: 16 additions & 0 deletions sentences/bg/homeassistant_HassTimerStatus.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
language: "bg"
intents:
HassTimerStatus:
data:
- sentences:
- "какъв е статус(а|ът) на [ моя| моят| моите] таймер[а|и|ите] [ми]"
- "колко [време] остава (от|на) [ моя| моят| моите] таймер[а|и|ите] [ми]"
- "какъв е статус(а|ът) на [ моя| моят] таймер[а| ът] [ми] (за| от) <timer_start>"
- "колко [време] остава (от|на) [ моя| моят] таймер[а| ът] [ми] (за| от) <timer_start>"
- "какъв е статус(а|ът) на [ моя| моят| моите] таймер[а|и|ите] [ми] (в|във) <area>"
- "колко [време] остава от [ моя| моят| моите] таймер[а|и|ите] [ми] (в|във) <area>"
- "какъв е статус(а|ът) на [ моя| моят] {timer_name:name} таймер[а|ът] [ми]"
- "колко [време] остава от [ моя| моят] {timer_name:name} таймер[а|ът] [ми]"
- "какъв е статус(а|ът) на [ моя| моят| моите] таймер[а|и|ите] [ми] [с име|на име|за] {timer_name:name}"
- "колко [време] остава от [ моя| моят] таймер[а|ът] [ми] [с име|на име|за] {timer_name:name} "
12 changes: 12 additions & 0 deletions sentences/bg/homeassistant_HassUnpauseTimer.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
language: "bg"
intents:
HassUnpauseTimer:
data:
- sentences:
- "продължи[ моя| моят] таймер[а|ът] [ми]"
- "продължи[ моя| моят] таймер[а|ът] [ми] (за|от) <timer_start>"
- "продължи[ моя| моят] {area} таймер"
- "продължи[ моя| моят] таймер[а|ът] [ми] (в|във) <area>"
- "продължи[ моя| моят] {timer_name:name} таймер[а|ът] [ми]"
- "продължи[ моя| моят] таймер[а|ът] [ми] (с име|на име|за) {timer_name:name}"
22 changes: 22 additions & 0 deletions tests/bg/_fixtures.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -421,3 +421,25 @@ entities:
- name: "задачите"
id: "todo.the_tasks"
state: ""

timers:
- is_active: false
start_hours: 1
total_seconds_left: 100
rounded_hours_left: 0
rounded_minutes_left: 1
rounded_seconds_left: 40

- name: "пица"
start_minutes: 30
total_seconds_left: 1505
rounded_hours_left: 0
rounded_minutes_left: 25
rounded_seconds_left: 0

- area: "кухнята"
start_minutes: 5
total_seconds_left: 190
rounded_hours_left: 0
rounded_minutes_left: 3
rounded_seconds_left: 0
Loading

0 comments on commit 766bb51

Please sign in to comment.