Skip to content

Commit 91b49ec

Browse files
committed
feat: intent for "wake me"
closes #119
1 parent ea25ae7 commit 91b49ec

File tree

9 files changed

+196
-5
lines changed

9 files changed

+196
-5
lines changed

.gitignore

Lines changed: 163 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,166 @@
55
*.pyc
66
__pycache__/
77
!.github/*
8+
9+
# Byte-compiled / optimized / DLL files
10+
__pycache__/
11+
*.py[cod]
12+
*$py.class
13+
14+
# C extensions
15+
*.so
16+
17+
# Distribution / packaging
18+
.Python
19+
build/
20+
develop-eggs/
21+
dist/
22+
downloads/
23+
eggs/
24+
.eggs/
25+
lib/
26+
lib64/
27+
parts/
28+
sdist/
29+
var/
30+
wheels/
31+
share/python-wheels/
32+
*.egg-info/
33+
.installed.cfg
34+
*.egg
35+
MANIFEST
36+
37+
# PyInstaller
38+
# Usually these files are written by a python script from a template
39+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
40+
*.manifest
41+
*.spec
42+
43+
# Installer logs
44+
pip-log.txt
45+
pip-delete-this-directory.txt
46+
47+
# Unit test / coverage reports
48+
htmlcov/
49+
.tox/
50+
.nox/
51+
.coverage
52+
.coverage.*
53+
.cache
54+
nosetests.xml
55+
coverage.xml
56+
*.cover
57+
*.py,cover
58+
.hypothesis/
59+
.pytest_cache/
60+
cover/
61+
62+
# Translations
63+
*.mo
64+
*.pot
65+
66+
# Django stuff:
67+
*.log
68+
local_settings.py
69+
db.sqlite3
70+
db.sqlite3-journal
71+
72+
# Flask stuff:
73+
instance/
74+
.webassets-cache
75+
76+
# Scrapy stuff:
77+
.scrapy
78+
79+
# Sphinx documentation
80+
docs/_build/
81+
82+
# PyBuilder
83+
.pybuilder/
84+
target/
85+
86+
# Jupyter Notebook
87+
.ipynb_checkpoints
88+
89+
# IPython
90+
profile_default/
91+
ipython_config.py
92+
93+
# pyenv
94+
# For a library or package, you might want to ignore these files since the code is
95+
# intended to run in multiple environments; otherwise, check them in:
96+
# .python-version
97+
98+
# pipenv
99+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
100+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
101+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
102+
# install all needed dependencies.
103+
#Pipfile.lock
104+
105+
# poetry
106+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
107+
# This is especially recommended for binary packages to ensure reproducibility, and is more
108+
# commonly ignored for libraries.
109+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
110+
#poetry.lock
111+
112+
# pdm
113+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
114+
#pdm.lock
115+
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
116+
# in version control.
117+
# https://pdm.fming.dev/latest/usage/project/#working-with-version-control
118+
.pdm.toml
119+
.pdm-python
120+
.pdm-build/
121+
122+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
123+
__pypackages__/
124+
125+
# Celery stuff
126+
celerybeat-schedule
127+
celerybeat.pid
128+
129+
# SageMath parsed files
130+
*.sage.py
131+
132+
# Environments
133+
.env
134+
.venv
135+
env/
136+
venv/
137+
ENV/
138+
env.bak/
139+
venv.bak/
140+
141+
# Spyder project settings
142+
.spyderproject
143+
.spyproject
144+
145+
# Rope project settings
146+
.ropeproject
147+
148+
# mkdocs documentation
149+
/site
150+
151+
# mypy
152+
.mypy_cache/
153+
.dmypy.json
154+
dmypy.json
155+
156+
# Pyre type checker
157+
.pyre/
158+
159+
# pytype static type analyzer
160+
.pytype/
161+
162+
# Cython debug symbols
163+
cython_debug/
164+
165+
# PyCharm
166+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
167+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
168+
# and can be added to the global gitignore or merged into this file. For a more nuclear
169+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
170+
#.idea/

__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# NEON AI (TM) SOFTWARE, Software Development Kit & Application Framework
22
# All trademark and other rights reserved by their respective owners
3-
# Copyright 2008-2022 Neongecko.com Inc.
3+
# Copyright 2008-2024 Neongecko.com Inc.
44
# Contributors: Daniel McKnight, Guy Daniels, Elon Gasper, Richard Leeds,
55
# Regina Bloomstine, Casimiro Ferreira, Andrii Pernatii, Kirill Hrymailo
66
# BSD-3 License
@@ -218,6 +218,7 @@ def on_ready(self, _: Message):
218218
self._update_homescreen(True, True)
219219

220220
# Intent Handlers
221+
@intent_handler("wake_me.intent")
221222
@intent_handler(IntentBuilder("CreateAlarm").require("set")
222223
.require("alarm").optionally("playable")
223224
.optionally("weekdays").optionally("weekends")

locale/en-us/intent/wake_me.intent

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
wake me (|up )(at|in) {time}

requirements.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,6 @@ neon-utils[network]~=1.2,>=1.11.1a3
44
combo_lock~=0.2
55
ovos-utils~=0.0, >=0.0.32
66
ovos-bus-client~=0.0,>=0.0.3
7-
ovos-workshop~=0.0,>=0.0.12
7+
ovos-workshop~=0.0,>=0.0.12
8+
ovos-plugin-manager<1.0.0
9+
ovos-core<1.0.0

requirements/test.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
11
neon-minerva[padatious]~=0.2
2+
mock
3+
pytest

test/test_intents.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,11 @@ en-us:
119119
- do i have any upcoming events
120120
- list my alarms
121121
- what are the reminders
122+
wake_me.intent:
123+
- wake me up at {time}
124+
- wake me up in {time}
125+
- wake me at {time}
126+
- wake me in {time}
122127
TimerStatus:
123128
- how much time is left
124129
- how long on that timer

test/test_resources.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ intents:
8585
- list_alerts.intent
8686
- quiet_hours_start.intent
8787
- quiet_hours_end.intent
88+
- wake_me.intent
8889

8990
adapt:
9091
- 'CreateAlarm'

test/test_skill.py

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
import lingua_franca
2525
import pytest
2626
import random
27-
import sys
2827
import shutil
2928
import unittest
3029
import datetime as dt
@@ -2297,6 +2296,24 @@ def _validate_alert_default_params(reminder: Alert):
22972296
self.assertEqual(rotate_logs_reminder.repeat_frequency,
22982297
dt.timedelta(hours=8))
22992298

2299+
def test_wake_me_intent(self):
2300+
from skill_alerts.util.parse_utils import build_alert_from_intent
2301+
sea_tz = gettz("America/Los_Angeles")
2302+
wake_me_up = _get_message_from_file("wake_me_up_at_time_alarm.json")
2303+
wake_me_in = _get_message_from_file("wake_me_up_in_time_alarm.json")
2304+
2305+
wake_me_up_alert = build_alert_from_intent(wake_me_up, AlertType.ALARM,
2306+
sea_tz)
2307+
wake_me_in_alert = build_alert_from_intent(wake_me_in, AlertType.ALARM,
2308+
sea_tz)
2309+
2310+
self.assertEqual(wake_me_up_alert.alert_name, "7:00 AM alarm")
2311+
self.assertEqual(wake_me_in_alert.alert_name, "in 8 hours alarm")
2312+
self.assertEqual(wake_me_up_alert.next_expiration.time(),
2313+
dt.time(hour=7))
2314+
self.assertAlmostEqual(wake_me_in_alert.next_expiration.timestamp(),
2315+
(dt.datetime.now(sea_tz) +
2316+
dt.timedelta(hours=8)).timestamp(), delta=2)
23002317

23012318
class TestUIModels(unittest.TestCase):
23022319
lingua_franca.load_language('en')
@@ -2386,6 +2403,5 @@ def test_build_alarm_data(self):
23862403
self.assertEqual(metric_display['alarmIndex'],
23872404
get_alert_id(metric_alarm))
23882405

2389-
23902406
if __name__ == '__main__':
23912407
pytest.main()

util/parse_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# NEON AI (TM) SOFTWARE, Software Development Kit & Application Framework
22
# All trademark and other rights reserved by their respective owners
3-
# Copyright 2008-2022 Neongecko.com Inc.
3+
# Copyright 2008-2024 Neongecko.com Inc.
44
# Contributors: Daniel McKnight, Guy Daniels, Elon Gasper, Richard Leeds,
55
# Regina Bloomstine, Casimiro Ferreira, Andrii Pernatii, Kirill Hrymailo
66
# BSD-3 License

0 commit comments

Comments
 (0)