From 5620bc746dcfc7e427a0feb33f6d665c444efe44 Mon Sep 17 00:00:00 2001 From: miro Date: Tue, 15 Oct 2024 22:29:10 +0100 Subject: [PATCH 1/2] feat:are_you_ready new intent and other misc fixes --- README.md | 24 +++++++++++++---- __init__.py | 34 +++++++++++++++++------- locale/en-us/dialog/confirm_ready.dialog | 5 ++++ locale/en-us/dialog/deny_ready.dialog | 5 ++++ locale/en-us/intent/are_you_ready.intent | 10 +++++++ scripts/bump_alpha.py | 19 ------------- scripts/bump_build.py | 21 --------------- scripts/bump_major.py | 27 ------------------- scripts/bump_minor.py | 24 ----------------- scripts/remove_alpha.py | 13 --------- translations/en-us/dialogs.json | 14 ++++++++++ translations/en-us/intents.json | 12 +++++++++ 12 files changed, 90 insertions(+), 118 deletions(-) create mode 100644 locale/en-us/dialog/confirm_ready.dialog create mode 100644 locale/en-us/dialog/deny_ready.dialog create mode 100644 locale/en-us/intent/are_you_ready.intent delete mode 100644 scripts/bump_alpha.py delete mode 100644 scripts/bump_build.py delete mode 100644 scripts/bump_major.py delete mode 100644 scripts/bump_minor.py delete mode 100644 scripts/remove_alpha.py diff --git a/README.md b/README.md index dc3feaf..55b6110 100644 --- a/README.md +++ b/README.md @@ -1,18 +1,32 @@ -# Finished Booting +# Finished Booting Skill ## Summary -Skill to speak when OVOS is ready +The Finished Booting skill provides a notification when OpenVoiceOS (OVOS) has fully started and all core services are ready. This notification can be spoken to the user or simply logged, depending on the user's preferences. ## Description -When OpenVoiceOS is started or restarted, this skill will speak a notification to the -user. This speech can be enabled/disabled by intent. +This skill ensures that users are informed when OVOS has completed booting and all essential services (such as network, GUI, and others) are ready for use. It provides a customizable ready notification that can be enabled or disabled via voice commands. The notification can be delivered either via a spoken message, sound, or visual cues on connected devices. + +### Key Features: +- Monitors system readiness by checking core services like network, internet, and GUI. +- Notifies the user when OVOS is fully ready. +- Allows users to enable or disable the ready notification via voice intents. +- Configurable options for spoken readiness notifications and sound effects. + +## Voice Commands + +- **Enable Ready Notifications**: Activates the spoken notification when OVOS is ready. + - Example: "Enable ready notifications." + +- **Disable Ready Notifications**: Deactivates the spoken notification. + - Example: "Disable load speech." ## Examples - "Enable ready notifications." -- "Disable load speech." +- "Disable ready speech." +- "Is the system ready?" ## Credits [NeonGeckoCom](https://github.com/NeonGeckoCom/skill-core_ready) diff --git a/__init__.py b/__init__.py index 48adbe4..feee89e 100644 --- a/__init__.py +++ b/__init__.py @@ -59,13 +59,20 @@ def is_device_ready(self) -> bool: is_ready = False # Different setups will have different needs # eg, a server does not care about audio - # internet -> device is connected to the internet - NOT IMPLEMENTED + # internet -> device is connected to the internet + # network -> device is connected to the internet + # gui_connected -> a gui client connected to the gui socket + + # any service using ProcessStatus class can also be added to ready_settings # skills -> skills reported ready # speech -> stt reported ready # audio -> audio playback reported ready - # gui -> gui websocket reported ready - NOT IMPLEMENTED - # enclosure -> enclosure/HAL reported ready - NOT IMPLEMENTED + # gui -> gui websocket reported ready + # PHAL -> enclosure/HAL reported ready + # TODO - allow requiring specific skills to be fully loaded + # skills might be loaded by core or run standalone, we should standardize how this is checked via bus + # perhaps ProcessStatus with skill_id ? services = {k: False for k in self.settings.get("ready_settings", ["skills", "speech", "audio"])} start = monotonic() @@ -92,16 +99,15 @@ def check_services_ready(self, services): if rdy: # already reported ready continue - if ser in ["gui", "enclosure"]: - # not implemented - services[ser] = True - continue - elif ser in ["network_skills"]: + if ser in ["network_skills", "network"]: services[ser] = self._network_event.is_set() continue - elif ser in ["internet_skills"]: + elif ser in ["internet_skills", "internet"]: services[ser] = self._connected_event.is_set() continue + elif ser in ["gui_connected"]: + services[ser] = self._gui_event.is_set() + continue response = self.bus.wait_for_response( Message(f'mycroft.{ser}.is_ready', context={"source": "skills", "destination": ser})) @@ -177,6 +183,16 @@ def handle_ready(self, message: Message): LOG.debug("Ready notification disabled in settings") self.enclosure.eyes_blink("b") + @intent_handler("are_you_ready.intent") + def handle_enable_notification(self, message: Message): + """ + Handle a request to enable ready announcements + """ + if self.is_device_ready(): + self.speak_dialog("confirm_ready") + else: + self.speak_dialog("deny_ready") + @intent_handler("enable_ready_notification.intent") def handle_enable_notification(self, message: Message): """ diff --git a/locale/en-us/dialog/confirm_ready.dialog b/locale/en-us/dialog/confirm_ready.dialog new file mode 100644 index 0000000..817c82e --- /dev/null +++ b/locale/en-us/dialog/confirm_ready.dialog @@ -0,0 +1,5 @@ +My system is fully ready. +All services are up and running. +My system is ready to go. +Everything is up and operational. +My system has finished booting and is ready. \ No newline at end of file diff --git a/locale/en-us/dialog/deny_ready.dialog b/locale/en-us/dialog/deny_ready.dialog new file mode 100644 index 0000000..e27ed16 --- /dev/null +++ b/locale/en-us/dialog/deny_ready.dialog @@ -0,0 +1,5 @@ +My system is not fully ready yet. +Some services are still starting up. +My system is still booting, please wait. +Not everything is ready yet. +The system isn't fully operational yet, please give me some more time. \ No newline at end of file diff --git a/locale/en-us/intent/are_you_ready.intent b/locale/en-us/intent/are_you_ready.intent new file mode 100644 index 0000000..003efac --- /dev/null +++ b/locale/en-us/intent/are_you_ready.intent @@ -0,0 +1,10 @@ +Is (your|the|Open Voice OS) system ready +Did (you|all services|the system|Open Voice OS|the device) finish booting +Are (you|all services) (ready|fully loaded|still loading|up and running) +(Have you|Has the system) finished (starting|loading|start up|boot sequence) +Is everything (ready|fully loaded|still loading|up and running) +Have you finished (booting|loading|the boot sequence) +Is (the system|Open Voice OS|the device) ready +(Has|did) (the system|you|Open Voice OS) boot successfully +Is the boot (process|sequence) complete +Have (all services|you) started \ No newline at end of file diff --git a/scripts/bump_alpha.py b/scripts/bump_alpha.py deleted file mode 100644 index 49016a7..0000000 --- a/scripts/bump_alpha.py +++ /dev/null @@ -1,19 +0,0 @@ -"""increases alpha version number""" -import fileinput -from os.path import join, dirname - - -version_file = join(dirname(dirname(__file__)), "version.py") -version_var_name = "VERSION_ALPHA" - -with open(version_file, "r", encoding="utf-8") as v: - for line in v.readlines(): - if line.startswith(version_var_name): - version = int(line.split("=")[-1]) - new_version = int(version) + 1 - -for line in fileinput.input(version_file, inplace=True): - if line.startswith(version_var_name): - print(f"{version_var_name} = {new_version}") - else: - print(line.rstrip('\n')) diff --git a/scripts/bump_build.py b/scripts/bump_build.py deleted file mode 100644 index 61099f8..0000000 --- a/scripts/bump_build.py +++ /dev/null @@ -1,21 +0,0 @@ -import fileinput -from os.path import join, dirname - - -version_file = join(dirname(dirname(__file__)), "version.py") -version_var_name = "VERSION_BUILD" -alpha_var_name = "VERSION_ALPHA" - -with open(version_file, "r", encoding="utf-8") as v: - for line in v.readlines(): - if line.startswith(version_var_name): - version = int(line.split("=")[-1]) - new_version = int(version) + 1 - -for line in fileinput.input(version_file, inplace=True): - if line.startswith(version_var_name): - print(f"{version_var_name} = {new_version}") - elif line.startswith(alpha_var_name): - print(f"{alpha_var_name} = 0") - else: - print(line.rstrip('\n')) diff --git a/scripts/bump_major.py b/scripts/bump_major.py deleted file mode 100644 index 2610fbb..0000000 --- a/scripts/bump_major.py +++ /dev/null @@ -1,27 +0,0 @@ -import fileinput -from os.path import join, dirname - - -version_file = join(dirname(dirname(__file__)), "version.py") -version_var_name = "VERSION_MAJOR" -minor_var_name = "VERSION_MINOR" -build_var_name = "VERSION_BUILD" -alpha_var_name = "VERSION_ALPHA" - -with open(version_file, "r", encoding="utf-8") as v: - for line in v.readlines(): - if line.startswith(version_var_name): - version = int(line.split("=")[-1]) - new_version = int(version) + 1 - -for line in fileinput.input(version_file, inplace=True): - if line.startswith(version_var_name): - print(f"{version_var_name} = {new_version}") - elif line.startswith(minor_var_name): - print(f"{minor_var_name} = 0") - elif line.startswith(build_var_name): - print(f"{build_var_name} = 0") - elif line.startswith(alpha_var_name): - print(f"{alpha_var_name} = 0") - else: - print(line.rstrip('\n')) diff --git a/scripts/bump_minor.py b/scripts/bump_minor.py deleted file mode 100644 index 86dfd9d..0000000 --- a/scripts/bump_minor.py +++ /dev/null @@ -1,24 +0,0 @@ -import fileinput -from os.path import join, dirname - - -version_file = join(dirname(dirname(__file__)), "version.py") -version_var_name = "VERSION_MINOR" -build_var_name = "VERSION_BUILD" -alpha_var_name = "VERSION_ALPHA" - -with open(version_file, "r", encoding="utf-8") as v: - for line in v.readlines(): - if line.startswith(version_var_name): - version = int(line.split("=")[-1]) - new_version = int(version) + 1 - -for line in fileinput.input(version_file, inplace=True): - if line.startswith(version_var_name): - print(f"{version_var_name} = {new_version}") - elif line.startswith(build_var_name): - print(f"{build_var_name} = 0") - elif line.startswith(alpha_var_name): - print(f"{alpha_var_name} = 0") - else: - print(line.rstrip('\n')) diff --git a/scripts/remove_alpha.py b/scripts/remove_alpha.py deleted file mode 100644 index fca7342..0000000 --- a/scripts/remove_alpha.py +++ /dev/null @@ -1,13 +0,0 @@ -import fileinput -from os.path import join, dirname - - -version_file = join(dirname(dirname(__file__)), "version.py") - -alpha_var_name = "VERSION_ALPHA" - -for line in fileinput.input(version_file, inplace=True): - if line.startswith(alpha_var_name): - print(f"{alpha_var_name} = 0") - else: - print(line.rstrip('\n')) diff --git a/translations/en-us/dialogs.json b/translations/en-us/dialogs.json index 4c5f3dd..af16f5e 100644 --- a/translations/en-us/dialogs.json +++ b/translations/en-us/dialogs.json @@ -5,7 +5,21 @@ "/dialog/ready.dialog": [ "I am ready!" ], + "/dialog/confirm_ready.dialog": [ + "My system is fully ready.", + "All services are up and running.", + "My system is ready to go.", + "Everything is up and operational.", + "My system has finished booting and is ready." + ], "/dialog/confirm_speak_ready.dialog": [ "Okay. I will tell you when I am ready after restarts." + ], + "/dialog/deny_ready.dialog": [ + "My system is not fully ready yet.", + "Some services are still starting up.", + "My system is still booting, please wait.", + "Not everything is ready yet.", + "The system isn't fully operational yet, please give me some more time." ] } \ No newline at end of file diff --git a/translations/en-us/intents.json b/translations/en-us/intents.json index ee0e83f..5efe4f9 100644 --- a/translations/en-us/intents.json +++ b/translations/en-us/intents.json @@ -1,4 +1,16 @@ { + "/intent/are_you_ready.intent": [ + "Is (your|the|Open Voice OS) system ready", + "Did (you|all services|the system|Open Voice OS|the device) finish booting", + "Are (you|all services) (ready|fully loaded|still loading|up and running)", + "(Have you|Has the system) finished (starting|loading|start up|boot sequence)", + "Is everything (ready|fully loaded|still loading|up and running)", + "Have you finished (booting|loading|the boot sequence)", + "Is (the system|Open Voice OS|the device) ready", + "(Has|did) (the system|you|Open Voice OS) boot successfully", + "Is the boot (process|sequence) complete", + "Have (all services|you) started" + ], "/intent/disable_ready_notification.intent": [ "(disable|turn off|deactivate) (ready|start|startup|start up|boot|load|readiness|started|booted|loaded) (sound|notification|speech|sounds|notifications)" ], From c8bf22ec6b94fc24b1cf4c2bfe91ee2965e57073 Mon Sep 17 00:00:00 2001 From: JarbasAI <33701864+JarbasAl@users.noreply.github.com> Date: Tue, 15 Oct 2024 22:39:30 +0100 Subject: [PATCH 2/2] Update __init__.py Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> --- __init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/__init__.py b/__init__.py index feee89e..d451a0a 100644 --- a/__init__.py +++ b/__init__.py @@ -184,9 +184,9 @@ def handle_ready(self, message: Message): self.enclosure.eyes_blink("b") @intent_handler("are_you_ready.intent") - def handle_enable_notification(self, message: Message): + def handle_are_you_ready(self, message: Message): """ - Handle a request to enable ready announcements + Handle a user's inquiry about device readiness. """ if self.is_device_ready(): self.speak_dialog("confirm_ready")