-
Notifications
You must be signed in to change notification settings - Fork 7
/
Message Central Child Variable
3387 lines (2641 loc) · 121 KB
/
Message Central Child Variable
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
/**
* **************** Message_Central_Child ****************
*
* Design Usage:
* This is the 'Child' app for message automation...
*
*
* Copyright 2018 Andrew Parker
*
* This SmartApp is free!
* Donations to support development efforts are accepted via:
*
* Paypal at: https://www.paypal.me/smartcobra
*
*
* I'm very happy for you to use this app without a donation, but if you find it useful then it would be nice to get a 'shout out' on the forum! - @Cobra
* Have an idea to make this app better? - Please let me know :)
*
*
*
*-------------------------------------------------------------------------------------------------------------------
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License
* for the specific language governing permissions and limitations under the License.
*-------------------------------------------------------------------------------------------------------------------
*
*
* Last Update: 01/09/2018
*
* Changes:
*
* V11.1.0 - Fixed 'Presence' (with speechSynth device) - Fixed 'Time Restrictions' - Fixed 'Quiet Time' - Made all other variables work inside 'Group#' random variable
* V11.0.0 - Major recode to cover options for 'Speech Synthesis'
* V10.6.0 - Added weather variables (use with weather driver or individual sensors)
* V10.5.0 - Debug disable switch & power input (allow decimal input)
* V10.4.0 - Sorted out %date% %year% & %day% variables (to correct errors in different format for Hubitat)
* V10.3.0 - Added Mode restriction in Hubitat format (previous format was not working correctly) and debug/reformat of version checking
* V10.2.1 - Debug 'colon' was being spoken - now replaced with a space in message conversion
* V10.2.0 - Added version checking
* V10.1.0 - Added 'Join' messaging & debug
* V10.0.0 - Hubitat port
*
*
* V3.3.0 - Made random messages configurable from GUI
* V3.2.0 - added random 'pre' & 'post' message variables - also 'wakeup' variable messages
* V3.1.2 - added variable: %greeting% - to say 'good morning' , 'good afternoon' ... etc...
* V3.1.1 - UI slight revamp
* V3.1.0 - Added a second presence restriction - Useful if you want something to happen when one person is home but NOT another
* V3.0.1 - Added additional variables: %device% & %event%
* V3.0.0 - Added a new trigger setup 'Appliance Power Monitor' - This uses a second power threshold which must be exceeded before monitoring starts
* V2.9.0 - Added Missed message config to 'Time' trigger
* V2.8.0 - Added %opencontact% variable to check any open windows/door
* V2.7.0 - Added 'Button' as a trigger - either pushed or held
* V2.6.1 - Added delay between messages to SMS/Push
* V2.6.0 - Added 'Temperature' trigger ability for above or below configured temperature
* V2.5.0 - Added 'Motion' trigger ability for motion 'active' or 'inactive'
* V2.4.1 - Debug issue with presence restrictions not working correctly
* V2.4.0 - Revamped Weather Report - converted it to variable %weather%
* V2.3.2 - Changed %day% variable to correct English
* V2.3.1 - Added option to use 24hr format
* V2.3.0 - Added %time%, %day%, %date%, %year% as variables used in messages
* V2.2.0 - Removed requirement for allowed time & days - Now optional
* V2.1.0 - GUI revamp - Moved restrictions to their own page
* V2.0.1 - Debug
* V2.0.0 - Added 'Weather Report' - Trigger with Switch, Water, Contact, & Time
* V1.9.0 - Added 'Open Too Long' to speak when a contact (door?) has been open for more than the configured number of minutes
* V1.8.0 - Added ability to speak/send message if contact is open at a certain time (Used to check I closed the shed door)
* V1.7.0 - Added ability to SMS/Push instead of speaking
* V1.6.0 - Added Routines & Mode Change as triggers
* V1.5.1 - Debug - Disable switch not always working
* V1.5.0 - Added 'Presence' restriction so will only speak if someone is present/not present
* V1.4.0 - Added 'Power' trigger and ability to use 'and stays that way' to use with Washer or Dryer applicance
* V1.3.2 - Debug
* V1.3.1 - Code cleanup & new icon path
* V1.3.0 - Added 'quiet' time to allow different volume levels at certain times
* V1.2.2 - New Icons
* V1.2.1 - Debug - Time did not have day restriction
* V1.2.0 - Added switchable logging
* V1.1.0 - Added delay between messages
* V1.0.2 - Debug
* V1.0.1 - Header & Debug
* V1.0.0 - POC
*
* If modifying this project, please keep the above header intact and add your comments/credits below - Thank you! - @Cobra
*
*-------------------------------------------------------------------------------------------------------------------
*/
definition(
name: "Message_Central_Child",
namespace: "Cobra",
author: "Andrew Parker",
description: "Child App for Message Automation",
category: "Fun & Social",
parent: "Cobra:Message Central",
iconUrl: "",
iconX2Url: "",
iconX3Url: "")
preferences {
page name: "mainPage", title: "", install: false, uninstall: true, nextPage: "restrictionsPage"
page name: "pageHelp"
page name: "pageHelpVariables"
page name: "prePostPage1"
page name: "prePostPage2"
page name: "wakeUpPage"
page name: "restrictionsPage", title: "", install: false, uninstall: true, nextPage: "variablesPage"
page name: "variablesPage", title: "", install: false, uninstall: true, nextPage: "namePage"
page name: "namePage", title: "", install: true, uninstall: true
}
def installed() {
initialize()
}
def updated() {
unschedule()
initialize()
}
def initialize() {
log.info "Initialised with settings: ${settings}"
logCheck()
version()
switchRunCheck()
state.timer1 = true
state.timer2 = true
state.timeDelay = 0
state.duration = "10"
if (!restrictPresenceSensor){
state.presenceRestriction = true
}
if (!restrictPresenceSensor1){
state.presenceRestriction1 = true
}
state.contact1SW = 'closed'
if(state.msgType == "Voice Message"){
checkVolume()
}
// Subscriptions
subscribe(enableSwitch, "switch", switchEnable)
if(trigger == 'Time'){
LOGDEBUG("Trigger is $trigger")
schedule(runTime,timeTalkNow)
if (missedPresenceSensor1){subscribe(missedPresenceSensor1, "presence", missedPresenceCheckNow)}
}
if(trigger == 'Time if Contact Open'){
LOGDEBUG("Trigger is $trigger")
schedule(runTime,timeTalkNow1)
subscribe(contact1, "contact", contact1Handler)
}
else if(trigger == 'Button'){
LOGDEBUG( "Trigger is $trigger")
subscribe(button1, "button", buttonEvent)
}
else if(trigger == 'Switch'){
LOGDEBUG( "Trigger is $trigger")
subscribe(switch1, "switch", switchTalkNow)
}
else if(trigger == 'Water'){
LOGDEBUG( "trigger is $trigger")
subscribe(water1, "water.wet", waterTalkNow)
subscribe(water1, "water.dry", waterTalkNow)
}
else if(trigger == 'Contact'){
LOGDEBUG( "trigger is $trigger")
subscribe(contactSensor, "contact", contactTalkNow)
}
else if(trigger == 'Presence'){
LOGDEBUG("trigger is $trigger")
subscribe(presenceSensor1, "presence", presenceTalkNow)
}
else if(trigger == 'Power'){
LOGDEBUG("trigger is $trigger")
subscribe(powerSensor, "power", powerTalkNow)
}
else if(trigger == 'Appliance Power Monitor'){
LOGDEBUG("trigger is $trigger")
subscribe(powerSensor, "power", powerApplianceNow)
}
else if(trigger == 'Motion'){
LOGDEBUG("trigger is $trigger")
subscribe(motionSensor, "motion" , motionTalkNow)
}
else if(trigger == 'Temperature'){
LOGDEBUG("trigger is $trigger")
subscribe(tempSensor, "temperature" , tempTalkNow)
}
else if(trigger == 'Mode Change'){
LOGDEBUG("trigger is $trigger")
subscribe(location, "mode", modeChangeHandler)
}
else if(trigger == 'Contact - Open Too Long'){
LOGDEBUG("trigger is $trigger")
subscribe(openSensor, "contact", tooLongOpen)
state.timeDelay = 0
}
if (restrictPresenceSensor){
subscribe(restrictPresenceSensor, "presence", restrictPresenceSensorHandler)
}
if (restrictPresenceSensor1){
subscribe(restrictPresenceSensor1, "presence", restrictPresence1SensorHandler)
}
if(weather1){
subscribe(weather1, "weatherSummary", weatherSummaryHandler)
subscribe(weather1, "weather", weatherNow)
subscribe(weather1, "forecastHigh", weatherForecastHigh)
subscribe(weather1, "forecastLow", weatherForecastLow)
subscribe(weather1, "humidity", weatherHumidity)
subscribe(weather1, "temperature", weatherTemperature)
subscribe(weather1, "feelsLike", weatherFeelsLike)
subscribe(weather1, "wind_dir", weatherWindDir)
subscribe(weather1, "wind", weatherWindSpeed)
subscribe(weather1, "wind_gust", weatherWindGust)
subscribe(weather1, "visibility", weatherVisibility)
subscribe(weather1, "chanceOfRain", weatherChanceOfRain)
}
}
// main page *************************************************************************
def mainPage() {
dynamicPage(name: "mainPage") {
section {
paragraph title: "Message Central Child",
required: false,
"This child app allows you use different triggers to create different messages"
}
display()
section{
href "pageHelp", title:"Message Variables", description:"Tap here for a list of 'variables' you can configure for use in your messages (and what they do)"
}
section() {
speakerInputs()
triggerInput()
actionInputs()
}
}
}
def variablesPage() {
dynamicPage(name: "variablesPage") {
restrictionInputs()
}
}
def prePostPage1() {
dynamicPage(name: "prePostPage1") {
state.preCount = settings.preCount.toInteger()
section() {
if (state.preCount != null && state.preCount > 0) {
for(int i = 0; i<state.preCount; i++) {
g1Item = getGroup1(i)
g1ItemPadded = (i<9 ?'0' : '') + (i+1)
if(state.preCount>i){
input "preMsg${g1ItemPadded}", "text", title: " %group1% - message ${g1ItemPadded}", required: false, defaultValue: "${g1Item}"
}
}
}
}
}
}
def prePostPage2() {
dynamicPage(name: "prePostPage2") {
state.postCount = settings.postCount.toInteger()
section() {
if (state.postCount != null && state.postCount > 0) {
for(int i = 0; i<state.postCount; i++) {
g2Item = getGroup2(i)
g2ItemPadded = (i<9 ?'0' : '') + (i+1)
if(state.postCount>i){
input "postMsg${g2ItemPadded}", "text", title: " %group2% - message ${g2ItemPadded}", required: false, defaultValue: "${g2Item}"
}
}
}
}
}
}
def wakeUpPage() {
dynamicPage(name: "wakeUpPage") {
state.wakeCount = settings.wakeCount.toInteger()
section() {
if (state.wakeCount != null && state.wakeCount > 0) {
for(int i = 0; i<state.wakeCount; i++) {
g3Item = getGroup3(i)
g3ItemPadded = (i<9 ?'0' : '') + (i+1)
if(state.wakeCount>i){
input "wakeMsg${g3ItemPadded}", "text", title: " %group3% - message ${g3ItemPadded}", required: false, defaultValue: "${g3Item}"
}
}
}
}
}
}
def pageHelpVariables(){
dynamicPage(name: "pageHelpVariables", title: "Message Variables", install: false, uninstall:false){
section("The following variables can be used in your event messages and will be replaced with the details listed below"){
def AvailableVariables = ""
AvailableVariables += " %time% - Replaced with current time in 12 or 24 hour format (Switchable)\n\n"
AvailableVariables += " %day% - Replaced with current day of the week\n\n"
AvailableVariables += " %date% - Replaced with current day number & month\n\n"
AvailableVariables += " %year% - Replaced with the current year\n\n"
AvailableVariables += " %greeting% - Replaced with 'Good Morning', 'Good Afternoon' or 'Good Evening' (evening starts at 6pm)\n\n"
AvailableVariables += " %group1% - Replaced with the a random message from Group1\n\n"
AvailableVariables += " %group2% - Replaced with the a random message from Group2\n\n"
AvailableVariables += " %group3% - Replaced with the a random message from Group3\n\n"
AvailableVariables += " %opencontact% - Replaced with a list of configured contacts if they are open\n\n"
AvailableVariables += " %closedcontact% - Replaced with a list of configured contacts if they are closed\n\n"
AvailableVariables += " %device% - Replaced with the name of the triggering device\n\n"
AvailableVariables += " %event% - Replaced with what triggered the action (e.g. On/Off, Wet/Dry) \n\n"
AvailableVariables += " Weather Variables (Available if your weather device supports them as attributes)\n\n"
AvailableVariables += " %wsum% - Replaced with a weather summary \n\n"
AvailableVariables += " %high% - Replaced with a 'Forecast High' \n\n"
AvailableVariables += " %low% - Replaced with a 'Forecast Low \n\n"
AvailableVariables += " %hum% - Replaced with a 'Humidity' \n\n"
AvailableVariables += " %wnow% - Replaced with 'Weather Now' \n\n"
AvailableVariables += " %rain% - Replaced with 'Chance of Rain' \n\n"
AvailableVariables += " %vis% - Replaced with 'Visibility' \n\n"
AvailableVariables += " %wgust% - Replaced with 'Wind Gust' \n\n"
AvailableVariables += " %wspeed% - Replaced with 'Wind Speed' \n\n"
AvailableVariables += " %wdir% - Replaced with 'Wind Direction' \n\n"
AvailableVariables += " %feel% - Replaced with 'FeelsLike' \n\n"
AvailableVariables += " %temp% - Replaced with 'Temperature' "
paragraph(AvailableVariables)
}
}
}
def pageHelp(){
dynamicPage(name: "pageHelp", title: "Message Variables", install: false, uninstall:false){
section(){
href "pageHelpVariables", title:"Message Variables Help", description:"Tap here to view the available variables"
input "preCount", "number", title: "Number of 'Group1' Random Phrases?", required: true, defaultValue: 25;
if(settings.preCount>0){href "prePostPage1", title:"Group1 Random Messages", description:"Tap here to configure 'Group1' random messages"}
input "postCount", "number", title: "Number of 'Group2' Random Phrases?", required: true, defaultValue: 25;
if(settings.postCount>0){href "prePostPage2", title:"Group2 Random Messages", description:"Tap here to configure 'Group2 random messages"}
input "wakeCount", "number", title: "Number of 'Group3' Random Phrases?", required: true, defaultValue: 10;
if(settings.wakeCount>0){href "wakeUpPage", title:"Group3 Random Messages", description:"Tap here to configure 'Group3' random messages"}
}
}
}
def restrictionsPage() {
dynamicPage(name: "restrictionsPage") {
section("Time Format") {
input "hour24", "bool", title: "If using the %time% variable, On = 24hr format - Off = 12Hr format", required: true, defaultValue: false, submitOnChange: true
}
section("Check Contacts") {
input "sensors", "capability.contactSensor", title: "If using the %opencontact% or %closedcontact% variable, choose window/door contact", required: false, multiple: true, submitOnChange: true
}
section("Weather Device") {
input "weather1", "capability.sensor", title: "If using any of the weather variables, choose weather device", required: false, multiple: false, submitOnChange: true
}
}
}
def namePage() {
dynamicPage(name: "namePage") {
section("Automation name") {
label title: "Enter a name for this message automation", required: false
}
section("Logging") {
input "debugMode", "bool", title: "Enable logging", required: true, defaultValue: false
}
}
}
// defaults
def speakerInputs(){
input "enableSwitch", "capability.switch", title: "Select switch Enable/Disable this message (Optional)", required: false, multiple: false
input "messageAction", "enum", title: "Select Message Type", required: false, submitOnChange: true, options: [ "Voice Message (MusicPlayer)", "Voice Message (SpeechSynth)", "SMS Message", "PushOver Message", "Join Message", "Play an Mp3 (No variables can be used)"]
if (messageAction){
state.msgType = messageAction
if(state.msgType == "Voice Message (MusicPlayer)"){
input "speaker", "capability.musicPlayer", title: "Music Player Device(s)", required: false, multiple: true
input "volume1", "number", title: "Normal Speaker volume", description: "0-100%", defaultValue: "80", required: true
}
else if(state.msgType == "PushOver Message"){
input "speaker", "capability.speechSynthesis", title: "PushOver Device", required: false, multiple: true
}
else if(state.msgType == "Voice Message (SpeechSynth)"){
input "speaker", "capability.speechSynthesis", title: "Speech Synthesis Device(s)", required: false, multiple: true
}
else if(state.msgType == "Join Message"){
input "speaker", "capability.speechSynthesis", title: "Join API Device", required: false, multiple: true
}
else if(state.msgType == "SMS Message"){
input(name: "sms1", type: "phone", title: "Input 1st Phone Number ", required: false)
input(name: "sms2", type: "phone", title: "Input 2nd Phone Number ", required: false)
input(name: "sms3", type: "phone", title: "Input 3rd Phone Number ", required: false)
input(name: "sms4", type: "phone", title: "Input 4th Phone Number ", required: false)
input(name: "sms5", type: "phone", title: "Input 5th Phone Number ", required: false)
}
if(state.msgType == "Play an Mp3 (No variables can be used)"){
input "speaker", "capability.musicPlayer", title: "Speaker ", required: true, multiple: true
input "volume1", "number", title: "volume", description: "0-100%", required: true
input "duration", "number", title: "Duration of mp3 (seconds)", required: true
input "mp3Delay", "number", title: "Seconds after event before playing mp3", description: "Seconds", defaultValue: '0', required: true
input "msgDelay", "number", title: "Number of minutes between messages", description: "Minutes", required: true
input "pathURI", "text", title: "Enter URI to mp3 files (e.g. mydomain.com/files or localwebserver/files or IPaddress/files)", required: true
input "sound", "text", title: "Enter mp3 name here (e.g. alert.mp3)", required: true
}
}
}
// inputs ***********************************************************************************
def triggerInput() {
input "trigger", "enum", title: "How to trigger message?",required: false, submitOnChange: true, options: ["Appliance Power Monitor", "Contact", "Contact - Open Too Long", "Switch", "Mode Change", "Motion", "Power", "Presence", "Time", "Time if Contact Open", "Water"]
/// "Temperature", "Button",
}
def restrictionInputs(){
section() {
input "restrictions1", "bool", title: "Restrict by Time & Day", required: true, defaultValue: false, submitOnChange: true
input "restrictions2", "bool", title: "Restrict Volume by Time", required: true, defaultValue: false, submitOnChange: true
input "restrictions3", "bool", title: "Restrict by Presence Sensor", required: true, defaultValue: false, submitOnChange: true
}
section() {
input(name:"modes", type: "mode", title: "Set for specific mode(s)", multiple: true, required: false)
}
if(restrictions1){
section("Time/Day") {
input "fromTime", "time", title: "Allow messages from", required: false
input "toTime", "time", title: "Allow messages until", required: false
input "days", "enum", title: "Select Days of the Week", required: false, multiple: true, options: ["Monday": "Monday", "Tuesday": "Tuesday", "Wednesday": "Wednesday", "Thursday": "Thursday", "Friday": "Friday", "Saturday": "Saturday", "Sunday": "Sunday"]
}
}
if(restrictions2){
section("'Quiet Time' - This is to reduce volume during a specified time") {
input "volume2", "number", title: "Quiet Time Speaker volume", description: "0-100%", required: false, submitOnChange: true
if(volume2){
input "fromTime2", "time", title: "Quiet Time Start", required: false
input "toTime2", "time", title: "Quiet Time End", required: false
}
}
}
if(restrictions3){
section("This is to restrict on 1 or 2 presence sensor(s)") {
input "restrictPresenceSensor", "capability.presenceSensor", title: "Select presence sensor 1 to restrict action", required: false, multiple: false, submitOnChange: true
if(restrictPresenceSensor){
input "restrictPresenceAction", "bool", title: " On = Action only when someone is 'Present' \r\n Off = Action only when someone is 'NOT Present' ", required: true, defaultValue: false
}
input "restrictPresenceSensor1", "capability.presenceSensor", title: "Select presence sensor 2 to restrict action", required: false, multiple: false, submitOnChange: true
if(restrictPresenceSensor1){
input "restrictPresenceAction1", "bool", title: " On = Action only when someone is 'Present' \r\n Off = Action only when someone is 'NOT Present' ", required: true, defaultValue: false
}
}
}
}
def actionInputs() {
if (trigger) {
state.selection = trigger
if(state.selection == 'Button'){
input "button1", "capability.button", title: "Button", multiple: false, required: false
if(state.msgType == "Voice Message (MusicPlayer)"){
input "message1", "text", title: "Message to play when button pressed", required: false, submitOnChange: true
input "message2", "text", title: "Message to play when button held", required: false, submitOnChange: true
input "triggerDelay", "number", title: "Delay after trigger before speaking (Enter 0 for no delay)", defaultValue: '0', description: "Seconds", required: true
input "msgDelay", "number", title: "Delay between messages (Enter 0 for no delay)", defaultValue: '0', description: "Minutes", required: true
}
if(state.msgType == "SMS Message"){
input "message1", "text", title: "Message to send when button pressed", required: false, submitOnChange: true
input "message2", "text", title: "Message to send when button held", required: false, submitOnChange: true
input "triggerDelay", "number", title: "Delay after trigger before sending (Enter 0 for no delay)", defaultValue: '0', description: "Seconds", required: true
input "msgDelay", "number", title: "Delay between messages (Enter 0 for no delay)", defaultValue: '0', description: "Minutes", required: true
}
if(state.msgType == "PushOver Message"){
input "message1", "text", title: "Message to send when button pressed", required: false
input "priority1", "enum", title: "Message Priority for button pressed",required: true, submitOnChange: true, options: ["None", "Low", "Normal", "High"], defaultValue: "None"
input "message2", "text", title: "Message to send when button held", required: false
input "priority2", "enum", title: "Message Priority for button held",required: true, submitOnChange: true, options: ["None", "Low", "Normal", "High"], defaultValue: "None"
input "msgDelay", "number", title: "Delay between messages (Enter 0 for no delay)", defaultValue: '0', description: "Minutes", required: true
}
if(state.msgType == "Join Message"){
input "message1", "text", title: "Message to send when button pressed", required: false
input "message2", "text", title: "Message to send when button held", required: false
input "msgDelay", "number", title: "Delay between messages (Enter 0 for no delay)", defaultValue: '0', description: "Minutes", required: true
}
}
if(state.selection == 'Switch'){
input "switch1", "capability.switch", title: "Select switch to trigger message/report", required: false, multiple: false
if(state.msgType == "Voice Message (MusicPlayer)"){
input "message1", "text", title: "Message to play when switched on", required: false, submitOnChange: true
input "message2", "text", title: "Message to play when switched off", required: false, submitOnChange: true
input "triggerDelay", "number", title: "Delay after trigger before speaking (Enter 0 for no delay)", defaultValue: '0', description: "Seconds", required: true
input "msgDelay", "number", title: "Delay between messages (Enter 0 for no delay)", defaultValue: '0', description: "Minutes", required: true
}
if(state.msgType == "Voice Message (SpeechSynth)"){
input "message1", "text", title: "Message to play when switched on", required: false, submitOnChange: true
input "message2", "text", title: "Message to play when switched off", required: false, submitOnChange: true
input "triggerDelay", "number", title: "Delay after trigger before speaking (Enter 0 for no delay)", defaultValue: '0', description: "Seconds", required: true
input "msgDelay", "number", title: "Delay between messages (Enter 0 for no delay)", defaultValue: '0', description: "Minutes", required: true
}
if(state.msgType == "SMS Message"){
input "message1", "text", title: "Message to send when switched On", required: false, submitOnChange: true
input "message2", "text", title: "Message to send when switched Off", required: false, submitOnChange: true
input "triggerDelay", "number", title: "Delay after trigger before sending (Enter 0 for no delay)", defaultValue: '0', description: "Seconds", required: true
input "msgDelay", "number", title: "Delay between messages (Enter 0 for no delay)", defaultValue: '0', description: "Minutes", required: true
}
if(state.msgType == "PushOver Message"){
input "message1", "text", title: "Message to send when switched on", required: false
input "priority1", "enum", title: "Message Priority for switch on",required: true, submitOnChange: true, options: ["None", "Low", "Normal", "High"], defaultValue: "None"
input "message2", "text", title: "Message to send when switched off", required: false
input "priority2", "enum", title: "Message Priority for switch off",required: true, submitOnChange: true, options: ["None", "Low", "Normal", "High"], defaultValue: "None"
input "msgDelay", "number", title: "Delay between messages (Enter 0 for no delay)", defaultValue: '0', description: "Minutes", required: true
}
if(state.msgType == "Join Message"){
input "message1", "text", title: "Message to send when switched on", required: false
input "message2", "text", title: "Message to send when switched off", required: false
input "msgDelay", "number", title: "Delay between messages (Enter 0 for no delay)", defaultValue: '0', description: "Minutes", required: true
}
if(state.msgType == "Play an Mp3 (No variables can be used)"){
input "mp3Action", "bool", title: "Play mp3 when switch on (ON) or off (OFF)? ", required: true, defaultValue: true
}
}
else if(state.selection == 'Water'){
input "water1", "capability.waterSensor", title: "Select water sensor to trigger message", required: false, multiple: false
if(state.msgType == "Voice Message (MusicPlayer)"){
input "message1", "text", title: "Message to play when WET", required: false
input "message2", "text", title: "Message to play when DRY", required: false
input "triggerDelay", "number", title: "Delay after trigger before speaking (Enter 0 for no delay)", description: "Seconds", required: true
input "msgDelay", "number", title: "Delay between messages (Enter 0 for no delay)", defaultValue: '0', description: "Minutes", required: true
}
if(state.msgType == "Voice Message (SpeechSynth)"){
input "message1", "text", title: "Message to play when WET", required: false
input "message2", "text", title: "Message to play when DRY", required: false
input "triggerDelay", "number", title: "Delay after trigger before speaking (Enter 0 for no delay)", description: "Seconds", required: true
input "msgDelay", "number", title: "Delay between messages (Enter 0 for no delay)", defaultValue: '0', description: "Minutes", required: true
}
if(state.msgType == "SMS Message"){
input "message1", "text", title: "Message to send when Wet", required: false
input "message2", "text", title: "Message to send when Dry", required: false
input "triggerDelay", "number", title: "Delay after trigger before sending (Enter 0 for no delay)", defaultValue: '0', description: "Seconds", required: true
input "msgDelay", "number", title: "Delay between messages (Enter 0 for no delay)", defaultValue: '0', description: "Minutes", required: true
}
if(state.msgType == "PushOver Message"){
input "message1", "text", title: "Message to send when wet", required: false
input "priority1", "enum", title: "Message Priority for wet", required: true, submitOnChange: true, options: ["None", "Low", "Normal", "High"], defaultValue: "None"
input "message2", "text", title: "Message to send when dry", required: false
input "priority2", "enum", title: "Message Priority for dry",required: true, submitOnChange: true, options: ["None", "Low", "Normal", "High"], defaultValue: "None"
input "msgDelay", "number", title: "Delay between messages (Enter 0 for no delay)", defaultValue: '0', description: "Minutes", required: true
}
if(state.msgType == "Join Message"){
input "message1", "text", title: "Message to send when wet", required: false
input "message2", "text", title: "Message to send when dry", required: false
input "msgDelay", "number", title: "Delay between messages (Enter 0 for no delay)", defaultValue: '0', description: "Minutes", required: true
}
if(state.msgType == "Play an Mp3 (No variables can be used)"){
input "water1", "capability.waterSensor", title: "Select water sensor to trigger message", required: false, multiple: false
input "mp3Action", "bool", title: "Play mp3 when wet (ON) or dry (OFF)? ", required: true, defaultValue: true
}
}
else if(state.selection == 'Presence'){
input "presenceSensor1", "capability.presenceSensor", title: "Select presence sensor to trigger message", required: false, multiple: false
if(state.msgType == "Voice Message (MusicPlayer)"){
input "message1", "text", title: "Message to play when sensor arrives", required: false
input "message2", "text", title: "Message to play when sensor leaves", required: false
input "triggerDelay", "number", title: "Delay after trigger before speaking (Enter 0 for no delay)", defaultValue: "0", description: "Seconds", required: true
input "msgDelay", "number", title: "Delay between messages (Enter 0 for no delay)", defaultValue: '0', description: "Minutes", required: true
}
if(state.msgType == "Voice Message (SpeechSynth)"){
input "message1", "text", title: "Message to play when sensor arrives", required: false
input "message2", "text", title: "Message to play when sensor leaves", required: false
input "triggerDelay", "number", title: "Delay after trigger before speaking (Enter 0 for no delay)", defaultValue: "0", description: "Seconds", required: true
input "msgDelay", "number", title: "Delay between messages (Enter 0 for no delay)", defaultValue: '0', description: "Minutes", required: true
}
if(state.msgType == "SMS Message"){
input "message1", "text", title: "Message to send when sensor arrives", required: false
input "message2", "text", title: "Message to send when sensor leaves", required: false
input "triggerDelay", "number", title: "Delay after trigger before sending (Enter 0 for no delay)", defaultValue: '0', description: "Seconds", required: true
input "msgDelay", "number", title: "Delay between messages (Enter 0 for no delay)", defaultValue: '0', description: "Minutes", required: true
}
if(state.msgType == "PushOver Message"){
input "message1", "text", title: "Message to send when sensor arrives", required: false
input "priority1", "enum", title: "Message Priority for arrival",required: true, submitOnChange: true, options: ["None", "Low", "Normal", "High"], defaultValue: "None"
input "message2", "text", title: "Message to send when sensor leaves", required: false
input "priority2", "enum", title: "Message Priority for departure",required: true, submitOnChange: true, options: ["None", "Low", "Normal", "High"], defaultValue: "None"
input "msgDelay", "number", title: "Delay between messages (Enter 0 for no delay)", defaultValue: '0', description: "Minutes", required: true
}
if(state.msgType == "Join Message"){
input "message1", "text", title: "Message to send when sensor arrives", required: false
input "message2", "text", title: "Message to send when sensor leaves", required: false
input "msgDelay", "number", title: "Delay between messages (Enter 0 for no delay)", defaultValue: '0', description: "Minutes", required: true
}
if(state.msgType == "Play an Mp3 (No variables can be used)"){
input "mp3Action", "bool", title: "Play mp3 when arrived (ON) or departed (OFF)? ", required: true, defaultValue: true
}
}
else if(state.selection == 'Contact'){
input "contactSensor", "capability.contactSensor", title: "Select contact sensor to trigger message", required: false, multiple: false
if(state.msgType == "Voice Message (MusicPlayer)"){
input "message1", "text", title: "Message to play when sensor opens", required: false
input "message2", "text", title: "Message to play when sensor closes", required: false
input "triggerDelay", "number", title: "Delay after trigger before speaking (Enter 0 for no delay)", description: "Seconds", required: true
input "msgDelay", "number", title: "Delay between messages (Enter 0 for no delay)", defaultValue: '0', description: "Minutes", required: true
}
if(state.msgType == "Voice Message (SpeechSynth)"){
input "message1", "text", title: "Message to play when sensor opens", required: false
input "message2", "text", title: "Message to play when sensor closes", required: false
input "triggerDelay", "number", title: "Delay after trigger before speaking (Enter 0 for no delay)", description: "Seconds", required: true
input "msgDelay", "number", title: "Delay between messages (Enter 0 for no delay)", defaultValue: '0', description: "Minutes", required: true
}
if(state.msgType == "SMS Message"){
input "message1", "text", title: "Message to send when sensor opens", required: false
input "message2", "text", title: "Message to send when sensor closes", required: false
input "triggerDelay", "number", title: "Delay after trigger before sending (Enter 0 for no delay)", defaultValue: '0', description: "Seconds", required: true
input "msgDelay", "number", title: "Delay between messages (Enter 0 for no delay)", defaultValue: '0', description: "Minutes", required: true
}
if(state.msgType == "PushOver Message"){
input "message1", "text", title: "Message to send when sensor open", required: false
input "priority1", "enum", title: "Message Priority for open",required: true, submitOnChange: true, options: ["None", "Low", "Normal", "High"], defaultValue: "None"
input "message2", "text", title: "Message to send when sensor closed", required: false
input "priority2", "enum", title: "Message Priority for closed",required: true, submitOnChange: true, options: ["None", "Low", "Normal", "High"], defaultValue: "None"
input "msgDelay", "number", title: "Delay between messages (Enter 0 for no delay)", defaultValue: '0', description: "Minutes", required: true
}
if(state.msgType == "Join Message"){
input "message1", "text", title: "Message to send when sensor open", required: false
input "message2", "text", title: "Message to send when sensor closed", required: false
input "msgDelay", "number", title: "Delay between messages (Enter 0 for no delay)", defaultValue: '0', description: "Minutes", required: true
}
if(state.msgType == "Play an Mp3 (No variables can be used)"){
input "mp3Action", "bool", title: "Play mp3 when open (ON) or closed (OFF)? ", required: true, defaultValue: true
}
}
else if(state.selection == 'Power'){
input "powerSensor", "capability.powerMeter", title: "Select power sensor to trigger message", required: false, multiple: false
input(name: "belowThreshold", type: "decimal", title: "Power Threshold (Watts)", required: true, description: "this number of watts")
input "actionType1", "bool", title: "Select Power Sensor action type: \r\n \r\n On = Alert when power goes ABOVE configured threshold \r\n Off = Alert when power goes BELOW configured threshold", required: true, defaultValue: false
input(name: "delay1", type: "number", title: "Only if it stays that way for this number of minutes...", required: true, description: "this number of minutes", defaultValue: '0')
if(state.msgType == "Voice Message (MusicPlayer)"){
input "message1", "text", title: "Message to play ...", required: false
input "triggerDelay", "number", title: "Delay after trigger before speaking (Enter 0 for no delay - Seconds)", description: "Seconds", required: true, defaultValue: '0'
input "msgDelay", "number", title: "Delay between messages (Enter 0 for no delay)", defaultValue: '0', description: "Minutes", required: true
}
if(state.msgType == "Voice Message (SpeechSynth)"){
input "message1", "text", title: "Message to play ...", required: false
input "triggerDelay", "number", title: "Delay after trigger before speaking (Enter 0 for no delay - Seconds)", description: "Seconds", required: true, defaultValue: '0'
input "msgDelay", "number", title: "Delay between messages (Enter 0 for no delay)", defaultValue: '0', description: "Minutes", required: true
}
if(state.msgType == "SMS Message"){
input "message1", "text", title: "Message to send...", required: false
input "triggerDelay", "number", title: "Delay after trigger before sending (Enter 0 for no delay)", defaultValue: '0', description: "Seconds", required: true
input "msgDelay", "number", title: "Delay between messages (Enter 0 for no delay)", defaultValue: '0', description: "Minutes", required: true
}
if(state.msgType == "PushOver Message"){
input "message1", "text", title: "Message to send...", required: false
input "priority1", "enum", title: "Message Priority...", required: true, submitOnChange: true, options: ["None", "Low", "Normal", "High"], defaultValue: "None"
input "msgDelay", "number", title: "Delay between messages (Enter 0 for no delay)", defaultValue: '0', description: "Minutes", required: true
}
if(state.msgType == "Join Message"){
input "message1", "text", title: "Message to send...", required: false
input "msgDelay", "number", title: "Delay between messages (Enter 0 for no delay)", defaultValue: '0', description: "Minutes", required: true
}
}
else if(state.selection == 'Appliance Power Monitor'){
input "powerSensor", "capability.powerMeter", title: "Select power sensor to trigger message", required: true, multiple: false
input(name: "belowThreshold", type: "decimal", title: "Below Power Threshold (Watts)", required: true, description: "Trigger below this number of watts", defaultValue: '0')
input(name: "delay2", type: "number", title: "Only if it stays that way for this number of minutes...", required: true, description: "this number of minutes", defaultValue: '0')
input(name: "aboveThreshold", type: "number", title: "Activate Power Threshold (Watts)", required: true, description: "Start monitoring above this number of watts", defaultValue: '0')
if(state.msgType == "Voice Message (MusicPlayer)"){
input "message1", "text", title: "Message to play ...", required: false
input "triggerDelay", "number", title: "Delay after trigger before speaking (Enter 0 for no delay - Seconds)", description: "Seconds", required: true, defaultValue: '0'
input "msgDelay", "number", title: "Delay between messages (Enter 0 for no delay)", defaultValue: '0', description: "Minutes", required: true
}
if(state.msgType == "Voice Message (SpeechSynth)"){
input "message1", "text", title: "Message to play ...", required: false
input "triggerDelay", "number", title: "Delay after trigger before speaking (Enter 0 for no delay - Seconds)", description: "Seconds", required: true, defaultValue: '0'
input "msgDelay", "number", title: "Delay between messages (Enter 0 for no delay)", defaultValue: '0', description: "Minutes", required: true
}
if(state.msgType == "SMS Message"){
input "message1", "text", title: "Message to send...", required: false
input "triggerDelay", "number", title: "Delay after trigger before sending (Enter 0 for no delay)", defaultValue: '0', description: "Seconds", required: true
input "msgDelay", "number", title: "Delay between messages (Enter 0 for no delay)", defaultValue: '0', description: "Minutes", required: true
}
if(state.msgType == "PushOver Message"){
input "message1", "text", title: "Message to send...", required: false
input "priority1", "enum", title: "Message Priority...", required: true, submitOnChange: true, options: ["None", "Low", "Normal", "High"], defaultValue: "None"
input "msgDelay", "number", title: "Delay between messages (Enter 0 for no delay)", defaultValue: '0', description: "Minutes", required: true
}
if(state.msgType == "Join Message"){
input "message1", "text", title: "Message to send...", required: false
input "msgDelay", "number", title: "Delay between messages (Enter 0 for no delay)", defaultValue: '0', description: "Minutes", required: true
}
}
else if(state.selection == 'Motion'){
input "motionSensor", "capability.motionSensor", title: "Select Motion Sensor", required: false, multiple: false
input "motionActionType", "bool", title: "Select Motion Sensor action type: \r\n \r\n On = Alert when motion 'Active' \r\n Off = Alert when motion 'Inactive'", required: true, defaultValue: false
if(state.msgType == "Voice Message (MusicPlayer)"){
input "message1", "text", title: "Message to play ...", required: false
input "triggerDelay", "number", title: "Delay after trigger before speaking (Enter 0 for no delay - Seconds)", description: "Seconds", required: true, defaultValue: '0'
input "msgDelay", "number", title: "Delay between messages (Enter 0 for no delay)", defaultValue: '0', description: "Minutes", required: true
}
if(state.msgType == "Voice Message (SpeechSynth)"){
input "message1", "text", title: "Message to play ...", required: false
input "triggerDelay", "number", title: "Delay after trigger before speaking (Enter 0 for no delay - Seconds)", description: "Seconds", required: true, defaultValue: '0'
input "msgDelay", "number", title: "Delay between messages (Enter 0 for no delay)", defaultValue: '0', description: "Minutes", required: true
}
if(state.msgType == "SMS Message"){
input "message1", "text", title: "Message to send...", required: false
input "triggerDelay", "number", title: "Delay after trigger before sending (Enter 0 for no delay)", defaultValue: '0', description: "Seconds", required: true
input "msgDelay", "number", title: "Delay between messages (Enter 0 for no delay)", defaultValue: '0', description: "Minutes", required: true
}
if(state.msgType == "PushOver Message"){
input "message1", "text", title: "Message to send...", required: false
input "priority1", "enum", title: "Message Priority...",required: true, submitOnChange: true, options: ["None", "Low", "Normal", "High"], defaultValue: "None"
input "msgDelay", "number", title: "Delay between messages (Enter 0 for no delay)", defaultValue: '0', description: "Minutes", required: true
}
if(state.msgType == "Join Message"){
input "message1", "text", title: "Message to send...", required: false
input "msgDelay", "number", title: "Delay between messages (Enter 0 for no delay)", defaultValue: '0', description: "Minutes", required: true
}
}
else if(state.selection == 'Temperature'){
input "tempSensor", "capability.temperatureMeasurement" , title: "Select Temperature Sensor", required: false, multiple: false
input "temperature1", "number", title: "Set Temperature", required: true
input "tempActionType", "bool", title: "Select Temperature Sensor action type: \r\n \r\n On = Alert when above set temperature \r\n Off = Alert when below set temperature", required: true, defaultValue: false
if(state.msgType == "Voice Message (MusicPlayer)"){
input "message1", "text", title: "Message to play ...", required: false
input "triggerDelay", "number", title: "Delay after trigger before speaking (Enter 0 for no delay - Seconds)", description: "Seconds", required: true, defaultValue: '0'
input "msgDelay", "number", title: "Delay between messages (Enter 0 for no delay)", defaultValue: '0', description: "Minutes", required: true
}
if(state.msgType == "Voice Message (SpeechSynth)"){
input "message1", "text", title: "Message to play ...", required: false
input "triggerDelay", "number", title: "Delay after trigger before speaking (Enter 0 for no delay - Seconds)", description: "Seconds", required: true, defaultValue: '0'
input "msgDelay", "number", title: "Delay between messages (Enter 0 for no delay)", defaultValue: '0', description: "Minutes", required: true
}
if(state.msgType == "SMS Message"){
input "message1", "text", title: "Message to send...", required: false
input "triggerDelay", "number", title: "Delay after trigger before sending (Enter 0 for no delay)", defaultValue: '0', description: "Seconds", required: true
input "msgDelay", "number", title: "Delay between messages (Enter 0 for no delay)", defaultValue: '0', description: "Minutes", required: true
}
if(state.msgType == "PushOver Message"){
input "message1", "text", title: "Message to send...", required: false
input "priority1", "enum", title: "Message Priority...",required: true, submitOnChange: true, options: ["None", "Low", "Normal", "High"], defaultValue: "None"
input "msgDelay", "number", title: "Delay between messages (Enter 0 for no delay)", defaultValue: '0', description: "Minutes", required: true
}
if(state.msgType == "Join Message"){
input "message1", "text", title: "Message to send...", required: false
input "msgDelay", "number", title: "Delay between messages (Enter 0 for no delay)", defaultValue: '0', description: "Minutes", required: true
}
}
else if(state.selection == 'Time'){
input (name: "runTime", title: "Time to run", type: "time", required: true)
if(state.msgType == "Voice Message (MusicPlayer)"){
input "messageTime", "text", title: "Message to play", required: true
// input "missedMessageAction", "bool", title: "Let me know if I miss this message while away ", required: true, defaultValue: false, submitOnChange: true
if(missedMessageAction == true){
input "missedPresenceSensor1", "capability.presenceSensor", title: "Select presence sensor", required: true, multiple: false
input "missedMessage", "text", title: "Message reminder to play when presence sensor arrives if original message missed", required: true
input "missedMsgDelay", "number", title: "Delay after arriving before reminder message", defaultValue: '0', description: "Seconds", required: true
}
}
if(state.msgType == "Voice Message (SpeechSynth)"){
input "messageTime", "text", title: "Message to play", required: true
}
if(state.msgType == "SMS Message"){
input "messageTime", "text", title: "Message to send...", required: false
}
if(state.msgType == "PushOver Message"){
input "messageTime", "text", title: "Message to send...", required: false
input "priority1", "enum", title: "Message Priority...",required: true, submitOnChange: true, options: ["None", "Low", "Normal", "High"], defaultValue: "None"
}
if(state.msgType == "Join Message"){
input "message1", "text", title: "Message to send...", required: false
}
}
else if(state.selection == 'Time if Contact Open'){
input (name: "runTime", title: "Time to run", type: "time", required: true)
input "contact1", "capability.contactSensor", title: "Select contact sensor to check", required: false, multiple: false
if(state.msgType == "Voice Message (MusicPlayer)"){
input "messageTime", "text", title: "Message to play if contact open", required: true
input "msgDelay", "number", title: "Delay between messages (Enter 0 for no delay)", defaultValue: '0', description: "Minutes", required: true
}
if(state.msgType == "Voice Message (SpeechSynth)"){
input "messageTime", "text", title: "Message to play if contact open", required: true
input "msgDelay", "number", title: "Delay between messages (Enter 0 for no delay)", defaultValue: '0', description: "Minutes", required: true
}
if(state.msgType == "SMS Message"){
input "messageTime", "text", title: "Message to send if contact open", required: false
input "msgDelay", "number", title: "Delay between messages (Enter 0 for no delay)", defaultValue: '0', description: "Minutes", required: true
}
if(state.msgType == "PushOver Message"){
input "messageTime", "text", title: "Message to send if contact open", required: false
input "priority1", "enum", title: "Message Priority for switch on",required: true, submitOnChange: true, options: ["None", "Low", "Normal", "High"], defaultValue: "None"
input "msgDelay", "number", title: "Delay between messages (Enter 0 for no delay)", defaultValue: '0', description: "Minutes", required: true
}
if(state.msgType == "Join Message"){
input "message1", "text", title: "Message to send...", required: false
input "msgDelay", "number", title: "Delay between messages (Enter 0 for no delay)", defaultValue: '0', description: "Minutes", required: true
}
}
else if(state.selection == 'Mode Change'){
input "newMode1", "mode", title: "Action when changing to this mode", required: false
if(state.msgType == "Voice Message (MusicPlayer)"){
input "message1", "text", title: "Message to play", required: true
input "triggerDelay", "number", title: "Delay after trigger before speaking (Enter 0 for no delay - Seconds)", description: "Seconds", required: true, defaultValue: '0'
input "msgDelay", "number", title: "Delay between messages (Enter 0 for no delay)", defaultValue: '0', description: "Minutes", required: true
}
if(state.msgType == "Voice Message (SpeechSynth)"){
input "message1", "text", title: "Message to play", required: true
input "triggerDelay", "number", title: "Delay after trigger before speaking (Enter 0 for no delay - Seconds)", description: "Seconds", required: true, defaultValue: '0'
input "msgDelay", "number", title: "Delay between messages (Enter 0 for no delay)", defaultValue: '0', description: "Minutes", required: true
}
if(state.msgType == "SMS Message"){
input "message1", "text", title: "Message to send...", required: false
input "triggerDelay", "number", title: "Delay after trigger before sending (Enter 0 for no delay)", defaultValue: '0', description: "Seconds", required: true