Skip to content

Commit

Permalink
Merge branch 'main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
SaftigeSteaks committed May 30, 2024
2 parents 97ddb5d + 5a8beec commit 9bead00
Show file tree
Hide file tree
Showing 115 changed files with 2,838 additions and 84 deletions.
216 changes: 184 additions & 32 deletions intents.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -337,14 +337,6 @@ HassMediaPause:
area:
description: "Name of an area"
required: false
slot_combinations:
name_only:
- "name"
area_only:
- "area"
area_name:
- "name"
- "area"

HassMediaUnpause:
supported: true
Expand All @@ -357,14 +349,6 @@ HassMediaUnpause:
area:
description: "Name of an area"
required: false
slot_combinations:
name_only:
- "name"
area_only:
- "area"
area_name:
- "name"
- "area"

HassMediaNext:
supported: true
Expand All @@ -377,14 +361,6 @@ HassMediaNext:
area:
description: "Name of an area"
required: false
slot_combinations:
name_only:
- "name"
area_only:
- "area"
area_name:
- "name"
- "area"

HassSetVolume:
supported: true
Expand All @@ -400,11 +376,187 @@ HassSetVolume:
volume_level:
description: "Volume level from 0 to 100"
required: true
slot_combinations:
name_only:
- "name"
area_only:
- "area"
area_name:
- "name"
- "area"

# -----------------------------------------------------------------------------
# timers
# -----------------------------------------------------------------------------

HassStartTimer:
supported: true
domain: intent
description: "Starts a timer"
slots:
hours:
description: "Number of hours"
required: false
minutes:
description: "Number of minutes"
required: false
seconds:
description: "Number of seconds"
required: false
name:
description: "Name attached to the timer"
required: false
conversation_command:
description: "Command to execute when timer finishes"
required: false
slot_groups:
duration:
- "hours"
- "minutes"
- "seconds"

HassCancelTimer:
supported: true
domain: intent
description: "Cancels a timer"
slots:
start_hours:
description: "Hours the timer was started with"
required: false
start_minutes:
description: "Minutes the timer was started with"
required: false
start_seconds:
description: "Seconds the timer was started with"
required: false
name:
description: "Name attached to the timer"
required: false
area:
description: "Area of the device used to start the timer"
required: false

HassIncreaseTimer:
supported: true
domain: intent
description: "Adds time to a timer"
slots:
hours:
description: "Number of hours"
required: false
minutes:
description: "Number of minutes"
required: false
seconds:
description: "Number of seconds"
required: false
start_hours:
description: "Hours the timer was started with"
required: false
start_minutes:
description: "Minutes the timer was started with"
required: false
start_seconds:
description: "Seconds the timer was started with"
required: false
name:
description: "Name attached to the timer"
required: false
area:
description: "Area of the device used to start the timer"
required: false
slot_groups:
duration:
- "hours"
- "minutes"
- "seconds"

HassDecreaseTimer:
supported: true
domain: intent
description: "Adds time to a timer"
slots:
hours:
description: "Number of hours"
required: false
minutes:
description: "Number of minutes"
required: false
seconds:
description: "Number of seconds"
required: false
start_hours:
description: "Hours the timer was started with"
required: false
start_minutes:
description: "Minutes the timer was started with"
required: false
start_seconds:
description: "Seconds the timer was started with"
required: false
name:
description: "Name attached to the timer"
required: false
area:
description: "Area of the device used to start the timer"
required: false
slot_groups:
duration:
- "hours"
- "minutes"
- "seconds"

HassPauseTimer:
supported: true
domain: intent
description: "Pauses a running timer"
slots:
start_hours:
description: "Hours the timer was started with"
required: false
start_minutes:
description: "Minutes the timer was started with"
required: false
start_seconds:
description: "Seconds the timer was started with"
required: false
name:
description: "Name attached to the timer"
required: false
area:
description: "Area of the device used to start the timer"
required: false

HassUnpauseTimer:
supported: true
domain: intent
description: "Resumes a paused timer"
slots:
start_hours:
description: "Hours the timer was started with"
required: false
start_minutes:
description: "Minutes the timer was started with"
required: false
start_seconds:
description: "Seconds the timer was started with"
required: false
name:
description: "Name attached to the timer"
required: false
area:
description: "Area of the device used to start the timer"
required: false

HassTimerStatus:
supported: true
domain: intent
description: "Reports status of one or more timers"
slots:
start_hours:
description: "Hours the timer was started with"
required: false
start_minutes:
description: "Minutes the timer was started with"
required: false
start_seconds:
description: "Seconds the timer was started with"
required: false
name:
description: "Name attached to the timer"
required: false
area:
description: "Area of the device used to start the timer"
required: false
12 changes: 6 additions & 6 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
hassil==1.7.0
hassil==1.7.1
PyYAML==6.0.1
voluptuous==0.13.1
regex==2024.4.16
jinja2==3.1.3
regex==2024.5.15
jinja2==3.1.4

