From 2fdf6157b754241db77a59fac14c0542007eedb0 Mon Sep 17 00:00:00 2001 From: Kevin Cole Date: Wed, 25 Sep 2019 09:12:50 -0400 Subject: [PATCH] Add audible and visual indicators for shutdown --- __init__.py | 10 ++++++++++ dialog/en-us/shutting.down.dialog | 1 + 2 files changed, 11 insertions(+) create mode 100644 dialog/en-us/shutting.down.dialog diff --git a/__init__.py b/__init__.py index 4b7ae7b..fd47ce1 100644 --- a/__init__.py +++ b/__init__.py @@ -12,9 +12,12 @@ # See the License for the specific language governing permissions and # limitations under the License. +import time +from mycroft.audio import wait_while_speaking from adapt.intent import IntentBuilder from mycroft.messagebus.message import Message from mycroft.skills.core import MycroftSkill, intent_handler, intent_file_handler +from mycroft.enclosure.api import EnclosureAPI class StopSkill(MycroftSkill): @@ -39,6 +42,13 @@ def handle_reboot(self, event): @intent_file_handler("shutdown.intent") def handle_shutdown(self, event): if self.ask_yesno("confirm.shutdown") == "yes": + self.enclosure.eyes_color(70, 65, 69) # soft gray + self.speak_dialog('shutting.down') + wait_while_speaking() + for percentage in range(100, -1, -10): + self.enclosure.eyes_fill(percentage) + time.sleep(1) + self.enclosure.eyes_brightness(0) self.bus.emit(Message("system.shutdown")) @intent_file_handler('wifi.setup.intent') diff --git a/dialog/en-us/shutting.down.dialog b/dialog/en-us/shutting.down.dialog new file mode 100644 index 0000000..99fa0e1 --- /dev/null +++ b/dialog/en-us/shutting.down.dialog @@ -0,0 +1 @@ +Shutting down . . . Wait 10 seconds before disconnecting power.