Skip to content

Commit

Permalink
Support for new portal version
Browse files Browse the repository at this point in the history
### UPDATED
- In config, `options` and `sensors` now comes with a default option. If the setting was missing due to Homebridge removing an empty option, Zod will enforce an empty array by default (partial credit to @cyberpower678 on issue #141).
- Performance improvements for `ignoreSensorProblemStatus` checks.
- Parse configuration warning message.

### FIXED
- In config, `fingerprint` max length should be "10240" not "5120" (old value).
- In config, `sensors` max items should be "147" not "148" due to the allocation for an extra "Alarm Ringing" switch.

### ADDED
- Support for "28.0.0-57" portal version.
  • Loading branch information
mrjackyliang committed Apr 2, 2024
1 parent 2b74f1d commit e8f1d8a
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 16 deletions.
8 changes: 3 additions & 5 deletions config.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
"description": "After logging in and selecting \"Trust this device\", paste in the device fingerprint generated through the <a href=\"https://raw.githack.com/mrjackyliang/homebridge-adt-pulse/main/fingerprint/index.html\" target=\"_blank\">ADT Pulse Device Fingerprint Detector</a>.",
"placeholder": "e.g. VGhpc0lzQVNlY3VyZVBhc3N3b3JkMTIzIQ==",
"minLength": 1,
"maxLength": 5120
"maxLength": 10240
},
"mode": {
"title": "Operational Mode",
Expand Down Expand Up @@ -128,7 +128,6 @@
"options": {
"title": "Advanced Options",
"type": "array",
"required": true,
"description": "Customize the features of this plugin. Please note these advanced options will disable expected functionality. Only enable them if necessary.",
"items": {
"type": "string",
Expand All @@ -141,8 +140,7 @@
"sensors": {
"title": "Sensors",
"type": "array",
"required": true,
"description": "Define your sensors here. Sensors include devices like \"Door/Window Sensor\" or \"Motion Sensor\". <strong class=\"font-weight-bold\">Please note that Z-Wave accessories are not supported.</strong> A maximum of 148 sensors can be added (the plugin reserves 2 accessories for the gateway and security panel).",
"description": "Define your sensors here. Sensors include devices like \"Door/Window Sensor\" or \"Motion Sensor\". <strong class=\"font-weight-bold\">Please note that Z-Wave accessories are not supported.</strong> A maximum of 147 sensors can be added (3 slots are reserved for the gateway, security panel, and alarm ringing switch).",
"items": {
"type": "object",
"properties": {
Expand Down Expand Up @@ -238,7 +236,7 @@
}
},
"minItems": 0,
"maxItems": 148
"maxItems": 147
}
}
},
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "homebridge-adt-pulse",
"displayName": "Homebridge ADT Pulse",
"version": "3.2.15",
"version": "3.3.0",
"description": "Homebridge security system platform for ADT Pulse",
"main": "./build/index.js",
"exports": "./build/index.js",
Expand Down
1 change: 1 addition & 0 deletions src/lib/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,7 @@ export class ADTPulse {
* '25.0.0-21'
* '26.0.0-32'
* '27.0.0-140'
* '28.0.0-57'
*
* @since 1.0.0
*/
Expand Down
2 changes: 2 additions & 0 deletions src/lib/items.ts
Original file line number Diff line number Diff line change
Expand Up @@ -533,6 +533,7 @@ export const itemDoSubmitHandlerRelativeUrls: ItemDoSubmitHandlerRelativeUrls =
'/myhome/25.0.0-21/quickcontrol/serv/RunRRACommand',
'/myhome/26.0.0-32/quickcontrol/serv/RunRRACommand',
'/myhome/27.0.0-140/quickcontrol/serv/RunRRACommand',
'/myhome/28.0.0-57/quickcontrol/serv/RunRRACommand',
];

/**
Expand Down Expand Up @@ -725,6 +726,7 @@ export const itemPortalVersions: ItemPortalVersions = [
'25.0.0-21',
'26.0.0-32',
'27.0.0-140',
'28.0.0-57',
];

/**
Expand Down
2 changes: 1 addition & 1 deletion src/lib/platform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ export class ADTPulsePlatform implements ADTPulsePlatformPlugin {
// Check for a valid platform configuration before initializing.
if (!parsedConfig.success) {
this.#log.error('Plugin is unable to initialize due to an invalid platform configuration.');
this.#log.warn('If you just upgraded from "v2 to v3" or from "v3 to v3.1", please update your configuration.');
this.#log.warn('If you just upgraded from v2 to v3, the configuration has been changed. Please re-configure your plugin.');
this.#log.warn('Carefully observe the error below. The answer you are looking for is there.');
stackTracer('zod-error', parsedConfig.error.errors);

Expand Down
4 changes: 2 additions & 2 deletions src/lib/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export const platformConfig = z.object({
options: z.array(z.union([
z.literal('disableAlarmRingingSwitch'),
z.literal('ignoreSensorProblemStatus'),
])),
])).default([]),
sensors: z.array(z.object({
name: z.string().min(1).max(50).optional(),
adtName: z.string().min(1).max(100),
Expand All @@ -45,5 +45,5 @@ export const platformConfig = z.object({
z.literal('temperature'),
]),
adtZone: z.number().min(1).max(99),
})).min(0).max(148),
})).min(0).max(148).default([]),
});
10 changes: 5 additions & 5 deletions src/lib/utility.ts
Original file line number Diff line number Diff line change
Expand Up @@ -890,7 +890,7 @@ export function getAccessoryCategory(deviceCategory: GetAccessoryCategoryDeviceC
* @since 1.0.0
*/
export function getDetectReportUrl(): GetDetectReportUrlReturns {
return 'https://7usev98x5actrwn6qb2m.ntfy.mrjackyliang.com';
return 'https://f4ds5bzvu2c2tmxc47bh.ntfy.mrjackyliang.com';
}

/**
Expand Down Expand Up @@ -995,14 +995,14 @@ export function isPanelAlarmActive(panelStatuses: IsPanelAlarmActivePanelStatuse
|| panelStatuses.includes('Carbon Monoxide Alarm')
|| panelStatuses.includes('FIRE ALARM')
|| (
panelStatuses.includes('Sensor Problem')
!ignoreSensorProblem
&& panelStatuses.includes('Sensor Problem')
&& hasDisarmedTroubleButtons
&& !ignoreSensorProblem
)
|| (
panelStatuses.includes('Sensor Problems')
!ignoreSensorProblem
&& panelStatuses.includes('Sensor Problems')
&& hasDisarmedTroubleButtons
&& !ignoreSensorProblem
)
|| panelStatuses.includes('Uncleared Alarm')
|| panelStatuses.includes('WATER ALARM')
Expand Down
6 changes: 4 additions & 2 deletions src/types/constant.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,8 @@ export type PortalPanelForceArmButtonRelativeUrl =
| '/myhome/24.0.0-117/quickcontrol/serv/RunRRACommand'
| '/myhome/25.0.0-21/quickcontrol/serv/RunRRACommand'
| '/myhome/26.0.0-32/quickcontrol/serv/RunRRACommand'
| '/myhome/27.0.0-140/quickcontrol/serv/RunRRACommand';
| '/myhome/27.0.0-140/quickcontrol/serv/RunRRACommand'
| '/myhome/28.0.0-57/quickcontrol/serv/RunRRACommand';

/**
* Portal panel note.
Expand Down Expand Up @@ -362,4 +363,5 @@ export type PortalVersion =
| '24.0.0-117'
| '25.0.0-21'
| '26.0.0-32'
| '27.0.0-140';
| '27.0.0-140'
| '28.0.0-57';

0 comments on commit e8f1d8a

Please sign in to comment.