Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: intent for "wake me" #145

Open
wants to merge 4 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
163 changes: 163 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,166 @@
*.pyc
__pycache__/
!.github/*

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
.pybuilder/
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# poetry
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock

# pdm
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
#pdm.lock
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
# in version control.
# https://pdm.fming.dev/latest/usage/project/#working-with-version-control
.pdm.toml
.pdm-python
.pdm-build/

# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# pytype static type analyzer
.pytype/

# Cython debug symbols
cython_debug/

# PyCharm
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/
3 changes: 2 additions & 1 deletion __init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# NEON AI (TM) SOFTWARE, Software Development Kit & Application Framework
# All trademark and other rights reserved by their respective owners
# Copyright 2008-2022 Neongecko.com Inc.
# Copyright 2008-2024 Neongecko.com Inc.
# Contributors: Daniel McKnight, Guy Daniels, Elon Gasper, Richard Leeds,
# Regina Bloomstine, Casimiro Ferreira, Andrii Pernatii, Kirill Hrymailo
# BSD-3 License
Expand Down Expand Up @@ -218,6 +218,7 @@ def on_ready(self, _: Message):
self._update_homescreen(True, True)

# Intent Handlers
@intent_handler("wake_me.intent")
@intent_handler(IntentBuilder("CreateAlarm").require("set")
.require("alarm").optionally("playable")
.optionally("weekdays").optionally("weekends")
Expand Down
1 change: 1 addition & 0 deletions locale/en-us/intent/wake_me.intent
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
wake me (|up )(at|in) {time}
6 changes: 4 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
json_database~=0.5
# TODO: network patching dependency resolution
neon-utils[network]~=1.2,>=1.11.1a3
neon-utils[network]~=1.11,>=1.11.1a4
combo_lock~=0.2
ovos-utils~=0.0, >=0.0.32
ovos-bus-client~=0.0,>=0.0.3
ovos-workshop~=0.0,>=0.0.12
ovos-workshop~=0.0,>=0.0.12
ovos-plugin-manager<1.0.0
mikejgray marked this conversation as resolved.
Show resolved Hide resolved
ovos-core<1.0.0
2 changes: 2 additions & 0 deletions requirements/test.txt
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
neon-minerva[padatious]~=0.2
mock
pytest
4 changes: 3 additions & 1 deletion skill.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,10 @@
"python": [
"combo_lock~=0.2",
"json_database~=0.5",
"neon-utils[network]~=1.2,>=1.11.1a3",
"neon-utils[network]~=1.11,>=1.11.1a4",
"ovos-bus-client~=0.0,>=0.0.3",
"ovos-core<1.0.0",
"ovos-plugin-manager<1.0.0",
"ovos-utils~=0.0, >=0.0.32",
"ovos-workshop~=0.0,>=0.0.12"
],
Expand Down
7 changes: 7 additions & 0 deletions test/test_intents.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,13 @@ en-us:
- do i have any upcoming events
- list my alarms
- what are the reminders
wake_me.intent:
- wake me up at {time}
mikejgray marked this conversation as resolved.
Show resolved Hide resolved
- wake me up in {time}
- wake me at {time}
- wake me in {time}
- wake me at 8 am
- time: 8 am
TimerStatus:
- how much time is left
- how long on that timer
Expand Down
1 change: 1 addition & 0 deletions test/test_resources.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ intents:
- list_alerts.intent
- quiet_hours_start.intent
- quiet_hours_end.intent
- wake_me.intent

adapt:
- 'CreateAlarm'
Expand Down
20 changes: 18 additions & 2 deletions test/test_skill.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import lingua_franca
import pytest
import random
import sys
import shutil
import unittest
import datetime as dt
Expand Down Expand Up @@ -2297,6 +2296,24 @@ def _validate_alert_default_params(reminder: Alert):
self.assertEqual(rotate_logs_reminder.repeat_frequency,
dt.timedelta(hours=8))

def test_wake_me_intent(self):
from skill_alerts.util.parse_utils import build_alert_from_intent
sea_tz = gettz("America/Los_Angeles")
wake_me_up = _get_message_from_file("wake_me_up_at_time_alarm.json")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing test file

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doh!

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't missing in my local repo. Where are you seeing it missing?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wake_me_in = _get_message_from_file("wake_me_up_in_time_alarm.json")

wake_me_up_alert = build_alert_from_intent(wake_me_up, AlertType.ALARM,
sea_tz)
wake_me_in_alert = build_alert_from_intent(wake_me_in, AlertType.ALARM,
sea_tz)

self.assertEqual(wake_me_up_alert.alert_name, "7:00 AM alarm")
self.assertEqual(wake_me_in_alert.alert_name, "in 8 hours alarm")
self.assertEqual(wake_me_up_alert.next_expiration.time(),
dt.time(hour=7))
self.assertAlmostEqual(wake_me_in_alert.next_expiration.timestamp(),
(dt.datetime.now(sea_tz) +
dt.timedelta(hours=8)).timestamp(), delta=2)

class TestUIModels(unittest.TestCase):
lingua_franca.load_language('en')
Expand Down Expand Up @@ -2386,6 +2403,5 @@ def test_build_alarm_data(self):
self.assertEqual(metric_display['alarmIndex'],
get_alert_id(metric_alarm))


if __name__ == '__main__':
pytest.main()
2 changes: 1 addition & 1 deletion util/parse_utils.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# NEON AI (TM) SOFTWARE, Software Development Kit & Application Framework
# All trademark and other rights reserved by their respective owners
# Copyright 2008-2022 Neongecko.com Inc.
# Copyright 2008-2024 Neongecko.com Inc.
# Contributors: Daniel McKnight, Guy Daniels, Elon Gasper, Richard Leeds,
# Regina Bloomstine, Casimiro Ferreira, Andrii Pernatii, Kirill Hrymailo
# BSD-3 License
Expand Down
Loading