diff --git a/README.md b/README.md index 2cd862e..fab8136 100644 --- a/README.md +++ b/README.md @@ -37,8 +37,8 @@ Here is an example of how the `config.json` file for this plugin should be confi { "name": "Family Room Couch Window 1", "adtName": "Family Room Window (99)", - "adtType": "doorWindow", - "adtZone": 99 + "adtZone": 99, + "adtType": "doorWindow" } ] }, @@ -136,12 +136,12 @@ All sensors are now organized within an array of objects, with each object conta - For display purposes (offers clarity in the event of an unforeseen reset). - __ADT Name__ (`adtName`) - Must match the name shown under the "Name" column in the "System" tab when logged into the portal. -- __ADT Type__ (`adtType`) - - Must match the type shown under the "Device Type" column in the "System" tab when logged into the portal. - - For example, if the type is "Door/Window Sensor", the value should be `doorWindow`. Read the [Supported Devices](#supported-devices) section for more information. - __ADT Zone__ (`adtZone`) - Must match the zone shown under the "Zone" column in the "System" tab when logged into the portal. - For compatibility reasons, only devices with zones 1 through 99 are supported. +- __ADT Type__ (`adtType`) + - Must match the type shown under the "Device Type" column in the "System" tab when logged into the portal. + - For example, if the type is "Door/Window Sensor", the value should be `doorWindow`. Read the [Supported Devices](#supported-devices) section for more information. If you do not wish to add sensors, simply assign an empty array (e.g. `[]`). However, it is advisable to include all supported sensors, as having none does not optimize plugin performance. diff --git a/config.schema.json b/config.schema.json index 19d8a66..a5b7b54 100644 --- a/config.schema.json +++ b/config.schema.json @@ -150,7 +150,7 @@ "required": false, "description": "Optional. Provide a display name for this sensor to differentiate it from the names assigned by ADT technicians during installation.", "placeholder": "e.g. Family Room Couch Window 1", - "minLength": 1, + "minLength": 0, "maxLength": 50 }, "adtName": { @@ -162,6 +162,15 @@ "minLength": 1, "maxLength": 100 }, + "adtZone": { + "title": "ADT Sensor Zone", + "type": "number", + "required": true, + "description": "Specify the exact zone associated with the sensor you want to add. Double-check the zone to ensure the correct sensor is added.", + "placeholder": "e.g. 99", + "minimum": 1, + "maximum": 99 + }, "adtType": { "title": "ADT Sensor Type", "type": "string", @@ -223,15 +232,6 @@ ] } ] - }, - "adtZone": { - "title": "ADT Sensor Zone", - "type": "number", - "required": true, - "description": "Specify the exact zone associated with the sensor you want to add. Double-check the zone to ensure the correct sensor is added.", - "placeholder": "e.g. 99", - "minimum": 1, - "maximum": 99 } } }, @@ -301,10 +301,6 @@ { "key": "fingerprint", "type": "password" - }, - { - "type": "help", - "helpvalue": "
{renderTableProperty(property)} | ++ { + (typeof value === 'object' && value !== null) ? ( + renderTable(value) + ) : ( + renderTableValue(property, value) + ) + } + | +
---|
The information shown below is for your eyes only. Fingerprints are considered your secondary password. Leaking this will compromise the MFA security to your ADT Pulse account.
+ { + renderTable(_.get(parsedObject, ['fingerprint'])) + } +Failed to parse your fingerprint. Please re-run the setup wizard.
+ ); + } + + return ( +Parsing your fingerprint, please wait...
+ ); +} diff --git a/src/config-ui/vite/src/pages/settings-classic.tsx b/src/config-ui/vite/src/pages/settings-classic.tsx new file mode 100644 index 0000000..12a80f0 --- /dev/null +++ b/src/config-ui/vite/src/pages/settings-classic.tsx @@ -0,0 +1,53 @@ +import React, { useEffect, useState } from 'react'; + +import type { SettingsClassicProps } from '@/types/config-ui.d.ts'; + +/** + * Settings classic. + * + * @constructor + * + * @since 1.0.0 + */ +export default function SettingsClassic(props: SettingsClassicProps) { + const { homebridge, setView } = props; + + const [ready, setReady] = useState(false); + + useEffect(() => { + (async () => { + if (homebridge === undefined) { + return; + } + + homebridge.showSpinner(); + + // Making sure the UI does not randomly flash. + await new Promise((resolve) => { + setTimeout(resolve, 1000); + }); + + // In case the previous view was modern settings. + homebridge.showSchemaForm(); + + // Once the schema form shows, set the view to "ready". + setReady(true); + + homebridge.hideSpinner(); + })(); + }, []); + + if (ready) { + return ( + + ); + } + + return null; +} diff --git a/src/config-ui/vite/src/pages/settings-fingerprint.tsx b/src/config-ui/vite/src/pages/settings-fingerprint.tsx new file mode 100644 index 0000000..f26f5f7 --- /dev/null +++ b/src/config-ui/vite/src/pages/settings-fingerprint.tsx @@ -0,0 +1,26 @@ +import React from 'react'; + +import FingerprintTable from '@/config-ui/vite/src/components/fingerprint-table.js'; +import type { SettingsFingerprintProps } from '@/types/config-ui.d.ts'; + +/** + * Settings fingerprint. + * + * @constructor + * + * @since 1.0.0 + */ +export default function SettingsFingerprint(props: SettingsFingerprintProps) { + const { fingerprint } = props; + + if (fingerprint !== '' || import.meta.env.DEV) { + return ( + <> +This section allows you to explore the contents of the randomly generated browser fingerprint used with your account. If you would like to refresh your fingerprint, re-run the setup wizard located in the "System" tab.
++ + You are currently + {' '} + { + _.sample([ + 'running', + 'enjoying', + 'utilizing', + 'rocking', + 'dominating', + ]) + } + +
+Instance Name: | ++ {information.instanceName} + | +
---|---|
Instance ID: | ++ {information.instanceId} + | +
Homebridge Version: | ++ {information.homebridgeVersion} + | +
Node.js Version | ++ {information.nodeVersion} + | +
Platform | ++ {information.platform} + | +
Running on: | ++ {information.runningOn} + | +
This section allows you to define your ADT connected sensors here. Sensors include connected devices like "Door/Window Sensor" or "Motion Sensor". If you would like to update your sensors, re-run the setup wizard.
++ A maximum of 147 sensors can be added (3 slots are reserved for the gateway, security panel, and alarm ringing switch). + {' '} + Z-Wave connected accessories are not supported. +
+Restart Homebridge to apply your configuration changes.
diff --git a/src/config-ui/vite/src/pages/setup-sensors.tsx b/src/config-ui/vite/src/pages/setup-sensors.tsx index 2c1d240..aec494b 100644 --- a/src/config-ui/vite/src/pages/setup-sensors.tsx +++ b/src/config-ui/vite/src/pages/setup-sensors.tsx @@ -44,7 +44,7 @@ export default function SetupSensors(props: SetupSensorsProps) { } const configs = await homebridge.getPluginConfig(); - const config = configs[0]; + const config = configs[0] ?? {}; // For user experience purposes. if (_.get(config, ['sensors'], []).length > 0) { diff --git a/src/config-ui/vite/src/pages/setup-welcome.tsx b/src/config-ui/vite/src/pages/setup-welcome.tsx index a915fb5..e996352 100644 --- a/src/config-ui/vite/src/pages/setup-welcome.tsx +++ b/src/config-ui/vite/src/pages/setup-welcome.tsx @@ -16,7 +16,7 @@ export default function SetupWelcome(props: SetupWelcomeProps) { return (Homebridge plugin for ADT Pulse Security System
diff --git a/src/config-ui/vite/src/router.tsx b/src/config-ui/vite/src/router.tsx index e0659e3..7abc8e4 100644 --- a/src/config-ui/vite/src/router.tsx +++ b/src/config-ui/vite/src/router.tsx @@ -2,6 +2,7 @@ import React, { useEffect, useState } from 'react'; import ScreenToggle from '@/config-ui/vite/src/components/screen-toggle.js'; import Settings from '@/config-ui/vite/src/pages/settings.js'; +import SettingsClassic from '@/config-ui/vite/src/pages/settings-classic.js'; import Setup from '@/config-ui/vite/src/pages/setup.js'; import type { RouterProps, RouterView } from '@/types/config-ui.d.ts'; @@ -29,8 +30,7 @@ export default function Router(props: RouterProps) { if (configs.length === 0) { setView('setup'); } else { - // setView('settings'); - homebridge.showSchemaForm(); // TODO Will be replaced in a future version. + setView('settings'); } })(); }, [homebridge]); @@ -40,6 +40,9 @@ export default function Router(props: RouterProps) { {(view === 'settings') ? (