Skip to content

Commit

Permalink
fix: missing wake up intent
Browse files Browse the repository at this point in the history
  • Loading branch information
JarbasAl committed Nov 15, 2024
1 parent d825c6c commit d6c8efb
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 0 deletions.
22 changes: 22 additions & 0 deletions __init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
from ovos_utils import classproperty
from ovos_utils.process_utils import RuntimeRequirements
from ovos_workshop.decorators import intent_handler
from ovos_workshop.intents import IntentBuilder
from ovos_workshop.skills import OVOSSkill


Expand Down Expand Up @@ -111,6 +112,7 @@ def mark1_wake_up_animation(self, message: Message):
def display_sleep_face(self) -> None:
"""Display the sleeping face depending on the platform."""
self.gui.show_page("resting", override_idle=True)
self.set_context("sleeping_state")

def display_waking_face(self) -> None:
"""Display the waking face depending on the platform."""
Expand Down Expand Up @@ -152,6 +154,25 @@ def handle_speak(self, message: Message):
utt = message.data["utterance"]
self.show_notification(utt)

@intent_handler(IntentBuilder("WakeUp").require("wakeup").require("sleeping_state"))
def handle_go_to_sleep(self, message: Message):
"""STT is disabled, but command can be sent via cli"""
if self.wake_word:
self.speak_dialog(
"going.to.sleep", {"wake_word": self.wake_word}, wait=True
)
else:
self.speak_dialog("going.to.sleep.short", wait=True)

self.bus.emit(Message("recognizer_loop:sleep"))
self.sleeping = True
self.started_by_skill = True
if self.mute:
self.bus.emit(Message("mycroft.volume.mute"))
if self.config_core["confirm_listening"]:
self.disable_confirm_listening()
self.set_context("sleeping_state")

@intent_handler("naptime.intent")
def handle_go_to_sleep(self, message: Message):
"""Sends a message to the speech client putting the listener to sleep.
Expand Down Expand Up @@ -193,6 +214,7 @@ def awaken(self):
self.enable_confirm_listening()
self.sleeping = False
self.started_by_skill = False
self.remove_context("sleeping_state")

def disable_confirm_listening(self):
msg = Message(
Expand Down
1 change: 1 addition & 0 deletions locale/en-us/wakeup.voc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
wake up
5 changes: 5 additions & 0 deletions translations/en-us/vocabs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"wakeup.voc": [
"wake up"
]
}

0 comments on commit d6c8efb

Please sign in to comment.