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