black==24.4.0
black==24.4.2
flake8==7.0.0
isort==5.13.2
mypy==1.10.0
pylint==3.1.0
pytest==8.2.0
pylint==3.2.2
pytest==8.2.1
5 changes: 5 additions & 0 deletions responses/bg/HassListAddItem.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
language: bg
responses:
intents:
HassListAddItem:
item_added: "Добавих {{ slots.item }}"
6 changes: 6 additions & 0 deletions responses/en/HassCancelTimer.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
language: en
responses:
intents:
HassCancelTimer:
default: "Timer cancelled"
6 changes: 6 additions & 0 deletions responses/en/HassDecreaseTimer.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
language: en
responses:
intents:
HassDecreaseTimer:
default: "Timer updated"
6 changes: 6 additions & 0 deletions responses/en/HassIncreaseTimer.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
language: en
responses:
intents:
HassIncreaseTimer:
default: "Timer updated"
2 changes: 1 addition & 1 deletion responses/en/HassMediaUnpause.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ language: en
responses:
intents:
HassMediaUnpause:
default: "Unpaused"
default: "Resumed"
6 changes: 6 additions & 0 deletions responses/en/HassPauseTimer.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
language: en
responses:
intents:
HassPauseTimer:
default: "Timer paused"
7 changes: 7 additions & 0 deletions responses/en/HassStartTimer.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
language: en
responses:
intents:
HassStartTimer:
default: "Timer started"
command: "Command received"
91 changes: 91 additions & 0 deletions responses/en/HassTimerStatus.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
---
language: en
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: %}
No timers.
{% elif num_active_timers == 0: %}
{# No active timers #}
{% if num_paused_timers == 1: %}
{% set next_timer = paused_timers[0] %}
Timer is paused.
{% else: %}
{{ num_paused_timers }} paused timers.
{% 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] %}
{{ num_active_timers }} running timers.
{% endif %}
{% if num_paused_timers == 1: %}
1 paused timer.
{% elif num_paused_timers > 0: %}
{{ num_paused_timers }} paused timers.
{% endif %}
{% endif %}
{% if next_timer: %}
{# At least one active timer #}
{% if (next_timer.rounded_hours_left == 1) and (next_timer.rounded_minutes_left > 0): %}
1 hour and {{ next_timer.rounded_minutes_left }} minutes
{% elif (next_timer.rounded_hours_left == 1): %}
1 hour
{% elif (next_timer.rounded_hours_left > 1) and (next_timer.rounded_minutes_left > 0): %}
{{ next_timer.rounded_hours_left }} hours and {{ next_timer.rounded_minutes_left }} minutes
{% elif (next_timer.rounded_hours_left > 1): %}
{{ next_timer.rounded_hours_left }} hours
{% elif (next_timer.rounded_minutes_left == 1) and (next_timer.rounded_seconds_left > 0): %}
1 minute and {{ next_timer.rounded_seconds_left }} seconds
{% elif (next_timer.rounded_minutes_left == 1): %}
1 minute
{% elif (next_timer.rounded_minutes_left > 1) and (next_timer.rounded_seconds_left > 0): %}
{{ next_timer.rounded_minutes_left }} minutes and {{ next_timer.rounded_seconds_left }} seconds
{% elif (next_timer.rounded_minutes_left > 1): %}
{{ next_timer.rounded_minutes_left }} minutes
{% elif (next_timer.rounded_seconds_left == 1): %}
1 second
{% elif (next_timer.rounded_seconds_left > 1): %}
{{ next_timer.rounded_seconds_left }} seconds
{% endif %}
{% if num_timers > 1: %}
{# Give some extra information to disambiguate #}
left on
{% if (next_timer.start_hours > 0) and (next_timer.start_minutes > 0): %}
{{ next_timer.start_hours }} hour and {{ next_timer.start_minutes }} minute
{% elif (next_timer.start_hours > 0): %}
{{ next_timer.start_hours }} hour
{% elif (next_timer.start_minutes > 0) and (next_timer.start_seconds > 0): %}
{{ next_timer.start_minutes }} minute and {{ next_timer.start_seconds }} second
{% elif (next_timer.start_minutes > 0): %}
{{ next_timer.start_minutes }} minute
{% elif (next_timer.start_seconds > 0): %}
{{ next_timer.start_seconds }} second
{% endif %}
{% if next_timer.name: %}
{{ next_timer.name }}
{% elif next_timer.area: %}
{{ next_timer.area }}
{% endif %}
timer.
{% else: %}
left.
{% endif %}
{% endif %}
Loading

0 comments on commit 9bead00

Please sign in to comment.