Skip to content

Commit

Permalink
allow multiple phone SMS recipients
Browse files Browse the repository at this point in the history
  • Loading branch information
ethayer committed Dec 29, 2015
1 parent 298b851 commit 5c47061
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions user-lock-manager.smartapp.groovy
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* User Lock Manager v4.0.10
* User Lock Manager v4.1.0
*
* Copyright 2015 Erik Thayer
*
Expand Down Expand Up @@ -149,7 +149,8 @@ def notificationPage() {
dynamicPage(name: "notificationPage", title: "Notification Settings") {

section {
input(name: "phone", type: "phone", title: "Text This Number", description: "Phone number", required: false, submitOnChange: true)
input(name: "phone", type: "text", title: "Text This Number", description: "Phone number", required: false, submitOnChange: true)
paragraph "For multiple SMS recipients, separate phone numbers with a semicolon(;)"
input(name: "notification", type: "bool", title: "Send A Push Notification", description: "Notification", required: false, submitOnChange: true)
if (phone != null || notification || sendevent) {
input(name: "notifyAccess", title: "on User Entry", type: "bool", required: false)
Expand Down Expand Up @@ -1282,7 +1283,15 @@ private sendMessage(msg) {
sendNotificationEvent(msg)
}
if (phone) {
sendSms(phone, msg)
if ( phone.indexOf(";") > 1){
def phones = phone.split(";")
for ( def i = 0; i < phones.size(); i++) {
sendSms(phones[i], msg)
}
}
else {
sendSms(phone, msg)
}
}
}

Expand Down

0 comments on commit 5c47061

Please sign in to comment.