diff --git a/.eslintrc.json b/.eslintrc.json
index e67131a..7e8881c 100644
--- a/.eslintrc.json
+++ b/.eslintrc.json
@@ -127,6 +127,17 @@
}
]
}
+ },
+ {
+ "files": [
+ "./src/scripts/repl.ts",
+ "./src/scripts/test-api.ts"
+ ],
+ "rules": {
+ "no-new": [
+ "off"
+ ]
+ }
}
]
}
diff --git a/package.json b/package.json
index 9670075..2437cf0 100644
--- a/package.json
+++ b/package.json
@@ -1,7 +1,7 @@
{
"name": "homebridge-adt-pulse",
"displayName": "Homebridge ADT Pulse",
- "version": "3.4.0",
+ "version": "3.4.1",
"description": "Homebridge security system platform for ADT Pulse",
"main": "./build/index.js",
"exports": "./build/index.js",
diff --git a/src/config-ui/vite/src/pages/settings-sensors.tsx b/src/config-ui/vite/src/pages/settings-sensors.tsx
index 1953b7a..da84d49 100644
--- a/src/config-ui/vite/src/pages/settings-sensors.tsx
+++ b/src/config-ui/vite/src/pages/settings-sensors.tsx
@@ -1,6 +1,7 @@
import React from 'react';
import { Controller, useFieldArray, useWatch } from 'react-hook-form';
+import { styles } from '@/config-ui/vite/src/styles/pages/settings-sensors.js';
import type { SettingsSensorsGetSensorHeaderIndex, SettingsSensorsGetSensorHeaderReturns, SettingsSensorsProps } from '@/types/config-ui.d.ts';
/**
@@ -35,25 +36,40 @@ export default function SettingsSensors(props: SettingsSensorsProps) {
const sensor = watch[index];
if (sensor === undefined) {
- return '';
+ return {
+ name: null,
+ adtName: null,
+ };
}
const sensorName = sensor.name;
const sensorAdtName = sensor.adtName;
if (sensorName && sensorAdtName) {
- return `${sensorName} (${sensorAdtName})`;
+ return {
+ name: sensorName,
+ adtName: sensorAdtName,
+ };
}
if (sensorName) {
- return `${sensorName}`;
+ return {
+ name: sensorName,
+ adtName: null,
+ };
}
if (sensorAdtName) {
- return `${sensorAdtName}`;
+ return {
+ name: null,
+ adtName: sensorAdtName,
+ };
}
- return 'Sensor';
+ return {
+ name: 'Sensor',
+ adtName: null,
+ };
};
return (
@@ -77,7 +93,22 @@ export default function SettingsSensors(props: SettingsSensorsProps) {
aria-expanded="false"
aria-controls={`collapse-${sensor.id}`}
>
- {getSensorHeader(index)}
+
+ {
+ (getSensorHeader(index).name !== null) ? (
+
+ {getSensorHeader(index).name}
+
+ ) : null
+ }
+ {
+ (getSensorHeader(index).adtName !== null) ? (
+
+ {getSensorHeader(index).adtName}
+
+ ) : null
+ }
+
diff --git a/src/config-ui/vite/src/pages/settings.tsx b/src/config-ui/vite/src/pages/settings.tsx
index 83c900c..59f1272 100644
--- a/src/config-ui/vite/src/pages/settings.tsx
+++ b/src/config-ui/vite/src/pages/settings.tsx
@@ -51,6 +51,8 @@ export default function Settings(props: SettingsProps) {
useEffect(() => {
(async () => {
if (homebridge === undefined) {
+ setReady(true);
+
return;
}
diff --git a/src/config-ui/vite/src/styles/pages/settings-sensors.ts b/src/config-ui/vite/src/styles/pages/settings-sensors.ts
new file mode 100644
index 0000000..3aa80bc
--- /dev/null
+++ b/src/config-ui/vite/src/styles/pages/settings-sensors.ts
@@ -0,0 +1,14 @@
+import type { Styles } from '@/types/config-ui.d.ts';
+
+/**
+ * Styles.
+ *
+ * @returns {Styles}
+ *
+ * @since 1.0.0
+ */
+export const styles: Styles = {
+ sensorHeader: {
+ width: '95%',
+ },
+};
diff --git a/src/lib/utility.ts b/src/lib/utility.ts
index ee49d58..08709da 100644
--- a/src/lib/utility.ts
+++ b/src/lib/utility.ts
@@ -727,7 +727,7 @@ export function getAccessoryCategory(deviceCategory: GetAccessoryCategoryDeviceC
* @since 1.0.0
*/
export function getDetectReportUrl(): GetDetectReportUrlReturns {
- return 'https://f4ds5bzvu2c2tmxc47bh.ntfy.mrjackyliang.com';
+ return 'https://b4ch8ibuidp0wv68c3x9.ntfy.mrjackyliang.com';
}
/**
diff --git a/src/scripts/repl.ts b/src/scripts/repl.ts
index b317940..0f7a491 100644
--- a/src/scripts/repl.ts
+++ b/src/scripts/repl.ts
@@ -20,7 +20,6 @@ import type {
ADTPulseReplSetAuthInstanceReturns,
ADTPulseReplSetAuthInstanceSubdomain,
ADTPulseReplSetAuthInstanceUsername,
- ADTPulseReplStartReplReturns,
} from '@/types/index.d.ts';
/**
@@ -54,16 +53,14 @@ class ADTPulseRepl {
*
* @since 1.0.0
*/
- #replServer: ADTPulseReplReplServer;
+ readonly #replServer: ADTPulseReplReplServer;
/**
- * ADT Pulse Repl - Start repl.
- *
- * @returns {ADTPulseReplStartReplReturns}
+ * ADT Pulse Repl - Constructor.
*
* @since 1.0.0
*/
- public async startRepl(): ADTPulseReplStartReplReturns {
+ constructor() {
ADTPulseRepl.displayStartupHeader();
ADTPulseRepl.displayHelpMenu();
@@ -356,5 +353,4 @@ class ADTPulseRepl {
}
}
-const adtPulseRepl = new ADTPulseRepl();
-await adtPulseRepl.startRepl();
+new ADTPulseRepl();
diff --git a/src/scripts/test-api.ts b/src/scripts/test-api.ts
index 8c3491f..ded86f4 100644
--- a/src/scripts/test-api.ts
+++ b/src/scripts/test-api.ts
@@ -19,7 +19,6 @@ import type {
ADTPulseTestPrintTestOutputReturns,
ADTPulseTestSelectedConfigLocation,
ADTPulseTestSelectedPlatform,
- ADTPulseTestStartTestReturns,
ADTPulseTestZodParseResponse,
} from '@/types/index.d.ts';
@@ -57,83 +56,83 @@ class ADTPulseTest {
#zodParseResponse: ADTPulseTestZodParseResponse;
/**
- * ADT Pulse Test - Start test.
- *
- * @returns {ADTPulseTestStartTestReturns}
+ * ADT Pulse Test - Constructor.
*
* @since 1.0.0
*/
- async startTest(): ADTPulseTestStartTestReturns {
- try {
- const userAcceptedDisclaimer = await ADTPulseTest.askQuestion('disclaimer');
-
- if (!userAcceptedDisclaimer) {
- exit(0);
- }
-
- // Used to pad the user input to the next line.
- console.info('\r');
+ constructor() {
+ (async () => {
+ try {
+ const userAcceptedDisclaimer = await ADTPulseTest.askQuestion('disclaimer');
- const configFoundAndSet = this.findConfig();
+ if (!userAcceptedDisclaimer) {
+ exit(0);
+ }
- if (!configFoundAndSet || this.#selectedPlatform === undefined) {
- ADTPulseTest.printTestOutput(false);
+ // Used to pad the user input to the next line.
+ console.info('\r');
- exit(1);
- }
+ const configFoundAndSet = this.findConfig();
- const instance = new ADTPulseAPI(
- this.#selectedPlatform,
- {
- debug: true,
- testMode: {
- enabled: true,
- },
- },
- );
- const instanceFunctions = [
- instance.login.bind(instance),
- instance.getGatewayInformation.bind(instance),
- instance.getPanelInformation.bind(instance),
- instance.getPanelStatus.bind(instance),
- instance.setPanelStatus.bind(instance, 'off', 'away', false),
- instance.setPanelStatus.bind(instance, 'away', 'stay', false),
- instance.setPanelStatus.bind(instance, 'stay', 'night', false),
- instance.setPanelStatus.bind(instance, 'night', 'off', false),
- instance.getSensorsInformation.bind(instance),
- instance.getSensorsStatus.bind(instance),
- instance.getOrbSecurityButtons.bind(instance),
- instance.performSyncCheck.bind(instance),
- instance.performKeepAlive.bind(instance),
- instance.logout.bind(instance),
- ];
-
- for (let i = 0; i < instanceFunctions.length; i += 1) {
- const response = await instanceFunctions[i]();
-
- // If response is not successful, end the test.
- if (!response.success) {
+ if (!configFoundAndSet || this.#selectedPlatform === undefined) {
ADTPulseTest.printTestOutput(false);
exit(1);
}
- // Print success responses.
- console.info(util.inspect(response, {
- showHidden: false,
- depth: Infinity,
- colors: true,
- }));
- }
+ const instance = new ADTPulseAPI(
+ this.#selectedPlatform,
+ {
+ debug: true,
+ testMode: {
+ enabled: true,
+ },
+ },
+ );
+ const instanceFunctions = [
+ instance.login.bind(instance),
+ instance.getGatewayInformation.bind(instance),
+ instance.getPanelInformation.bind(instance),
+ instance.getPanelStatus.bind(instance),
+ instance.setPanelStatus.bind(instance, 'off', 'away', false),
+ instance.setPanelStatus.bind(instance, 'away', 'stay', false),
+ instance.setPanelStatus.bind(instance, 'stay', 'night', false),
+ instance.setPanelStatus.bind(instance, 'night', 'off', false),
+ instance.getSensorsInformation.bind(instance),
+ instance.getSensorsStatus.bind(instance),
+ instance.getOrbSecurityButtons.bind(instance),
+ instance.performSyncCheck.bind(instance),
+ instance.performKeepAlive.bind(instance),
+ instance.logout.bind(instance),
+ ];
+
+ for (let i = 0; i < instanceFunctions.length; i += 1) {
+ const response = await instanceFunctions[i]();
+
+ // If response is not successful, end the test.
+ if (!response.success) {
+ ADTPulseTest.printTestOutput(false);
+
+ exit(1);
+ }
- ADTPulseTest.printTestOutput(true);
+ // Print success responses.
+ console.info(util.inspect(response, {
+ showHidden: false,
+ depth: Infinity,
+ colors: true,
+ }));
+ }
- exit(0);
- } catch {
- ADTPulseTest.printTestOutput(false);
+ ADTPulseTest.printTestOutput(true);
- exit(1);
- }
+ exit(0);
+ } catch {
+ ADTPulseTest.printTestOutput(false);
+
+ exit(1);
+ }
+ })();
}
/**
@@ -294,5 +293,4 @@ class ADTPulseTest {
}
}
-const instance = new ADTPulseTest();
-await instance.startTest();
+new ADTPulseTest();
diff --git a/src/types/config-ui.d.ts b/src/types/config-ui.d.ts
index 6fb4571..af55cd2 100644
--- a/src/types/config-ui.d.ts
+++ b/src/types/config-ui.d.ts
@@ -344,7 +344,14 @@ export type SettingsSensorsProps = {
*/
export type SettingsSensorsGetSensorHeaderIndex = number;
-export type SettingsSensorsGetSensorHeaderReturns = string;
+export type SettingsSensorsGetSensorHeaderReturnsName = string | null;
+
+export type SettingsSensorsGetSensorHeaderReturnsAdtName = string | null;
+
+export type SettingsSensorsGetSensorHeaderReturns = {
+ name: SettingsSensorsGetSensorHeaderReturnsName;
+ adtName: SettingsSensorsGetSensorHeaderReturnsAdtName;
+};
/**
* Setup.
diff --git a/src/types/index.d.ts b/src/types/index.d.ts
index 524afb8..98c3257 100644
--- a/src/types/index.d.ts
+++ b/src/types/index.d.ts
@@ -1304,13 +1304,6 @@ export type ADTPulseReplSetAuthInstancePassword = unknown;
export type ADTPulseReplSetAuthInstanceReturns = void;
-/**
- * ADT Pulse Repl - Start repl.
- *
- * @since 1.0.0
- */
-export type ADTPulseReplStartReplReturns = Promise;
-
/**
* ADT Pulse Test - Ask question.
*
@@ -1356,13 +1349,6 @@ export type ADTPulseTestSelectedConfigLocation = string | undefined;
*/
export type ADTPulseTestSelectedPlatform = Config | undefined;
-/**
- * ADT Pulse Test - Start test.
- *
- * @since 1.0.0
- */
-export type ADTPulseTestStartTestReturns = Promise;
-
/**
* ADT Pulse Test - Zod parse response.
*
diff --git a/src/types/shared.d.ts b/src/types/shared.d.ts
index 1d1549d..6727f38 100644
--- a/src/types/shared.d.ts
+++ b/src/types/shared.d.ts
@@ -1,7 +1,7 @@
import type { AxiosResponse } from 'axios';
import type { Logger } from 'homebridge';
-import type http from 'http';
import type { JSDOM } from 'jsdom';
+import type http from 'node:http';
import type { ErrorObject } from 'serialize-error';
import type { z } from 'zod';