Skip to content

Commit

Permalink
added error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
mushie4282 committed Mar 11, 2024
1 parent 8ffba13 commit 8e21659
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
from ovos_utils.process_utils import RuntimeRequirements
from ovos_workshop.intents import IntentBuilder
from ovos_workshop.decorators import intent_handler
# from ovos_workshop.intents import IntentHandler # Uncomment to use Adapt intents
from ovos_workshop.skills import OVOSSkill
from SMS import SIM7600X

# Optional - if you want to populate settings.json with default values, do so here
DEFAULT_SETTINGS = {
Expand Down Expand Up @@ -49,6 +49,11 @@ def handle_how_are_you_intent(self, message):
"""This is a Padatious intent handler.
It is triggered using a list of sample phrases."""
self.speak_dialog("text.response")
phone = SIM7600X() # create SMS instance
if phone.send_short_message("Send help to CSULB! Location:CECS 416"):
self.speak_dialog("error.response") # in case the HAT is not responsive
else:
self.speak_dialog("text.complete")
self.speak("This is from S M S skill")

def stop(self):
Expand Down
4 changes: 4 additions & 0 deletions src/locale/en-us/dialog/error.response.dialog
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Could not connect to serial port
I was unable to send a text
Yikes there is something wrong with the cellular HAT
I could not send a text
3 changes: 3 additions & 0 deletions src/locale/en-us/dialog/text.complete.dialog
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Text has been sent
9 1 1 has been notified
emergency responders have been notified

0 comments on commit 8e21659

Please sign in to comment.