homebridge-securitysystem 7.4.0 → 7.5.0-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,368 +1,387 @@
1
- const options = {
2
- init: (log, config) => {
3
- // Log
4
- log.info("Config", JSON.stringify(config));
5
-
6
- options.checkDeprecated(log, config);
7
-
8
- options.name = config.name;
9
- options.serialNumber = config.serial_number;
10
- options.defaultMode = config.default_mode;
11
- options.armSeconds = config.arm_seconds;
12
- options.triggerSeconds = config.trigger_seconds;
13
- options.pauseMinutes = config.pause_minutes;
14
- options.resetMinutes = config.reset_minutes;
15
- options.saveState = config.save_state;
16
- options.proxyMode = config.proxy_mode;
17
- options.testMode = config.test_mode;
18
-
19
- // Names
20
- options.tripSwitchName = config.trip_switch_name;
21
- options.tripHomeSwitchName = config.trip_home_switch_name;
22
- options.tripAwaySwitchName = config.trip_away_switch_name;
23
- options.tripNightSwitchName = config.trip_night_switch_name;
24
- options.tripOverrideSwitchName = config.trip_override_switch_name;
25
-
26
- options.modeHomeSwitchName = config.mode_home_switch_name;
27
- options.modeAwaySwitchName = config.mode_away_switch_name;
28
- options.modeNightSwitchName = config.mode_night_switch_name;
29
- options.modeOffSwitchName = config.mode_off_switch_name;
30
-
31
- options.logDirectory = config.log_directory;
32
- options.overrideOff = config.override_off;
33
- options.resetOffFlow = config.reset_off_flow;
34
- options.disabledModes = config.disabled_modes;
35
-
36
- options.homeArmSeconds = config.home_arm_seconds;
37
- options.awayArmSeconds = config.away_arm_seconds;
38
- options.nightArmSeconds = config.night_arm_seconds;
39
-
40
- options.homeTriggerSeconds = config.home_trigger_seconds;
41
- options.awayTriggerSeconds = config.away_trigger_seconds;
42
- options.nightTriggerSeconds = config.night_trigger_seconds;
43
-
44
- options.awayExtendedTriggerSeconds = config.away_extended_trigger_seconds;
45
-
46
- // Arming lock switch
47
- options.armingLockSwitch = config.arming_lock_switch;
48
- options.armingLockSwitches = config.arming_lock_switches;
49
-
50
- // Trip switches
51
- options.tripSwitch = config.siren_switch;
52
- options.tripOverrideSwitch = config.siren_override_switch;
53
- options.tripModeSwitches = config.siren_mode_switches;
54
-
55
- // Tripped motion sensor
56
- options.trippedMotionSensor = config.tripped_sensor;
57
- options.trippedMotionSensorSeconds = config.tripped_sensor_seconds;
58
-
59
- // Triggered motion sensor
60
- options.triggeredMotionSensor = config.siren_sensor;
61
- options.triggeredMotionSensorSeconds = config.siren_sensor_seconds;
62
-
63
- // Reset motion sensor
64
- options.resetSensor = config.reset_sensor;
65
-
66
- // Mode switches
67
- options.modeSwitches = config.mode_switches;
68
- options.modeOffSwitch = config.mode_off_switch;
69
- options.modePauseSwitch = config.mode_pause_switch;
70
- options.modeAwayExtendedSwitch = config.mode_away_extended_switch;
71
-
72
- // Double knock
73
- options.doubleKnock = config.double_knock;
74
- options.doubleKnockSeconds = config.double_knock_seconds;
75
- options.doubleKnockModes = config.double_knock_modes;
76
-
77
- options.homeDoubleKnockSeconds = config.home_double_knock_seconds;
78
- options.awayDoubleKnockSeconds = config.away_double_knock_seconds;
79
- options.nightDoubleKnockSeconds = config.night_double_knock_seconds;
80
-
81
- options.audioSwitch = config.audio_switch;
82
-
83
- // Server
84
- options.serverPort = config.server_port;
85
- options.serverCode = config.server_code;
86
-
87
- // Audio
88
- options.audio = config.audio;
89
- options.audioPath = config.audio_path;
90
- options.audioLanguage = config.audio_language;
91
- options.audioVolume = config.audio_volume;
92
- options.audioArmingLooped = config.audio_arming_looped;
93
- options.audioAlertLooped = config.audio_alert_looped;
94
- options.audioExtraVariables = config.audio_extra_variables;
95
-
96
- // Commands
97
- options.commandTargetHome = config.command_target_home;
98
- options.commandTargetAway = config.command_target_away;
99
- options.commandTargetNight = config.command_target_night;
100
- options.commandTargetOff = config.command_target_off;
101
-
102
- options.commandCurrentHome = config.command_current_home;
103
- options.commandCurrentAway = config.command_current_away;
104
- options.commandCurrentNight = config.command_current_night;
105
- options.commandCurrentOff = config.command_current_off;
106
- options.commandCurrentWarning = config.command_current_warning;
107
- options.commandCurrentTriggered = config.command_current_triggered;
108
-
109
- // Webhooks
110
- options.webhookUrl = config.webhook_url;
111
-
112
- options.webhookTargetHome = config.webhook_target_home;
113
- options.webhookTargetAway = config.webhook_target_away;
114
- options.webhookTargetNight = config.webhook_target_night;
115
- options.webhookTargetOff = config.webhook_target_off;
116
-
117
- options.webhookCurrentHome = config.webhook_current_home;
118
- options.webhookCurrentAway = config.webhook_current_away;
119
- options.webhookCurrentNight = config.webhook_current_night;
120
- options.webhookCurrentOff = config.webhook_current_off;
121
- options.webhookCurrentWarning = config.webhook_current_warning;
122
- options.webhookCurrentTriggered = config.webhook_current_triggered;
123
-
124
- options.setDefaultValues();
125
- options.validateValues(log);
126
- options.normalizeValues();
127
-
128
- log.info("Options", JSON.stringify(options));
129
- },
130
-
131
- isValueSet: (value) => {
132
- if (value === undefined || value === null) {
133
- // Check empty strings
134
- if (typeof value === "string" && value.trim() === "") {
135
- return false;
136
- }
137
-
138
- return false;
139
- }
140
-
141
- if (value === "null") {
142
- return false;
143
- }
144
-
145
- return true;
146
- },
147
-
148
- checkDeprecated: (log, config) => {
149
- // ...
150
- },
151
-
152
- setDefaultValues: () => {
153
- if (options.isValueSet(options.name) === false) {
154
- options.name = "Security System";
155
- }
156
-
157
- if (options.isValueSet(options.serialNumber) === false) {
158
- options.serialNumber = "S3CUR1TYSYST3M";
159
- }
160
-
161
- if (options.isValueSet(options.defaultMode) === false) {
162
- options.defaultMode = "off";
163
- }
164
-
165
- if (options.isValueSet(options.disabledModes) === false) {
166
- options.disabledModes = [];
167
- }
168
-
169
- if (options.isValueSet(options.armSeconds) === false) {
170
- options.armSeconds = 0;
171
- }
172
-
173
- if (options.isValueSet(options.triggerSeconds) === false) {
174
- options.triggerSeconds = 0;
175
- }
176
-
177
- if (options.isValueSet(options.resetMinutes) === false) {
178
- options.resetMinutes = 10;
179
- }
180
-
181
- if (options.isValueSet(options.tripSwitchName) === false) {
182
- options.tripSwitchName = "Trip";
183
- }
184
-
185
- if (options.isValueSet(options.tripHomeSwitchName) === false) {
186
- options.tripHomeSwitchName = "Trip Home";
187
- }
188
-
189
- if (options.isValueSet(options.tripAwaySwitchName) === false) {
190
- options.tripAwaySwitchName = "Trip Away";
191
- }
192
-
193
- if (options.isValueSet(options.tripNightSwitchName) === false) {
194
- options.tripNightSwitchName = "Trip Night";
195
- }
196
-
197
- if (options.isValueSet(options.tripOverrideSwitchName) === false) {
198
- options.tripOverrideSwitchName = "Trip Override";
199
- }
200
-
201
- if (options.isValueSet(options.modeHomeSwitchName) === false) {
202
- options.modeHomeSwitchName = "Mode Home";
203
- }
204
-
205
- if (options.isValueSet(options.modeAwaySwitchName) === false) {
206
- options.modeAwaySwitchName = "Mode Away";
207
- }
208
-
209
- if (options.isValueSet(options.modeNightSwitchName) === false) {
210
- options.modeNightSwitchName = "Mode Night";
211
- }
212
-
213
- if (options.isValueSet(options.modeOffSwitch) === false) {
214
- options.modeOffSwitch = "Mode Off";
215
- }
216
-
217
- if (options.isValueSet(options.overrideOff) === false) {
218
- options.overrideOff = false;
219
- }
220
-
221
- if (options.isValueSet(options.nightTriggerDelay) === false) {
222
- options.nightTriggerDelay = true;
223
- }
224
-
225
- if (options.isValueSet(options.resetOff) === false) {
226
- options.resetOff = false;
227
- }
228
-
229
- if (options.isValueSet(options.saveState) === false) {
230
- options.saveState = false;
231
- }
232
-
233
- if (options.isValueSet(options.proxyMode) === false) {
234
- options.proxyMode = false;
235
- }
236
-
237
- if (options.isValueSet(options.testMode) === false) {
238
- options.testMode = false;
239
- }
240
-
241
- if (options.isValueSet(options.logDirectory) === false) {
242
- options.logDirectory = null;
243
- }
244
-
245
- // Tripped sensor
246
- if (options.isValueSet(options.trippedSensor) === false) {
247
- options.trippedSensor = false;
248
- }
249
-
250
- if (options.isValueSet(options.trippedSensorSeconds) === false) {
251
- options.trippedSensorSeconds = 5;
252
- }
253
-
254
- // Tripped sensor
255
- if (options.isValueSet(options.trippedMotionSensor) === false) {
256
- options.trippedMotionSensor = false;
257
- }
258
-
259
- if (options.isValueSet(options.triggeredMotionSensorSeconds) === false) {
260
- options.triggeredMotionSensorSeconds = 5;
261
- }
262
-
263
- // Arming lock switch
264
- if (options.isValueSet(options.armingLockSwitch) === false) {
265
- options.armingLockSwitch = false;
266
- }
267
-
268
- // Trip switches
269
- if (options.isValueSet(options.tripSwitch) === false) {
270
- options.tripSwitch = false;
271
- }
272
-
273
- if (options.isValueSet(options.tripOverrideSwitch) === false) {
274
- options.tripOverrideSwitch = false;
275
- }
276
-
277
- if (options.isValueSet(options.tripModeSwitches) === false) {
278
- options.tripModeSwitches = true;
279
- }
280
-
281
- // Reset sensor
282
- if (options.isValueSet(options.resetSensor) === false) {
283
- options.resetSensor = false;
284
- }
285
-
286
- // Mode switches
287
- if (options.isValueSet(options.modeSwitches) === false) {
288
- options.modeSwitches = false;
289
- }
290
-
291
- if (options.isValueSet(options.hideModeOffSwitch) === false) {
292
- options.hideModeOffSwitch = false;
293
- }
294
-
295
- if (options.isValueSet(options.showModePauseSwitch) === false) {
296
- options.showModePauseSwitch = false;
297
- }
298
-
299
- if (options.isValueSet(options.modeAwayExtendedSwitch) === false) {
300
- options.modeAwayExtendedSwitch = false;
301
- }
302
-
303
- if (options.isValueSet(options.pauseMinutes) === false) {
304
- options.pauseMinutes = 0;
305
- }
306
-
307
- // Double knock
308
- if (options.isValueSet(options.doubleKnock) === false) {
309
- options.doubleKnock = false;
310
- }
311
-
312
- if (options.isValueSet(options.doubleKnockSeconds) === false) {
313
- options.doubleKnockSeconds = 90;
314
- }
315
-
316
- if (options.isValueSet(options.doubleKnockModes) === false) {
317
- options.doubleKnockModes = ["Away"];
318
- }
319
-
320
- // Audio
321
- if (options.isValueSet(options.audio) === false) {
322
- options.audio = false;
323
- }
324
-
325
- if (options.isValueSet(options.audioLanguage) === false) {
326
- options.audioLanguage = "en-US";
327
- }
328
-
329
- if (options.isValueSet(options.audioArmingLooped) === false) {
330
- options.audioArmingLooped = false;
331
- }
332
-
333
- if (options.isValueSet(options.audioAlertLooped) === false) {
334
- options.audioAlertLooped = false;
335
- }
336
-
337
- if (options.isValueSet(options.audioExtraVariables) === false) {
338
- options.audioExtraVariables = [];
339
- }
340
-
341
- // Server
342
- if (options.isValueSet(options.serverCode) === false) {
343
- options.serverCode = null;
344
- }
345
- },
346
-
347
- validateValues: (log) => {
348
- if (options.resetMinutes === 0) {
349
- log.error("Value of setting 'Reset Delay Seconds' should be at least 1.");
350
- options.resetMinutes = 1;
351
- }
352
-
353
- if (options.serverPort < 0 || options.serverPort > 65535) {
354
- log.error("Value of setting 'Server Port' not between 0 and 65535.");
355
- }
356
- },
357
-
358
- normalizeValues: () => {
359
- options.defaultMode = options.defaultMode.toLowerCase();
360
-
361
- if (options.testMode) {
362
- options.webhookTriggered = null;
363
- options.commandTriggered = null;
364
- }
365
- },
366
- };
367
-
368
- module.exports = options;
1
+ const options = {
2
+ init: (log, config) => {
3
+ // Log
4
+ log.info("Config", JSON.stringify(config));
5
+
6
+ options.checkDeprecated(log, config);
7
+
8
+ options.name = config.name;
9
+ options.serialNumber = config.serial_number;
10
+ options.defaultMode = config.default_mode;
11
+ options.armSeconds = config.arm_seconds;
12
+ options.triggerSeconds = config.trigger_seconds;
13
+ options.pauseMinutes = config.pause_minutes;
14
+ options.resetMinutes = config.reset_minutes;
15
+ options.saveState = config.save_state;
16
+ options.proxyMode = config.proxy_mode;
17
+ options.testMode = config.test_mode;
18
+
19
+ // START: Names
20
+ options.tripSwitchName = config.trip_switch_name;
21
+ options.tripHomeSwitchName = config.trip_home_switch_name;
22
+ options.tripAwaySwitchName = config.trip_away_switch_name;
23
+ options.tripNightSwitchName = config.trip_night_switch_name;
24
+ options.tripOverrideSwitchName = config.trip_override_switch_name;
25
+
26
+ options.modeHomeSwitchName = config.mode_home_switch_name;
27
+ options.modeAwaySwitchName = config.mode_away_switch_name;
28
+ options.modeNightSwitchName = config.mode_night_switch_name;
29
+ options.modeOffSwitchName = config.mode_off_switch_name;
30
+
31
+ options.modeAwayExtendedSwitchName = config.mode_away_extended_switch_name;
32
+ options.modePauseSwitchName = config.mode_pause_switch_name;
33
+
34
+ options.audioSwitchName = config.audio_switch_name;
35
+
36
+ // END: Names
37
+
38
+ options.logDirectory = config.log_directory;
39
+ options.overrideOff = config.override_off;
40
+ options.resetOffFlow = config.reset_off_flow;
41
+ options.disabledModes = config.disabled_modes;
42
+
43
+ options.homeArmSeconds = config.home_arm_seconds;
44
+ options.awayArmSeconds = config.away_arm_seconds;
45
+ options.nightArmSeconds = config.night_arm_seconds;
46
+
47
+ options.homeTriggerSeconds = config.home_trigger_seconds;
48
+ options.awayTriggerSeconds = config.away_trigger_seconds;
49
+ options.nightTriggerSeconds = config.night_trigger_seconds;
50
+
51
+ options.awayExtendedTriggerSeconds = config.away_extended_trigger_seconds;
52
+
53
+ // Arming lock switch
54
+ options.armingLockSwitch = config.arming_lock_switch;
55
+ options.armingLockSwitches = config.arming_lock_switches;
56
+
57
+ // Trip switches
58
+ options.tripSwitch = config.siren_switch;
59
+ options.tripOverrideSwitch = config.siren_override_switch;
60
+ options.tripModeSwitches = config.siren_mode_switches;
61
+
62
+ // Tripped motion sensor
63
+ options.trippedMotionSensor = config.tripped_sensor;
64
+ options.trippedMotionSensorSeconds = config.tripped_sensor_seconds;
65
+
66
+ // Triggered motion sensor
67
+ options.triggeredMotionSensor = config.siren_sensor;
68
+ options.triggeredMotionSensorSeconds = config.siren_sensor_seconds;
69
+
70
+ // Reset motion sensor
71
+ options.resetSensor = config.reset_sensor;
72
+
73
+ // Mode switches
74
+ options.modeSwitches = config.mode_switches;
75
+ options.modeOffSwitch = config.mode_off_switch;
76
+ options.modePauseSwitch = config.mode_pause_switch;
77
+ options.modeAwayExtendedSwitch = config.mode_away_extended_switch;
78
+
79
+ // Double knock
80
+ options.doubleKnock = config.double_knock;
81
+ options.doubleKnockSeconds = config.double_knock_seconds;
82
+ options.doubleKnockModes = config.double_knock_modes;
83
+
84
+ options.homeDoubleKnockSeconds = config.home_double_knock_seconds;
85
+ options.awayDoubleKnockSeconds = config.away_double_knock_seconds;
86
+ options.nightDoubleKnockSeconds = config.night_double_knock_seconds;
87
+
88
+ options.audioSwitch = config.audio_switch;
89
+
90
+ // Server
91
+ options.serverPort = config.server_port;
92
+ options.serverCode = config.server_code;
93
+
94
+ // Audio
95
+ options.audio = config.audio;
96
+ options.audioPath = config.audio_path;
97
+ options.audioLanguage = config.audio_language;
98
+ options.audioVolume = config.audio_volume;
99
+ options.audioArmingLooped = config.audio_arming_looped;
100
+ options.audioAlertLooped = config.audio_alert_looped;
101
+ options.audioExtraVariables = config.audio_extra_variables;
102
+
103
+ // Commands
104
+ options.commandTargetHome = config.command_target_home;
105
+ options.commandTargetAway = config.command_target_away;
106
+ options.commandTargetNight = config.command_target_night;
107
+ options.commandTargetOff = config.command_target_off;
108
+
109
+ options.commandCurrentHome = config.command_current_home;
110
+ options.commandCurrentAway = config.command_current_away;
111
+ options.commandCurrentNight = config.command_current_night;
112
+ options.commandCurrentOff = config.command_current_off;
113
+ options.commandCurrentWarning = config.command_current_warning;
114
+ options.commandCurrentTriggered = config.command_current_triggered;
115
+
116
+ // Webhooks
117
+ options.webhookUrl = config.webhook_url;
118
+
119
+ options.webhookTargetHome = config.webhook_target_home;
120
+ options.webhookTargetAway = config.webhook_target_away;
121
+ options.webhookTargetNight = config.webhook_target_night;
122
+ options.webhookTargetOff = config.webhook_target_off;
123
+
124
+ options.webhookCurrentHome = config.webhook_current_home;
125
+ options.webhookCurrentAway = config.webhook_current_away;
126
+ options.webhookCurrentNight = config.webhook_current_night;
127
+ options.webhookCurrentOff = config.webhook_current_off;
128
+ options.webhookCurrentWarning = config.webhook_current_warning;
129
+ options.webhookCurrentTriggered = config.webhook_current_triggered;
130
+
131
+ options.setDefaultValues();
132
+ options.validateValues(log);
133
+ options.normalizeValues();
134
+
135
+ log.info("Options", JSON.stringify(options));
136
+ },
137
+
138
+ isValueSet: (value) => {
139
+ if (value === undefined || value === null) {
140
+ // Check empty strings
141
+ if (typeof value === "string" && value.trim() === "") {
142
+ return false;
143
+ }
144
+
145
+ return false;
146
+ }
147
+
148
+ if (value === "null") {
149
+ return false;
150
+ }
151
+
152
+ return true;
153
+ },
154
+
155
+ checkDeprecated: (log, config) => {
156
+ // ...
157
+ },
158
+
159
+ setDefaultValues: () => {
160
+ if (options.isValueSet(options.name) === false) {
161
+ options.name = "Security System";
162
+ }
163
+
164
+ if (options.isValueSet(options.serialNumber) === false) {
165
+ options.serialNumber = "S3CUR1TYSYST3M";
166
+ }
167
+
168
+ if (options.isValueSet(options.defaultMode) === false) {
169
+ options.defaultMode = "off";
170
+ }
171
+
172
+ if (options.isValueSet(options.disabledModes) === false) {
173
+ options.disabledModes = [];
174
+ }
175
+
176
+ if (options.isValueSet(options.armSeconds) === false) {
177
+ options.armSeconds = 0;
178
+ }
179
+
180
+ if (options.isValueSet(options.triggerSeconds) === false) {
181
+ options.triggerSeconds = 0;
182
+ }
183
+
184
+ if (options.isValueSet(options.resetMinutes) === false) {
185
+ options.resetMinutes = 10;
186
+ }
187
+
188
+ if (options.isValueSet(options.tripSwitchName) === false) {
189
+ options.tripSwitchName = "Trip";
190
+ }
191
+
192
+ if (options.isValueSet(options.tripHomeSwitchName) === false) {
193
+ options.tripHomeSwitchName = "Trip Home";
194
+ }
195
+
196
+ if (options.isValueSet(options.tripAwaySwitchName) === false) {
197
+ options.tripAwaySwitchName = "Trip Away";
198
+ }
199
+
200
+ if (options.isValueSet(options.tripNightSwitchName) === false) {
201
+ options.tripNightSwitchName = "Trip Night";
202
+ }
203
+
204
+ if (options.isValueSet(options.tripOverrideSwitchName) === false) {
205
+ options.tripOverrideSwitchName = "Trip Override";
206
+ }
207
+
208
+ if (options.isValueSet(options.modeHomeSwitchName) === false) {
209
+ options.modeHomeSwitchName = "Mode Home";
210
+ }
211
+
212
+ if (options.isValueSet(options.modeAwaySwitchName) === false) {
213
+ options.modeAwaySwitchName = "Mode Away";
214
+ }
215
+
216
+ if (options.isValueSet(options.modeNightSwitchName) === false) {
217
+ options.modeNightSwitchName = "Mode Night";
218
+ }
219
+
220
+ if (options.isValueSet(options.modeOffSwitch) === false) {
221
+ options.modeOffSwitchName = "Mode Off";
222
+ }
223
+
224
+ if (options.isValueSet(options.modeAwayExtendedSwitchName) === false) {
225
+ options.modeAwayExtendedSwitchName = "Mode Away Extended";
226
+ }
227
+
228
+ if (options.isValueSet(options.modePauseSwitchName) === false) {
229
+ options.modePauseSwitchName = "Mode Away Extended";
230
+ }
231
+
232
+ if (options.isValueSet(options.audioSwitchName) === false) {
233
+ options.audioSwitchName = "Audio";
234
+ }
235
+
236
+ if (options.isValueSet(options.overrideOff) === false) {
237
+ options.overrideOff = false;
238
+ }
239
+
240
+ if (options.isValueSet(options.nightTriggerDelay) === false) {
241
+ options.nightTriggerDelay = true;
242
+ }
243
+
244
+ if (options.isValueSet(options.resetOff) === false) {
245
+ options.resetOff = false;
246
+ }
247
+
248
+ if (options.isValueSet(options.saveState) === false) {
249
+ options.saveState = false;
250
+ }
251
+
252
+ if (options.isValueSet(options.proxyMode) === false) {
253
+ options.proxyMode = false;
254
+ }
255
+
256
+ if (options.isValueSet(options.testMode) === false) {
257
+ options.testMode = false;
258
+ }
259
+
260
+ if (options.isValueSet(options.logDirectory) === false) {
261
+ options.logDirectory = null;
262
+ }
263
+
264
+ // Tripped sensor
265
+ if (options.isValueSet(options.trippedSensor) === false) {
266
+ options.trippedSensor = false;
267
+ }
268
+
269
+ if (options.isValueSet(options.trippedSensorSeconds) === false) {
270
+ options.trippedSensorSeconds = 5;
271
+ }
272
+
273
+ // Tripped sensor
274
+ if (options.isValueSet(options.trippedMotionSensor) === false) {
275
+ options.trippedMotionSensor = false;
276
+ }
277
+
278
+ if (options.isValueSet(options.triggeredMotionSensorSeconds) === false) {
279
+ options.triggeredMotionSensorSeconds = 5;
280
+ }
281
+
282
+ // Arming lock switch
283
+ if (options.isValueSet(options.armingLockSwitch) === false) {
284
+ options.armingLockSwitch = false;
285
+ }
286
+
287
+ // Trip switches
288
+ if (options.isValueSet(options.tripSwitch) === false) {
289
+ options.tripSwitch = false;
290
+ }
291
+
292
+ if (options.isValueSet(options.tripOverrideSwitch) === false) {
293
+ options.tripOverrideSwitch = false;
294
+ }
295
+
296
+ if (options.isValueSet(options.tripModeSwitches) === false) {
297
+ options.tripModeSwitches = true;
298
+ }
299
+
300
+ // Reset sensor
301
+ if (options.isValueSet(options.resetSensor) === false) {
302
+ options.resetSensor = false;
303
+ }
304
+
305
+ // Mode switches
306
+ if (options.isValueSet(options.modeSwitches) === false) {
307
+ options.modeSwitches = false;
308
+ }
309
+
310
+ if (options.isValueSet(options.hideModeOffSwitch) === false) {
311
+ options.hideModeOffSwitch = false;
312
+ }
313
+
314
+ if (options.isValueSet(options.showModePauseSwitch) === false) {
315
+ options.showModePauseSwitch = false;
316
+ }
317
+
318
+ if (options.isValueSet(options.modeAwayExtendedSwitch) === false) {
319
+ options.modeAwayExtendedSwitch = false;
320
+ }
321
+
322
+ if (options.isValueSet(options.pauseMinutes) === false) {
323
+ options.pauseMinutes = 0;
324
+ }
325
+
326
+ // Double knock
327
+ if (options.isValueSet(options.doubleKnock) === false) {
328
+ options.doubleKnock = false;
329
+ }
330
+
331
+ if (options.isValueSet(options.doubleKnockSeconds) === false) {
332
+ options.doubleKnockSeconds = 90;
333
+ }
334
+
335
+ if (options.isValueSet(options.doubleKnockModes) === false) {
336
+ options.doubleKnockModes = ["Away"];
337
+ }
338
+
339
+ // Audio
340
+ if (options.isValueSet(options.audio) === false) {
341
+ options.audio = false;
342
+ }
343
+
344
+ if (options.isValueSet(options.audioLanguage) === false) {
345
+ options.audioLanguage = "en-US";
346
+ }
347
+
348
+ if (options.isValueSet(options.audioArmingLooped) === false) {
349
+ options.audioArmingLooped = false;
350
+ }
351
+
352
+ if (options.isValueSet(options.audioAlertLooped) === false) {
353
+ options.audioAlertLooped = false;
354
+ }
355
+
356
+ if (options.isValueSet(options.audioExtraVariables) === false) {
357
+ options.audioExtraVariables = [];
358
+ }
359
+
360
+ // Server
361
+ if (options.isValueSet(options.serverCode) === false) {
362
+ options.serverCode = null;
363
+ }
364
+ },
365
+
366
+ validateValues: (log) => {
367
+ if (options.resetMinutes === 0) {
368
+ log.error("Value of setting 'Reset Delay Seconds' should be at least 1.");
369
+ options.resetMinutes = 1;
370
+ }
371
+
372
+ if (options.serverPort < 0 || options.serverPort > 65535) {
373
+ log.error("Value of setting 'Server Port' not between 0 and 65535.");
374
+ }
375
+ },
376
+
377
+ normalizeValues: () => {
378
+ options.defaultMode = options.defaultMode.toLowerCase();
379
+
380
+ if (options.testMode) {
381
+ options.webhookTriggered = null;
382
+ options.commandTriggered = null;
383
+ }
384
+ },
385
+ };
386
+
387
+ module.exports = options;