homebridge-securitysystem 7.3.0 → 7.4.0

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