From ecb975540b9714c0cfd01390b418d0a3a32c457f Mon Sep 17 00:00:00 2001 From: tslagle13 Date: Wed, 14 Oct 2015 10:05:02 -0700 Subject: [PATCH] Fix requirement for SMS Removed requirement to provide a SMS number is the user does not have contacts. Add logic to verify a number was provided before sending SMS. --- .../routine-director.src/routine-director.groovy | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/smartapps/tslagle13/routine-director.src/routine-director.groovy b/smartapps/tslagle13/routine-director.src/routine-director.groovy index 86263b9..21d0c48 100644 --- a/smartapps/tslagle13/routine-director.src/routine-director.groovy +++ b/smartapps/tslagle13/routine-director.src/routine-director.groovy @@ -50,7 +50,7 @@ preferences { } section("Send Notifications?") { input("recipients", "contact", title: "Send notifications to") { - input "phone", "phone", title: "Send an SMS to this number?" + input "phone", "phone", title: "Send an SMS to this number?", required:false } } @@ -266,7 +266,9 @@ def sendAway(msg) { } else { sendPush(msg) - sendSms(phone, msg) + if(phone){ + sendSms(phone, msg) + } } } @@ -280,7 +282,9 @@ def sendHome(msg) { } else { sendPush(msg) - sendSms(phone, msg) + if(phone){ + sendSms(phone, msg) + } } } @@ -339,4 +343,4 @@ private getTimeIntervalLabel() { private hideOptionsSection() { (starting || ending || days || modes) ? false: true -} \ No newline at end of file +}