forked from SmartThingsCommunity/SmartThingsPublic
-
Notifications
You must be signed in to change notification settings - Fork 0
/
smart-alarm.groovy
1852 lines (1565 loc) · 48.9 KB
/
smart-alarm.groovy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/**
* Smart Alarm is a multi-zone virtual alarm panel, featuring customizable
* security zones. Setting of an alarm can activate sirens, turn on light
* switches, push notification and text message. Alarm is armed and disarmed
* simply by setting SmartThings location 'mode'.
*
* Please visit <http://statusbits.github.io/smartalarm/> for more
* information.
*
* Version 2.4.3 (7/7/2015)
*
* The latest version of this file can be found on GitHub at:
* <https://github.com/statusbits/smartalarm/blob/master/SmartAlarm.groovy>
*
* --------------------------------------------------------------------------
*
* Copyright (c) 2014 Statusbits.com
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, either version 3 of the License, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import groovy.json.JsonSlurper
definition(
name: "Smart Alarm",
namespace: "statusbits",
author: "[email protected]",
description: '''A multi-zone virtual alarm panel, featuring customizable\
security zones. Setting of an alarm can activate sirens, turn on light\
switches, push notification and text message. Alarm is armed and disarmed\
simply by setting SmartThings location 'mode'.''',
category: "Safety & Security",
iconUrl: "http://statusbits.github.io/icons/SmartAlarm-128.png",
iconX2Url: "http://statusbits.github.io/icons/SmartAlarm-256.png",
oauth: [displayName:"Smart Alarm", displayLink:"http://statusbits.github.io/smartalarm/"]
)
preferences {
page name:"pageSetup"
page name:"pageAbout"
page name:"pageUninstall"
page name:"pageStatus"
page name:"pageHistory"
page name:"pageSelectZones"
page name:"pageConfigureZones"
page name:"pageArmingOptions"
page name:"pageAlarmOptions"
page name:"pageNotifications"
page name:"pageRemoteOptions"
page name:"pageRestApiOptions"
}
mappings {
path("/armaway") {
action: [ GET: "apiArmAway" ]
}
path("/armaway/:pincode") {
action: [ GET: "apiArmAway" ]
}
path("/armstay") {
action: [ GET: "apiArmStay" ]
}
path("/armstay/:pincode") {
action: [ GET: "apiArmStay" ]
}
path("/disarm") {
action: [ GET: "apiDisarm" ]
}
path("/disarm/:pincode") {
action: [ GET: "apiDisarm" ]
}
path("/panic") {
action: [ GET: "apiPanic" ]
}
path("/status") {
action: [ GET: "apiStatus" ]
}
}
// Show setup page
def pageSetup() {
LOG("pageSetup()")
if (state.version != getVersion()) {
return setupInit() ? pageAbout() : pageUninstall()
}
if (getNumZones() == 0) {
return pageSelectZones()
}
def alarmStatus = "Alarm is ${getAlarmStatus()}"
def pageProperties = [
name: "pageSetup",
//title: "Status",
nextPage: null,
install: true,
uninstall: state.installed
]
return dynamicPage(pageProperties) {
section("Status") {
if (state.zones.size() > 0) {
href "pageStatus", title:alarmStatus, description:"Tap for more information"
} else {
paragraph alarmStatus
}
if (state.history.size() > 0) {
href "pageHistory", title:"Event History", description:"Tap to view"
}
}
section("Setup Menu") {
href "pageSelectZones", title:"Add/Remove Zones", description:"Tap to open"
href "pageConfigureZones", title:"Configure Zones", description:"Tap to open"
href "pageArmingOptions", title:"Arming/Disarming Options", description:"Tap to open"
href "pageAlarmOptions", title:"Alarm Options", description:"Tap to open"
href "pageNotifications", title:"Notification Options", description:"Tap to open"
href "pageRemoteOptions", title:"Remote Control Options", description:"Tap to open"
href "pageRestApiOptions", title:"REST API Options", description:"Tap to open"
href "pageAbout", title:"About Smart Alarm", description:"Tap to open"
}
section([title:"Options", mobileOnly:true]) {
label title:"Assign a name", required:false
}
}
}
// Show "About" page
def pageAbout() {
LOG("pageAbout()")
def textAbout =
"Version ${getVersion()}\n${textCopyright()}\n\n" +
"You can contribute to the development of this app by making " +
"donation to [email protected] via PayPal."
def hrefInfo = [
url: "http://statusbits.github.io/smartalarm/",
style: "embedded",
title: "Tap here for more information...",
description:"http://statusbits.github.io/smartalarm/",
required: false
]
def pageProperties = [
name: "pageAbout",
//title: "About",
nextPage: "pageSetup",
uninstall: false
]
return dynamicPage(pageProperties) {
section("About") {
paragraph textAbout
href hrefInfo
}
section("License") {
paragraph textLicense()
}
}
}
// Show "Uninstall" page
def pageUninstall() {
LOG("pageUninstall()")
def text =
"Smart Alarm version ${getVersion()} is not backward compatible " +
"with the currently installed version. Please uninstall the " +
"current version by tapping the Uninstall button below, then " +
"re-install Smart Alarm from the Dashboard. We are sorry for the " +
"inconvenience."
def pageProperties = [
name: "pageUninstall",
title: "Warning!",
nextPage: null,
uninstall: true,
install: false
]
return dynamicPage(pageProperties) {
section("Uninstall Required") {
paragraph text
}
}
}
// Show "Status" page
def pageStatus() {
LOG("pageStatus()")
def pageProperties = [
name: "pageStatus",
//title: "Status",
nextPage: "pageSetup",
uninstall: false
]
return dynamicPage(pageProperties) {
section("Status") {
paragraph "Alarm is ${getAlarmStatus()}"
}
if (settings.z_contact) {
section("Contact Sensors") {
settings.z_contact.each() {
def text = getZoneStatus(it, "contact")
if (text) {
paragraph text
}
}
}
}
if (settings.z_motion) {
section("Motion Sensors") {
settings.z_motion.each() {
def text = getZoneStatus(it, "motion")
if (text) {
paragraph text
}
}
}
}
if (settings.z_movement) {
section("Movement Sensors") {
settings.z_movement.each() {
def text = getZoneStatus(it, "acceleration")
if (text) {
paragraph text
}
}
}
}
if (settings.z_smoke) {
section("Smoke & CO Sensors") {
settings.z_smoke.each() {
def text = getZoneStatus(it, "smoke")
if (text) {
paragraph text
}
}
}
}
if (settings.z_water) {
section("Moisture Sensors") {
settings.z_water.each() {
def text = getZoneStatus(it, "water")
if (text) {
paragraph text
}
}
}
}
}
}
// Show "History" page
def pageHistory() {
LOG("pageHistory()")
def pageProperties = [
name: "pageHistory",
//title: "Event History",
nextPage: "pageSetup",
uninstall: false
]
def history = atomicState.history
return dynamicPage(pageProperties) {
section("Event History") {
if (history.size() == 0) {
paragraph "No history available."
} else {
paragraph "Not implemented"
}
}
}
}
// Show "Add/Remove Zones" page
def pageSelectZones() {
LOG("pageSelectZones()")
def helpPage =
"A security zone is an area of your property protected by a sensor " +
"(contact, motion, movement, moisture or smoke)."
def inputContact = [
name: "z_contact",
type: "capability.contactSensor",
title: "Which contact sensors?",
multiple: true,
required: false
]
def inputMotion = [
name: "z_motion",
type: "capability.motionSensor",
title: "Which motion sensors?",
multiple: true,
required: false
]
def inputMovement = [
name: "z_movement",
type: "capability.accelerationSensor",
title: "Which movement sensors?",
multiple: true,
required: false
]
def inputSmoke = [
name: "z_smoke",
type: "capability.smokeDetector",
title: "Which smoke & CO sensors?",
multiple: true,
required: false
]
def inputMoisture = [
name: "z_water",
type: "capability.waterSensor",
title: "Which moisture sensors?",
multiple: true,
required: false
]
def pageProperties = [
name: "pageSelectZones",
//title: "Add/Remove Zones",
nextPage: "pageConfigureZones",
uninstall: false
]
return dynamicPage(pageProperties) {
section("Add/Remove Zones") {
paragraph helpPage
input inputContact
input inputMotion
input inputMovement
input inputSmoke
input inputMoisture
}
}
}
// Show "Configure Zones" page
def pageConfigureZones() {
LOG("pageConfigureZones()")
def helpZones =
"Security zones can be configured as either Exterior, Interior, " +
"Alert or Bypass. Exterior zones are armed in both Away and Stay " +
"modes, while Interior zones are armed only in Away mode, allowing " +
"you to move freely inside the premises while the alarm is armed " +
"in Stay mode. Alert zones are always armed and are typically used " +
"for smoke and flood alarms. Bypass zones are never armed. This " +
"allows you to temporarily exclude a zone from your security " +
"system.\n\n" +
"You can disable Entry and Exit Delays for individual zones."
def zoneTypes = ["exterior", "interior", "alert", "bypass"]
def pageProperties = [
name: "pageConfigureZones",
//title: "Configure Zones",
nextPage: "pageSetup",
uninstall: false
]
return dynamicPage(pageProperties) {
section("Configure Zones") {
paragraph helpZones
}
if (settings.z_contact) {
def devices = settings.z_contact.sort {it.displayName}
devices.each() {
def devId = it.id
section("${it.displayName} (contact)") {
input "type_${devId}", "enum", title:"Zone Type", metadata:[values:zoneTypes], defaultValue:"exterior"
input "delay_${devId}", "bool", title:"Entry/Exit Delays", defaultValue:true
}
}
}
if (settings.z_motion) {
def devices = settings.z_motion.sort {it.displayName}
devices.each() {
def devId = it.id
section("${it.displayName} (motion)") {
input "type_${devId}", "enum", title:"Zone Type", metadata:[values:zoneTypes], defaultValue:"interior"
input "delay_${devId}", "bool", title:"Entry/Exit Delays", defaultValue:false
}
}
}
if (settings.z_movement) {
def devices = settings.z_movement.sort {it.displayName}
devices.each() {
def devId = it.id
section("${it.displayName} (movement)") {
input "type_${devId}", "enum", title:"Zone Type", metadata:[values:zoneTypes], defaultValue:"interior"
input "delay_${devId}", "bool", title:"Entry/Exit Delays", defaultValue:false
}
}
}
if (settings.z_smoke) {
def devices = settings.z_smoke.sort {it.displayName}
devices.each() {
def devId = it.id
section("${it.displayName} (smoke)") {
input "type_${devId}", "enum", title:"Zone Type", metadata:[values:zoneTypes], defaultValue:"alert"
input "delay_${devId}", "bool", title:"Entry/Exit Delays", defaultValue:false
}
}
}
if (settings.z_water) {
def devices = settings.z_water.sort {it.displayName}
devices.each() {
def devId = it.id
section("${it.displayName} (moisture)") {
input "type_${devId}", "enum", title:"Zone Type", metadata:[values:zoneTypes], defaultValue:"alert"
input "delay_${devId}", "bool", title:"Entry/Exit Delays", defaultValue:false
}
}
}
}
}
// Show "Arming/Disarming Options" page
def pageArmingOptions() {
LOG("pageArmingOptions()")
def helpArming =
"Smart Alarm can be armed and disarmed by setting the home Mode. " +
"There are two arming modes - Stay and Away. Interior zones are " +
"not armed in Stay mode, allowing you to move freely inside your " +
"home."
def helpDelay =
"Exit and entry delay allows you to exit the premises after arming " +
"your alarm system and enter the premises while the alarm system " +
"is armed without setting off an alarm. You can optionally disable " +
"entry and exit delay when the alarm is armed in Stay mode."
def inputAwayModes = [
name: "awayModes",
type: "mode",
title: "Arm 'Away' in these Modes",
multiple: true,
required: false
]
def inputStayModes = [
name: "stayModes",
type: "mode",
title: "Arm 'Stay' in these Modes",
multiple: true,
required: false
]
def inputDisarmModes = [
name: "disarmModes",
type: "mode",
title: "Disarm in these Modes",
multiple: true,
required: false
]
def inputDelay = [
name: "delay",
type: "enum",
metadata: [values:["30","45","60","90"]],
title: "Delay (in seconds)",
defaultValue: "30",
required: true
]
def inputDelayStay = [
name: "stayDelayOff",
type: "bool",
title: "Disable delays in Stay mode",
defaultValue: false,
required: true
]
def pageProperties = [
name: "pageArmingOptions",
//title: "Arming/Disarming Options",
nextPage: "pageSetup",
uninstall: false
]
return dynamicPage(pageProperties) {
section("Arming/Disarming Options") {
paragraph helpArming
}
section("Modes") {
input inputAwayModes
input inputStayModes
input inputDisarmModes
}
section("Exit and Entry Delay") {
paragraph helpDelay
input inputDelay
input inputDelayStay
}
}
}
// Show "Alarm Options" page
def pageAlarmOptions() {
LOG("pageAlarmOptions()")
def helpAlarm =
"You can configure Smart Alarm to take several actions when an " +
"alarm is set off, such as turning on sirens and light switches, " +
"taking camera snapshots and executing a 'Hello, Home' action."
def inputAlarms = [
name: "alarms",
type: "capability.alarm",
title: "Which sirens?",
multiple: true,
required: false
]
def inputSirenMode = [
name: "sirenMode",
type: "enum",
metadata: [values:["Off","Siren","Strobe","Both"]],
title: "Choose siren mode",
defaultValue: "Both"
]
def inputSwitches = [
name: "switches",
type: "capability.switch",
title: "Which switches?",
multiple: true,
required: false
]
def inputCameras = [
name: "cameras",
type: "capability.imageCapture",
title: "Which cameras?",
multiple: true,
required: false
]
def hhActions = getHelloHomeActions()
def inputHelloHome = [
name: "helloHomeAction",
type: "enum",
title: "Which 'Hello, Home' action?",
metadata: [values: hhActions],
required: false
]
def pageProperties = [
name: "pageAlarmOptions",
//title: "Alarm Options",
nextPage: "pageSetup",
uninstall: false
]
return dynamicPage(pageProperties) {
section("Alarm Options") {
paragraph helpAlarm
}
section("Sirens") {
input inputAlarms
input inputSirenMode
}
section("Switches") {
input inputSwitches
}
section("Cameras") {
input inputCameras
}
section("'Hello, Home' Actions") {
input inputHelloHome
}
}
}
// Show "Notification Options" page
def pageNotifications() {
LOG("pageNotifications()")
def helpAbout =
"You can configure Smart Alarm to notify you when it is armed, " +
"disarmed or when an alarm is set off. Notifications can be send " +
"using either Push messages, SMS (text) messages and Pushbullet " +
"messaging service. Smart Alarm can also notify you with sounds or " +
"voice alerts using compatible audio devices, such as Sonos."
def inputPushAlarm = [
name: "pushMessage",
type: "bool",
title: "Notify on Alarm",
defaultValue: true
]
def inputPushStatus = [
name: "pushStatusMessage",
type: "bool",
title: "Notify on Status Change",
defaultValue: true
]
def inputPhone1 = [
name: "phone1",
type: "phone",
title: "Send to this number",
required: false
]
def inputPhone1Alarm = [
name: "smsAlarmPhone1",
type: "bool",
title: "Notify on Alarm",
defaultValue: false
]
def inputPhone1Status = [
name: "smsStatusPhone1",
type: "bool",
title: "Notify on Status Change",
defaultValue: false
]
def inputPhone2 = [
name: "phone2",
type: "phone",
title: "Send to this number",
required: false
]
def inputPhone2Alarm = [
name: "smsAlarmPhone2",
type: "bool",
title: "Notify on Alarm",
defaultValue: false
]
def inputPhone2Status = [
name: "smsStatusPhone2",
type: "bool",
title: "Notify on Status Change",
defaultValue: false
]
def inputPhone3 = [
name: "phone3",
type: "phone",
title: "Send to this number",
required: false
]
def inputPhone3Alarm = [
name: "smsAlarmPhone3",
type: "bool",
title: "Notify on Alarm",
defaultValue: false
]
def inputPhone3Status = [
name: "smsStatusPhone3",
type: "bool",
title: "Notify on Status Change",
defaultValue: false
]
def inputPhone4 = [
name: "phone4",
type: "phone",
title: "Send to this number",
required: false
]
def inputPhone4Alarm = [
name: "smsAlarmPhone4",
type: "bool",
title: "Notify on Alarm",
defaultValue: false
]
def inputPhone4Status = [
name: "smsStatusPhone4",
type: "bool",
title: "Notify on Status Change",
defaultValue: false
]
def inputPushbulletDevice = [
name: "pushbullet",
type: "device.pushbullet",
title: "Which Pushbullet devices?",
multiple: true,
required: false
]
def inputPushbulletAlarm = [
name: "pushbulletAlarm",
type: "bool",
title: "Notify on Alarm",
defaultValue: true
]
def inputPushbulletStatus = [
name: "pushbulletStatus",
type: "bool",
title: "Notify on Status Change",
defaultValue: true
]
def inputAudioPlayers = [
name: "audioPlayer",
type: "capability.musicPlayer",
title: "Which audio players?",
multiple: true,
required: false
]
def inputSpeechOnAlarm = [
name: "speechOnAlarm",
type: "bool",
title: "Notify on Alarm",
defaultValue: true
]
def inputSpeechOnStatus = [
name: "speechOnStatus",
type: "bool",
title: "Notify on Status Change",
defaultValue: true
]
def inputSpeechTextAlarm = [
name: "speechText",
type: "text",
title: "Alarm Phrase",
required: false
]
def inputSpeechTextArmedAway = [
name: "speechTextArmedAway",
type: "text",
title: "Armed Away Phrase",
required: false
]
def inputSpeechTextArmedStay = [
name: "speechTextArmedStay",
type: "text",
title: "Armed Stay Phrase",
required: false
]
def inputSpeechTextDisarmed = [
name: "speechTextDisarmed",
type: "text",
title: "Disarmed Phrase",
required: false
]
def pageProperties = [
name: "pageNotifications",
//title: "Notification Options",
nextPage: "pageSetup",
uninstall: false
]
return dynamicPage(pageProperties) {
section("Notification Options") {
paragraph helpAbout
}
section("Push Notifications") {
input inputPushAlarm
input inputPushStatus
}
section("Text Message (SMS) #1") {
input inputPhone1
input inputPhone1Alarm
input inputPhone1Status
}
section("Text Message (SMS) #2") {
input inputPhone2
input inputPhone2Alarm
input inputPhone2Status
}
section("Text Message (SMS) #3") {
input inputPhone3
input inputPhone3Alarm
input inputPhone3Status
}
section("Text Message (SMS) #4") {
input inputPhone4
input inputPhone4Alarm
input inputPhone4Status
}
section("Pushbullet Notifications") {
input inputPushbulletDevice
input inputPushbulletAlarm
input inputPushbulletStatus
}
section("Audio Notifications") {
input inputAudioPlayers
input inputSpeechOnAlarm
input inputSpeechOnStatus
input inputSpeechTextAlarm
input inputSpeechTextArmedAway
input inputSpeechTextArmedStay
input inputSpeechTextDisarmed
}
}
}
// Show "Remote Control Options" page
def pageRemoteOptions() {
LOG("pageRemoteOptions()")
def helpRemote =
"You can arm and disarm Smart Alarm using any compatible remote " +
"control, for example Aeon Labs Minimote."
def inputRemotes = [
name: "remotes",
type: "capability.button",
title: "Which remote controls?",
multiple: true,
required: false
]
def inputArmAwayButton = [
name: "buttonArmAway",
type: "number",
title: "Which button?",
required: false
]
def inputArmAwayHold = [
name: "holdArmAway",
type: "bool",
title: "Hold to activate",
defaultValue: false,
required: true
]
def inputArmStayButton = [
name: "buttonArmStay",
type: "number",
title: "Which button?",
required: false
]
def inputArmStayHold = [
name: "holdArmStay",
type: "bool",
title: "Hold to activate",
defaultValue: false,
required: true
]
def inputDisarmButton = [
name: "buttonDisarm",
type: "number",
title: "Which button?",
required: false
]
def inputDisarmHold = [
name: "holdDisarm",
type: "bool",
title: "Hold to activate",
defaultValue: false,
required: true
]
def inputPanicButton = [
name: "buttonPanic",
type: "number",
title: "Which button?",
required: false
]
def inputPanicHold = [
name: "holdPanic",
type: "bool",
title: "Hold to activate",
defaultValue: false,
required: true
]
def pageProperties = [
name: "pageRemoteOptions",
//title: "Remote Control Options",
nextPage: "pageSetup",
uninstall: false
]
return dynamicPage(pageProperties) {
section("Remote Control Options") {
paragraph helpRemote
input inputRemotes
}
section("Arm Away Button") {
input inputArmAwayButton
input inputArmAwayHold
}
section("Arm Stay Button") {
input inputArmStayButton
input inputArmStayHold
}
section("Disarm Button") {
input inputDisarmButton
input inputDisarmHold
}
section("Panic Button") {
input inputPanicButton
input inputPanicHold
}
}
}
// Show "REST API Options" page
def pageRestApiOptions() {
LOG("pageRestApiOptions()")
def textHelp =
"Smart Alarm can be controlled remotely by any Web client using " +
"REST API. Please refer to Smart Alarm documentation for more " +
"information."
def textPincode =
"You can specify optional PIN code to protect arming and disarming " +
"Smart Alarm via REST API from unauthorized access. If set, the " +
"PIN code is always required for disarming Smart Alarm, however " +
"you can optionally turn it off for arming Smart Alarm."
def inputRestApi = [
name: "restApiEnabled",
type: "bool",
title: "Enable REST API",
defaultValue: false
]
def inputPincode = [
name: "pincode",
type: "number",
title: "PIN Code",
required: false
]
def inputArmWithPin = [
name: "armWithPin",
type: "bool",
title: "Require PIN code to arm",
defaultValue: true
]
def pageProperties = [
name: "pageRestApiOptions",
//title: "REST API Options",