homebridge-adt-pulse 3.0.0 → 3.0.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.
@@ -2,7 +2,57 @@ import axios from 'axios';
2
2
  import { serializeError } from 'serialize-error';
3
3
  import { doSubmitHandlerRelativeUrlItems, doSubmitHandlerUrlParamsArmItems, doSubmitHandlerUrlParamsArmStateItems, doSubmitHandlerUrlParamsHrefItems, gatewayInformationStatusItems, orbSecurityButtonButtonTextItems, orbSecurityButtonLoadingTextItems, orbSecurityButtonRelativeUrlItems, orbSecurityButtonUrlParamsArmItems, orbSecurityButtonUrlParamsArmStateItems, orbSecurityButtonUrlParamsHrefItems, panelInformationStatusItems, portalVersionItems, sensorActionItems, sensorInformationDeviceTypeItems, sensorInformationStatusItems, sensorStatusIconItems, sensorStatusStatusItems, } from './items.js';
4
4
  import { debugLog, getDetectReportUrl, isPluginOutdated, removePersonalIdentifiableInformation, stackTracer, } from './utility.js';
5
- export async function detectedNewDoSubmitHandlers(handlers, logger, debugMode) {
5
+ export async function detectApiDebugParser(data, logger, debugMode) {
6
+ const cleanedData = removePersonalIdentifiableInformation(data);
7
+ try {
8
+ const outdated = await isPluginOutdated();
9
+ if (outdated) {
10
+ if (logger !== null) {
11
+ logger.warn(`Plugin has detected a parser anomaly for "${data.parserName}" due to ${data.parserReason}. You are running an older plugin version, please update soon.`);
12
+ }
13
+ if (debugMode) {
14
+ debugLog(logger, 'detect.ts / detectApiDebugParser()', 'warn', `Plugin has detected a parser anomaly for "${data.parserName}" due to ${data.parserReason}. You are running an older plugin version, please update soon`);
15
+ }
16
+ return false;
17
+ }
18
+ }
19
+ catch (error) {
20
+ if (debugMode === true) {
21
+ debugLog(logger, 'detect.ts / detectApiDebugParser()', 'error', 'Failed to check if plugin is outdated');
22
+ stackTracer('serialize-error', serializeError(error));
23
+ }
24
+ return false;
25
+ }
26
+ if (logger !== null) {
27
+ logger.warn(`Plugin has detected a parser anomaly for "${data.parserName}" due to ${data.parserReason}. Notifying plugin author about this discovery ...`);
28
+ }
29
+ if (debugMode) {
30
+ debugLog(logger, 'detect.ts / detectApiDebugParser()', 'warn', `Plugin has detected a parser anomaly for "${data.parserName}" due to ${data.parserReason}. Notifying plugin author about this discovery`);
31
+ }
32
+ stackTracer('detect-content', cleanedData);
33
+ if (logger !== null) {
34
+ logger.warn('For transparency, the section of code you see above will be sent to the author directly. Rest assured, your privacy is prioritized.');
35
+ logger.warn('This message will NOT go away by restarting Homebridge. An update MUST become available first. Please be patient, thank you!');
36
+ }
37
+ try {
38
+ await axios.post(getDetectReportUrl(), JSON.stringify(cleanedData, null, 2), {
39
+ family: 4,
40
+ headers: {
41
+ 'User-Agent': 'homebridge-adt-pulse',
42
+ 'X-Title': `Detected a parser anomaly for "${data.parserName}" due to ${data.parserReason}`,
43
+ },
44
+ });
45
+ return true;
46
+ }
47
+ catch (error) {
48
+ if (debugMode === true) {
49
+ debugLog(logger, 'detect.ts / detectApiDebugParser()', 'error', `Failed to notify plugin author about the parser anomaly for "${data.parserName}" due to ${data.parserReason}`);
50
+ stackTracer('serialize-error', serializeError(error));
51
+ }
52
+ return false;
53
+ }
54
+ }
55
+ export async function detectApiDoSubmitHandlers(handlers, logger, debugMode) {
6
56
  const detectedNewHandlers = handlers.filter((handler) => (!doSubmitHandlerRelativeUrlItems.includes(handler.relativeUrl)
7
57
  || (handler.urlParams.arm !== null
8
58
  && !doSubmitHandlerUrlParamsArmItems.includes(handler.urlParams.arm))
@@ -18,26 +68,29 @@ export async function detectedNewDoSubmitHandlers(handlers, logger, debugMode) {
18
68
  logger.warn('Plugin has detected new do submit handlers. You are running an older plugin version, please update soon.');
19
69
  }
20
70
  if (debugMode) {
21
- debugLog(logger, 'detect.ts / detectedNewDoSubmitHandlers()', 'warn', 'Plugin has detected new do submit handlers. You are running an older plugin version, please update soon');
71
+ debugLog(logger, 'detect.ts / detectApiDoSubmitHandlers()', 'warn', 'Plugin has detected new do submit handlers. You are running an older plugin version, please update soon');
22
72
  }
23
73
  return false;
24
74
  }
25
75
  }
26
76
  catch (error) {
27
77
  if (debugMode === true) {
28
- debugLog(logger, 'detect.ts / detectedNewDoSubmitHandlers()', 'error', 'Failed to check if plugin is outdated');
78
+ debugLog(logger, 'detect.ts / detectApiDoSubmitHandlers()', 'error', 'Failed to check if plugin is outdated');
29
79
  stackTracer('serialize-error', serializeError(error));
30
80
  }
31
81
  return false;
32
82
  }
33
83
  if (logger !== null) {
34
84
  logger.warn('Plugin has detected new do submit handlers. Notifying plugin author about this discovery ...');
35
- logger.warn('This message will NOT go away by restarting Homebridge. An update MUST become available first. Please be patient, thank you!');
36
85
  }
37
86
  if (debugMode) {
38
- debugLog(logger, 'detect.ts / detectedNewDoSubmitHandlers()', 'warn', 'Plugin has detected new do submit handlers. Notifying plugin author about this discovery');
87
+ debugLog(logger, 'detect.ts / detectApiDoSubmitHandlers()', 'warn', 'Plugin has detected new do submit handlers. Notifying plugin author about this discovery');
39
88
  }
40
89
  stackTracer('detect-content', cleanedData);
90
+ if (logger !== null) {
91
+ logger.warn('For transparency, the section of code you see above will be sent to the author directly. Rest assured, your privacy is prioritized.');
92
+ logger.warn('This message will NOT go away by restarting Homebridge. An update MUST become available first. Please be patient, thank you!');
93
+ }
41
94
  try {
42
95
  await axios.post(getDetectReportUrl(), JSON.stringify(cleanedData, null, 2), {
43
96
  family: 4,
@@ -50,7 +103,7 @@ export async function detectedNewDoSubmitHandlers(handlers, logger, debugMode) {
50
103
  }
51
104
  catch (error) {
52
105
  if (debugMode === true) {
53
- debugLog(logger, 'detect.ts / detectedNewDoSubmitHandlers()', 'error', 'Failed to notify plugin author about the new do submit handlers');
106
+ debugLog(logger, 'detect.ts / detectApiDoSubmitHandlers()', 'error', 'Failed to notify plugin author about the new do submit handlers');
54
107
  stackTracer('serialize-error', serializeError(error));
55
108
  }
56
109
  return false;
@@ -58,7 +111,7 @@ export async function detectedNewDoSubmitHandlers(handlers, logger, debugMode) {
58
111
  }
59
112
  return false;
60
113
  }
61
- export async function detectedNewGatewayInformation(device, logger, debugMode) {
114
+ export async function detectApiGatewayInformation(device, logger, debugMode) {
62
115
  const detectedNewStatus = (device.status !== null && !gatewayInformationStatusItems.includes(device.status));
63
116
  if (detectedNewStatus) {
64
117
  const cleanedData = removePersonalIdentifiableInformation(device);
@@ -69,26 +122,29 @@ export async function detectedNewGatewayInformation(device, logger, debugMode) {
69
122
  logger.warn('Plugin has detected new gateway information. You are running an older plugin version, please update soon.');
70
123
  }
71
124
  if (debugMode) {
72
- debugLog(logger, 'detect.ts / detectedNewGatewayInformation()', 'warn', 'Plugin has detected new gateway information. You are running an older plugin version, please update soon');
125
+ debugLog(logger, 'detect.ts / detectApiGatewayInformation()', 'warn', 'Plugin has detected new gateway information. You are running an older plugin version, please update soon');
73
126
  }
74
127
  return false;
75
128
  }
76
129
  }
77
130
  catch (error) {
78
131
  if (debugMode === true) {
79
- debugLog(logger, 'detect.ts / detectedNewGatewayInformation()', 'error', 'Failed to check if plugin is outdated');
132
+ debugLog(logger, 'detect.ts / detectApiGatewayInformation()', 'error', 'Failed to check if plugin is outdated');
80
133
  stackTracer('serialize-error', serializeError(error));
81
134
  }
82
135
  return false;
83
136
  }
84
137
  if (logger !== null) {
85
138
  logger.warn('Plugin has detected new gateway information. Notifying plugin author about this discovery ...');
86
- logger.warn('This message will NOT go away by restarting Homebridge. An update MUST become available first. Please be patient, thank you!');
87
139
  }
88
140
  if (debugMode) {
89
- debugLog(logger, 'detect.ts / detectedNewGatewayInformation()', 'warn', 'Plugin has detected new gateway information. Notifying plugin author about this discovery');
141
+ debugLog(logger, 'detect.ts / detectApiGatewayInformation()', 'warn', 'Plugin has detected new gateway information. Notifying plugin author about this discovery');
90
142
  }
91
143
  stackTracer('detect-content', cleanedData);
144
+ if (logger !== null) {
145
+ logger.warn('For transparency, the section of code you see above will be sent to the author directly. Rest assured, your privacy is prioritized.');
146
+ logger.warn('This message will NOT go away by restarting Homebridge. An update MUST become available first. Please be patient, thank you!');
147
+ }
92
148
  try {
93
149
  await axios.post(getDetectReportUrl(), JSON.stringify(cleanedData, null, 2), {
94
150
  family: 4,
@@ -101,7 +157,7 @@ export async function detectedNewGatewayInformation(device, logger, debugMode) {
101
157
  }
102
158
  catch (error) {
103
159
  if (debugMode === true) {
104
- debugLog(logger, 'detect.ts / detectedNewGatewayInformation()', 'error', 'Failed to notify plugin author about the new gateway information');
160
+ debugLog(logger, 'detect.ts / detectApiGatewayInformation()', 'error', 'Failed to notify plugin author about the new gateway information');
105
161
  stackTracer('serialize-error', serializeError(error));
106
162
  }
107
163
  return false;
@@ -109,7 +165,7 @@ export async function detectedNewGatewayInformation(device, logger, debugMode) {
109
165
  }
110
166
  return false;
111
167
  }
112
- export async function detectedNewOrbSecurityButtons(buttons, logger, debugMode) {
168
+ export async function detectApiOrbSecurityButtons(buttons, logger, debugMode) {
113
169
  const detectedNewButtons = buttons.filter((button) => ((!button.buttonDisabled
114
170
  && ((button.buttonText !== null
115
171
  && !orbSecurityButtonButtonTextItems.includes(button.buttonText))
@@ -130,26 +186,29 @@ export async function detectedNewOrbSecurityButtons(buttons, logger, debugMode)
130
186
  logger.warn('Plugin has detected new orb security buttons. You are running an older plugin version, please update soon.');
131
187
  }
132
188
  if (debugMode) {
133
- debugLog(logger, 'detect.ts / detectedNewOrbSecurityButtons()', 'warn', 'Plugin has detected new orb security buttons. You are running an older plugin version, please update soon');
189
+ debugLog(logger, 'detect.ts / detectApiOrbSecurityButtons()', 'warn', 'Plugin has detected new orb security buttons. You are running an older plugin version, please update soon');
134
190
  }
135
191
  return false;
136
192
  }
137
193
  }
138
194
  catch (error) {
139
195
  if (debugMode === true) {
140
- debugLog(logger, 'detect.ts / detectedNewOrbSecurityButtons()', 'error', 'Failed to check if plugin is outdated');
196
+ debugLog(logger, 'detect.ts / detectApiOrbSecurityButtons()', 'error', 'Failed to check if plugin is outdated');
141
197
  stackTracer('serialize-error', serializeError(error));
142
198
  }
143
199
  return false;
144
200
  }
145
201
  if (logger !== null) {
146
202
  logger.warn('Plugin has detected new orb security buttons. Notifying plugin author about this discovery ...');
147
- logger.warn('This message will NOT go away by restarting Homebridge. An update MUST become available first. Please be patient, thank you!');
148
203
  }
149
204
  if (debugMode) {
150
- debugLog(logger, 'detect.ts / detectedNewOrbSecurityButtons()', 'warn', 'Plugin has detected new orb security buttons. Notifying plugin author about this discovery');
205
+ debugLog(logger, 'detect.ts / detectApiOrbSecurityButtons()', 'warn', 'Plugin has detected new orb security buttons. Notifying plugin author about this discovery');
151
206
  }
152
207
  stackTracer('detect-content', cleanedData);
208
+ if (logger !== null) {
209
+ logger.warn('For transparency, the section of code you see above will be sent to the author directly. Rest assured, your privacy is prioritized.');
210
+ logger.warn('This message will NOT go away by restarting Homebridge. An update MUST become available first. Please be patient, thank you!');
211
+ }
153
212
  try {
154
213
  await axios.post(getDetectReportUrl(), JSON.stringify(cleanedData, null, 2), {
155
214
  family: 4,
@@ -162,7 +221,7 @@ export async function detectedNewOrbSecurityButtons(buttons, logger, debugMode)
162
221
  }
163
222
  catch (error) {
164
223
  if (debugMode === true) {
165
- debugLog(logger, 'detect.ts / detectedNewOrbSecurityButtons()', 'error', 'Failed to notify plugin author about the new orb security buttons');
224
+ debugLog(logger, 'detect.ts / detectApiOrbSecurityButtons()', 'error', 'Failed to notify plugin author about the new orb security buttons');
166
225
  stackTracer('serialize-error', serializeError(error));
167
226
  }
168
227
  return false;
@@ -170,7 +229,7 @@ export async function detectedNewOrbSecurityButtons(buttons, logger, debugMode)
170
229
  }
171
230
  return false;
172
231
  }
173
- export async function detectedNewPanelInformation(device, logger, debugMode) {
232
+ export async function detectApiPanelInformation(device, logger, debugMode) {
174
233
  const detectedNewStatus = (device.status !== null && !panelInformationStatusItems.includes(device.status));
175
234
  if (detectedNewStatus) {
176
235
  const cleanedData = removePersonalIdentifiableInformation(device);
@@ -181,26 +240,29 @@ export async function detectedNewPanelInformation(device, logger, debugMode) {
181
240
  logger.warn('Plugin has detected new panel information. You are running an older plugin version, please update soon.');
182
241
  }
183
242
  if (debugMode) {
184
- debugLog(logger, 'detect.ts / detectedNewPanelInformation()', 'warn', 'Plugin has detected new panel information. You are running an older plugin version, please update soon');
243
+ debugLog(logger, 'detect.ts / detectApiPanelInformation()', 'warn', 'Plugin has detected new panel information. You are running an older plugin version, please update soon');
185
244
  }
186
245
  return false;
187
246
  }
188
247
  }
189
248
  catch (error) {
190
249
  if (debugMode === true) {
191
- debugLog(logger, 'detect.ts / detectedNewPanelInformation()', 'error', 'Failed to check if plugin is outdated');
250
+ debugLog(logger, 'detect.ts / detectApiPanelInformation()', 'error', 'Failed to check if plugin is outdated');
192
251
  stackTracer('serialize-error', serializeError(error));
193
252
  }
194
253
  return false;
195
254
  }
196
255
  if (logger !== null) {
197
256
  logger.warn('Plugin has detected new panel information. Notifying plugin author about this discovery ...');
198
- logger.warn('This message will NOT go away by restarting Homebridge. An update MUST become available first. Please be patient, thank you!');
199
257
  }
200
258
  if (debugMode) {
201
- debugLog(logger, 'detect.ts / detectedNewPanelInformation()', 'warn', 'Plugin has detected new panel information. Notifying plugin author about this discovery');
259
+ debugLog(logger, 'detect.ts / detectApiPanelInformation()', 'warn', 'Plugin has detected new panel information. Notifying plugin author about this discovery');
202
260
  }
203
261
  stackTracer('detect-content', cleanedData);
262
+ if (logger !== null) {
263
+ logger.warn('For transparency, the section of code you see above will be sent to the author directly. Rest assured, your privacy is prioritized.');
264
+ logger.warn('This message will NOT go away by restarting Homebridge. An update MUST become available first. Please be patient, thank you!');
265
+ }
204
266
  try {
205
267
  await axios.post(getDetectReportUrl(), JSON.stringify(cleanedData, null, 2), {
206
268
  family: 4,
@@ -213,7 +275,7 @@ export async function detectedNewPanelInformation(device, logger, debugMode) {
213
275
  }
214
276
  catch (error) {
215
277
  if (debugMode === true) {
216
- debugLog(logger, 'detect.ts / detectedNewPanelInformation()', 'error', 'Failed to notify plugin author about the new panel information');
278
+ debugLog(logger, 'detect.ts / detectApiPanelInformation()', 'error', 'Failed to notify plugin author about the new panel information');
217
279
  stackTracer('serialize-error', serializeError(error));
218
280
  }
219
281
  return false;
@@ -221,7 +283,7 @@ export async function detectedNewPanelInformation(device, logger, debugMode) {
221
283
  }
222
284
  return false;
223
285
  }
224
- export async function detectedNewPanelStatus(summary, logger, debugMode) {
286
+ export async function detectApiPanelStatus(summary, logger, debugMode) {
225
287
  const detectedUnknownPieces = summary.rawData.unknownPieces.length > 0;
226
288
  if (detectedUnknownPieces) {
227
289
  const cleanedData = removePersonalIdentifiableInformation(summary);
@@ -232,26 +294,29 @@ export async function detectedNewPanelStatus(summary, logger, debugMode) {
232
294
  logger.warn('Plugin has detected a new panel state and/or status. You are running an older plugin version, please update soon.');
233
295
  }
234
296
  if (debugMode) {
235
- debugLog(logger, 'detect.ts / detectedNewPanelStatus()', 'warn', 'Plugin has detected a new panel state and/or status. You are running an older plugin version, please update soon');
297
+ debugLog(logger, 'detect.ts / detectApiPanelStatus()', 'warn', 'Plugin has detected a new panel state and/or status. You are running an older plugin version, please update soon');
236
298
  }
237
299
  return false;
238
300
  }
239
301
  }
240
302
  catch (error) {
241
303
  if (debugMode === true) {
242
- debugLog(logger, 'detect.ts / detectedNewPanelStatus()', 'error', 'Failed to check if plugin is outdated');
304
+ debugLog(logger, 'detect.ts / detectApiPanelStatus()', 'error', 'Failed to check if plugin is outdated');
243
305
  stackTracer('serialize-error', serializeError(error));
244
306
  }
245
307
  return false;
246
308
  }
247
309
  if (logger !== null) {
248
310
  logger.warn('Plugin has detected a new panel state and/or status. Notifying plugin author about this discovery ...');
249
- logger.warn('This message will NOT go away by restarting Homebridge. An update MUST become available first. Please be patient, thank you!');
250
311
  }
251
312
  if (debugMode) {
252
- debugLog(logger, 'detect.ts / detectedNewPanelStatus()', 'warn', 'Plugin has detected a new panel state and/or status. Notifying plugin author about this discovery');
313
+ debugLog(logger, 'detect.ts / detectApiPanelStatus()', 'warn', 'Plugin has detected a new panel state and/or status. Notifying plugin author about this discovery');
253
314
  }
254
315
  stackTracer('detect-content', cleanedData);
316
+ if (logger !== null) {
317
+ logger.warn('For transparency, the section of code you see above will be sent to the author directly. Rest assured, your privacy is prioritized.');
318
+ logger.warn('This message will NOT go away by restarting Homebridge. An update MUST become available first. Please be patient, thank you!');
319
+ }
255
320
  try {
256
321
  await axios.post(getDetectReportUrl(), JSON.stringify(cleanedData, null, 2), {
257
322
  family: 4,
@@ -264,7 +329,7 @@ export async function detectedNewPanelStatus(summary, logger, debugMode) {
264
329
  }
265
330
  catch (error) {
266
331
  if (debugMode === true) {
267
- debugLog(logger, 'detect.ts / detectedNewPanelStatus()', 'error', 'Failed to notify plugin author about the new panel state and/or status');
332
+ debugLog(logger, 'detect.ts / detectApiPanelStatus()', 'error', 'Failed to notify plugin author about the new panel state and/or status');
268
333
  stackTracer('serialize-error', serializeError(error));
269
334
  }
270
335
  return false;
@@ -272,7 +337,7 @@ export async function detectedNewPanelStatus(summary, logger, debugMode) {
272
337
  }
273
338
  return false;
274
339
  }
275
- export async function detectedNewPortalVersion(version, logger, debugMode) {
340
+ export async function detectApiPortalVersion(version, logger, debugMode) {
276
341
  const detectedNewVersion = (version.version !== null && !portalVersionItems.includes(version.version));
277
342
  if (detectedNewVersion) {
278
343
  const cleanedData = removePersonalIdentifiableInformation(version);
@@ -283,26 +348,29 @@ export async function detectedNewPortalVersion(version, logger, debugMode) {
283
348
  logger.warn('Plugin has detected a new portal version. You are running an older plugin version, please update soon.');
284
349
  }
285
350
  if (debugMode) {
286
- debugLog(logger, 'detect.ts / detectedNewPortalVersion()', 'warn', 'Plugin has detected a new portal version. You are running an older plugin version, please update soon');
351
+ debugLog(logger, 'detect.ts / detectApiPortalVersion()', 'warn', 'Plugin has detected a new portal version. You are running an older plugin version, please update soon');
287
352
  }
288
353
  return false;
289
354
  }
290
355
  }
291
356
  catch (error) {
292
357
  if (debugMode === true) {
293
- debugLog(logger, 'detect.ts / detectedNewPortalVersion()', 'error', 'Failed to check if plugin is outdated');
358
+ debugLog(logger, 'detect.ts / detectApiPortalVersion()', 'error', 'Failed to check if plugin is outdated');
294
359
  stackTracer('serialize-error', serializeError(error));
295
360
  }
296
361
  return false;
297
362
  }
298
363
  if (logger !== null) {
299
364
  logger.warn('Plugin has detected a new portal version. Notifying plugin author about this discovery ...');
300
- logger.warn('This message will NOT go away by restarting Homebridge. An update MUST become available first. Please be patient, thank you!');
301
365
  }
302
366
  if (debugMode) {
303
- debugLog(logger, 'detect.ts / detectedNewPortalVersion()', 'warn', 'Plugin has detected a new portal version. Notifying plugin author about this discovery');
367
+ debugLog(logger, 'detect.ts / detectApiPortalVersion()', 'warn', 'Plugin has detected a new portal version. Notifying plugin author about this discovery');
304
368
  }
305
369
  stackTracer('detect-content', cleanedData);
370
+ if (logger !== null) {
371
+ logger.warn('For transparency, the section of code you see above will be sent to the author directly. Rest assured, your privacy is prioritized.');
372
+ logger.warn('This message will NOT go away by restarting Homebridge. An update MUST become available first. Please be patient, thank you!');
373
+ }
306
374
  try {
307
375
  await axios.post(getDetectReportUrl(), JSON.stringify(cleanedData, null, 2), {
308
376
  family: 4,
@@ -315,7 +383,7 @@ export async function detectedNewPortalVersion(version, logger, debugMode) {
315
383
  }
316
384
  catch (error) {
317
385
  if (debugMode === true) {
318
- debugLog(logger, 'detect.ts / detectedNewPortalVersion()', 'error', 'Failed to notify plugin author about the new portal version');
386
+ debugLog(logger, 'detect.ts / detectApiPortalVersion()', 'error', 'Failed to notify plugin author about the new portal version');
319
387
  stackTracer('serialize-error', serializeError(error));
320
388
  }
321
389
  return false;
@@ -323,7 +391,7 @@ export async function detectedNewPortalVersion(version, logger, debugMode) {
323
391
  }
324
392
  return false;
325
393
  }
326
- export async function detectedNewSensorsInformation(sensors, logger, debugMode) {
394
+ export async function detectApiSensorsInformation(sensors, logger, debugMode) {
327
395
  const detectedNewInformation = sensors.filter((sensor) => (!sensorInformationDeviceTypeItems.includes(sensor.deviceType)
328
396
  || !sensorInformationStatusItems.includes(sensor.status)));
329
397
  if (detectedNewInformation.length > 0) {
@@ -335,26 +403,29 @@ export async function detectedNewSensorsInformation(sensors, logger, debugMode)
335
403
  logger.warn('Plugin has detected new sensors information. You are running an older plugin version, please update soon.');
336
404
  }
337
405
  if (debugMode) {
338
- debugLog(logger, 'detect.ts / detectedNewSensorsInformation()', 'warn', 'Plugin has detected new sensors information. You are running an older plugin version, please update soon');
406
+ debugLog(logger, 'detect.ts / detectApiSensorsInformation()', 'warn', 'Plugin has detected new sensors information. You are running an older plugin version, please update soon');
339
407
  }
340
408
  return false;
341
409
  }
342
410
  }
343
411
  catch (error) {
344
412
  if (debugMode === true) {
345
- debugLog(logger, 'detect.ts / detectedNewSensorsInformation()', 'error', 'Failed to check if plugin is outdated');
413
+ debugLog(logger, 'detect.ts / detectApiSensorsInformation()', 'error', 'Failed to check if plugin is outdated');
346
414
  stackTracer('serialize-error', serializeError(error));
347
415
  }
348
416
  return false;
349
417
  }
350
418
  if (logger !== null) {
351
419
  logger.warn('Plugin has detected new sensors information. Notifying plugin author about this discovery ...');
352
- logger.warn('This message will NOT go away by restarting Homebridge. An update MUST become available first. Please be patient, thank you!');
353
420
  }
354
421
  if (debugMode) {
355
- debugLog(logger, 'detect.ts / detectedNewSensorsInformation()', 'warn', 'Plugin has detected new sensors information. Notifying plugin author about this discovery');
422
+ debugLog(logger, 'detect.ts / detectApiSensorsInformation()', 'warn', 'Plugin has detected new sensors information. Notifying plugin author about this discovery');
356
423
  }
357
424
  stackTracer('detect-content', cleanedData);
425
+ if (logger !== null) {
426
+ logger.warn('For transparency, the section of code you see above will be sent to the author directly. Rest assured, your privacy is prioritized.');
427
+ logger.warn('This message will NOT go away by restarting Homebridge. An update MUST become available first. Please be patient, thank you!');
428
+ }
358
429
  try {
359
430
  await axios.post(getDetectReportUrl(), JSON.stringify(cleanedData, null, 2), {
360
431
  family: 4,
@@ -367,7 +438,7 @@ export async function detectedNewSensorsInformation(sensors, logger, debugMode)
367
438
  }
368
439
  catch (error) {
369
440
  if (debugMode === true) {
370
- debugLog(logger, 'detect.ts / detectedNewSensorsInformation()', 'error', 'Failed to notify plugin author about the new sensors information');
441
+ debugLog(logger, 'detect.ts / detectApiSensorsInformation()', 'error', 'Failed to notify plugin author about the new sensors information');
371
442
  stackTracer('serialize-error', serializeError(error));
372
443
  }
373
444
  return false;
@@ -375,7 +446,7 @@ export async function detectedNewSensorsInformation(sensors, logger, debugMode)
375
446
  }
376
447
  return false;
377
448
  }
378
- export async function detectedNewSensorsStatus(sensors, logger, debugMode) {
449
+ export async function detectApiSensorsStatus(sensors, logger, debugMode) {
379
450
  const detectedNewStatuses = sensors.filter((sensor) => !sensorStatusIconItems.includes(sensor.icon) || sensor.statuses.some((sensorStatus) => !sensorStatusStatusItems.includes(sensorStatus)));
380
451
  if (detectedNewStatuses.length > 0) {
381
452
  const cleanedData = removePersonalIdentifiableInformation(detectedNewStatuses);
@@ -386,26 +457,29 @@ export async function detectedNewSensorsStatus(sensors, logger, debugMode) {
386
457
  logger.warn('Plugin has detected new sensors status. You are running an older plugin version, please update soon.');
387
458
  }
388
459
  if (debugMode) {
389
- debugLog(logger, 'detect.ts / detectedNewSensorsStatus()', 'warn', 'Plugin has detected new sensors status. You are running an older plugin version, please update soon');
460
+ debugLog(logger, 'detect.ts / detectApiSensorsStatus()', 'warn', 'Plugin has detected new sensors status. You are running an older plugin version, please update soon');
390
461
  }
391
462
  return false;
392
463
  }
393
464
  }
394
465
  catch (error) {
395
466
  if (debugMode === true) {
396
- debugLog(logger, 'detect.ts / detectedNewSensorsStatus()', 'error', 'Failed to check if plugin is outdated');
467
+ debugLog(logger, 'detect.ts / detectApiSensorsStatus()', 'error', 'Failed to check if plugin is outdated');
397
468
  stackTracer('serialize-error', serializeError(error));
398
469
  }
399
470
  return false;
400
471
  }
401
472
  if (logger !== null) {
402
473
  logger.warn('Plugin has detected new sensors status. Notifying plugin author about this discovery ...');
403
- logger.warn('This message will NOT go away by restarting Homebridge. An update MUST become available first. Please be patient, thank you!');
404
474
  }
405
475
  if (debugMode) {
406
- debugLog(logger, 'detect.ts / detectedNewSensorsStatus()', 'warn', 'Plugin has detected new sensors status. Notifying plugin author about this discovery');
476
+ debugLog(logger, 'detect.ts / detectApiSensorsStatus()', 'warn', 'Plugin has detected new sensors status. Notifying plugin author about this discovery');
407
477
  }
408
478
  stackTracer('detect-content', cleanedData);
479
+ if (logger !== null) {
480
+ logger.warn('For transparency, the section of code you see above will be sent to the author directly. Rest assured, your privacy is prioritized.');
481
+ logger.warn('This message will NOT go away by restarting Homebridge. An update MUST become available first. Please be patient, thank you!');
482
+ }
409
483
  try {
410
484
  await axios.post(getDetectReportUrl(), JSON.stringify(cleanedData, null, 2), {
411
485
  family: 4,
@@ -418,7 +492,7 @@ export async function detectedNewSensorsStatus(sensors, logger, debugMode) {
418
492
  }
419
493
  catch (error) {
420
494
  if (debugMode === true) {
421
- debugLog(logger, 'detect.ts / detectedNewSensorsStatus()', 'error', 'Failed to notify plugin author about the new sensors status');
495
+ debugLog(logger, 'detect.ts / detectApiSensorsStatus()', 'error', 'Failed to notify plugin author about the new sensors status');
422
496
  stackTracer('serialize-error', serializeError(error));
423
497
  }
424
498
  return false;
@@ -426,7 +500,7 @@ export async function detectedNewSensorsStatus(sensors, logger, debugMode) {
426
500
  }
427
501
  return false;
428
502
  }
429
- export async function detectedSensorCountMismatch(data, logger, debugMode) {
503
+ export async function detectPlatformSensorCountMismatch(data, logger, debugMode) {
430
504
  const detectedCountMismatch = data.sensorsInfo.length !== data.sensorsStatus.length;
431
505
  if (detectedCountMismatch) {
432
506
  const cleanedData = removePersonalIdentifiableInformation(data);
@@ -437,26 +511,29 @@ export async function detectedSensorCountMismatch(data, logger, debugMode) {
437
511
  logger.warn('Plugin has detected a sensor count mismatch. You are running an older plugin version, please update soon.');
438
512
  }
439
513
  if (debugMode) {
440
- debugLog(logger, 'detect.ts / detectedSensorCountMismatch()', 'warn', 'Plugin has detected a sensor count mismatch. You are running an older plugin version, please update soon');
514
+ debugLog(logger, 'detect.ts / detectPlatformSensorCountMismatch()', 'warn', 'Plugin has detected a sensor count mismatch. You are running an older plugin version, please update soon');
441
515
  }
442
516
  return false;
443
517
  }
444
518
  }
445
519
  catch (error) {
446
520
  if (debugMode === true) {
447
- debugLog(logger, 'detect.ts / detectedSensorCountMismatch()', 'error', 'Failed to check if plugin is outdated');
521
+ debugLog(logger, 'detect.ts / detectPlatformSensorCountMismatch()', 'error', 'Failed to check if plugin is outdated');
448
522
  stackTracer('serialize-error', serializeError(error));
449
523
  }
450
524
  return false;
451
525
  }
452
526
  if (logger !== null) {
453
527
  logger.warn('Plugin has detected a sensor count mismatch. Notifying plugin author about this discovery ...');
454
- logger.warn('This message will NOT go away by restarting Homebridge. An update MUST become available first. Please be patient, thank you!');
455
528
  }
456
529
  if (debugMode) {
457
- debugLog(logger, 'detect.ts / detectedSensorCountMismatch()', 'warn', 'Plugin has detected a sensor count mismatch. Notifying plugin author about this discovery');
530
+ debugLog(logger, 'detect.ts / detectPlatformSensorCountMismatch()', 'warn', 'Plugin has detected a sensor count mismatch. Notifying plugin author about this discovery');
458
531
  }
459
532
  stackTracer('detect-content', cleanedData);
533
+ if (logger !== null) {
534
+ logger.warn('For transparency, the section of code you see above will be sent to the author directly. Rest assured, your privacy is prioritized.');
535
+ logger.warn('This message will NOT go away by restarting Homebridge. An update MUST become available first. Please be patient, thank you!');
536
+ }
460
537
  try {
461
538
  await axios.post(getDetectReportUrl(), JSON.stringify(cleanedData, null, 2), {
462
539
  family: 4,
@@ -469,7 +546,7 @@ export async function detectedSensorCountMismatch(data, logger, debugMode) {
469
546
  }
470
547
  catch (error) {
471
548
  if (debugMode === true) {
472
- debugLog(logger, 'detect.ts / detectedSensorCountMismatch()', 'error', 'Failed to notify plugin author about the sensor count mismatch');
549
+ debugLog(logger, 'detect.ts / detectPlatformSensorCountMismatch()', 'error', 'Failed to notify plugin author about the sensor count mismatch');
473
550
  stackTracer('serialize-error', serializeError(error));
474
551
  }
475
552
  return false;
@@ -477,7 +554,7 @@ export async function detectedSensorCountMismatch(data, logger, debugMode) {
477
554
  }
478
555
  return false;
479
556
  }
480
- export async function detectedUnknownSensorsAction(sensors, logger, debugMode) {
557
+ export async function detectPlatformUnknownSensorsAction(sensors, logger, debugMode) {
481
558
  const detectedNewActions = sensors.filter((sensor) => {
482
559
  const sensorStatusStatuses = sensor.status.statuses;
483
560
  const sensorType = sensor.type;
@@ -497,26 +574,29 @@ export async function detectedUnknownSensorsAction(sensors, logger, debugMode) {
497
574
  logger.warn('Plugin has detected unknown sensors action. You are running an older plugin version, please update soon.');
498
575
  }
499
576
  if (debugMode) {
500
- debugLog(logger, 'detect.ts / detectedUnknownSensorsAction()', 'warn', 'Plugin has detected unknown sensors action. You are running an older plugin version, please update soon');
577
+ debugLog(logger, 'detect.ts / detectPlatformUnknownSensorsAction()', 'warn', 'Plugin has detected unknown sensors action. You are running an older plugin version, please update soon');
501
578
  }
502
579
  return false;
503
580
  }
504
581
  }
505
582
  catch (error) {
506
583
  if (debugMode === true) {
507
- debugLog(logger, 'detect.ts / detectedUnknownSensorsAction()', 'error', 'Failed to check if plugin is outdated');
584
+ debugLog(logger, 'detect.ts / detectPlatformUnknownSensorsAction()', 'error', 'Failed to check if plugin is outdated');
508
585
  stackTracer('serialize-error', serializeError(error));
509
586
  }
510
587
  return false;
511
588
  }
512
589
  if (logger !== null) {
513
590
  logger.warn('Plugin has detected unknown sensors action. Notifying plugin author about this discovery ...');
514
- logger.warn('This message will NOT go away by restarting Homebridge. An update MUST become available first. Please be patient, thank you!');
515
591
  }
516
592
  if (debugMode) {
517
- debugLog(logger, 'detect.ts / detectedUnknownSensorsAction()', 'warn', 'Plugin has detected unknown sensors action. Notifying plugin author about this discovery');
593
+ debugLog(logger, 'detect.ts / detectPlatformUnknownSensorsAction()', 'warn', 'Plugin has detected unknown sensors action. Notifying plugin author about this discovery');
518
594
  }
519
595
  stackTracer('detect-content', cleanedData);
596
+ if (logger !== null) {
597
+ logger.warn('For transparency, the section of code you see above will be sent to the author directly. Rest assured, your privacy is prioritized.');
598
+ logger.warn('This message will NOT go away by restarting Homebridge. An update MUST become available first. Please be patient, thank you!');
599
+ }
520
600
  try {
521
601
  await axios.post(getDetectReportUrl(), JSON.stringify(cleanedData, null, 2), {
522
602
  family: 4,
@@ -529,7 +609,7 @@ export async function detectedUnknownSensorsAction(sensors, logger, debugMode) {
529
609
  }
530
610
  catch (error) {
531
611
  if (debugMode === true) {
532
- debugLog(logger, 'detect.ts / detectedUnknownSensorsAction()', 'error', 'Failed to notify plugin author about the unknown sensors action');
612
+ debugLog(logger, 'detect.ts / detectPlatformUnknownSensorsAction()', 'error', 'Failed to notify plugin author about the unknown sensors action');
533
613
  stackTracer('serialize-error', serializeError(error));
534
614
  }
535
615
  return false;