homebridge-adt-pulse 2.2.0 → 3.0.0-beta.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.
- package/LICENSE +1 -1
- package/README.md +13 -13
- package/package.json +38 -17
- package/src/index.ts +18 -0
- package/src/lib/accessory.ts +405 -0
- package/src/lib/api.ts +3483 -0
- package/src/lib/detect.ts +728 -0
- package/src/lib/platform.ts +890 -0
- package/src/lib/regex.ts +167 -0
- package/src/lib/schema.ts +34 -0
- package/src/lib/utility.ts +933 -0
- package/src/scripts/repl.ts +300 -0
- package/src/scripts/test-api.ts +278 -0
- package/src/types/constant.d.ts +308 -0
- package/src/types/index.d.ts +1472 -0
- package/src/types/shared.d.ts +517 -0
- package/api-test.js +0 -280
- package/api.js +0 -878
- package/index.js +0 -1312
package/src/lib/regex.ts
ADDED
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Character backslash forward slash.
|
|
3
|
+
*
|
|
4
|
+
* @since 1.0.0
|
|
5
|
+
*/
|
|
6
|
+
export const characterBackslashForwardSlash = /\\\//g;
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Character html line break.
|
|
10
|
+
*
|
|
11
|
+
* @since 1.0.0
|
|
12
|
+
*/
|
|
13
|
+
export const characterHtmlLineBreak = /<br( ?\/)?>/;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Character whitespace.
|
|
17
|
+
*
|
|
18
|
+
* @since 1.0.0
|
|
19
|
+
*/
|
|
20
|
+
export const characterWhitespace = /\s+/g;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Function do submit.
|
|
24
|
+
*
|
|
25
|
+
* @since 1.0.0
|
|
26
|
+
*/
|
|
27
|
+
export const functionDoSubmit = /doSubmit\(\s*'([^']+)\?sat=([^']+)&href=([^&]+)(&armstate=([^&]+)&arm=([^']+))?'\s*\)/;
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Function go to url.
|
|
31
|
+
*
|
|
32
|
+
* @since 1.0.0
|
|
33
|
+
*/
|
|
34
|
+
export const functionGoToUrl = /^goToUrl\('device\.jsp\?id=([0-9]+)'\);$/;
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Function set arm state.
|
|
38
|
+
*
|
|
39
|
+
* @since 1.0.0
|
|
40
|
+
*/
|
|
41
|
+
export const functionSetArmState = /setArmState\(\s*'([^']+)',\s*'([^']+)',\s*'([^']+)',\s*'([^']+)',\s*'([^']+)',\s*'href=([^']+)&armstate=([^&]+)&arm=([^&]+)&sat=([^']+?)'\s*\)/;
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Param network id.
|
|
45
|
+
*
|
|
46
|
+
* @since 1.0.0
|
|
47
|
+
*/
|
|
48
|
+
export const paramNetworkId = /[?&]networkid=([^&#']*)/;
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Param sat.
|
|
52
|
+
*
|
|
53
|
+
* @since 1.0.0
|
|
54
|
+
*/
|
|
55
|
+
export const paramSat = /sat=([^&']*)/;
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Request path access sign in.
|
|
59
|
+
*
|
|
60
|
+
* @since 1.0.0
|
|
61
|
+
*/
|
|
62
|
+
export const requestPathAccessSignIn = /^(\/myhome\/)([0-9.-]+)(\/access\/signin\.jsp)$/;
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Request path access sign in e ns partner adt.
|
|
66
|
+
*
|
|
67
|
+
* @since 1.0.0
|
|
68
|
+
*/
|
|
69
|
+
export const requestPathAccessSignInENsPartnerAdt = /^(\/myhome\/)([0-9.-]+)(\/access\/signin\.jsp\?e=ns&partner=adt)$/;
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Request path access sign in network id xx partner adt.
|
|
73
|
+
*
|
|
74
|
+
* @since 1.0.0
|
|
75
|
+
*/
|
|
76
|
+
export const requestPathAccessSignInNetworkIdXxPartnerAdt = /^(\/myhome\/)([0-9.-]+)(\/access\/signin\.jsp)(\?networkid=[a-z0-9]+)(&partner=adt)$/;
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Request path ajax sync check serv t xx.
|
|
80
|
+
*
|
|
81
|
+
* @since 1.0.0
|
|
82
|
+
*/
|
|
83
|
+
export const requestPathAjaxSyncCheckServTXx = /^(\/myhome\/)([0-9.-]+)(\/Ajax\/SyncCheckServ\?t=\d+)$/;
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Request path keep alive.
|
|
87
|
+
*
|
|
88
|
+
* @since 1.0.0
|
|
89
|
+
*/
|
|
90
|
+
export const requestPathKeepAlive = /^(\/myhome\/)([0-9.-]+)(\/KeepAlive)$/;
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Request path mfa mfa sign in workflow challenge.
|
|
94
|
+
*
|
|
95
|
+
* @since 1.0.0
|
|
96
|
+
*/
|
|
97
|
+
export const requestPathMfaMfaSignInWorkflowChallenge = /^(\/myhome\/)([0-9.-]+)(\/mfa\/mfaSignIn\.jsp\?workflow=challenge)$/;
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Request path quick control arm disarm.
|
|
101
|
+
*
|
|
102
|
+
* @since 1.0.0
|
|
103
|
+
*/
|
|
104
|
+
export const requestPathQuickControlArmDisarm = /^(\/myhome\/)([0-9.-]+)(\/quickcontrol\/armDisarm\.jsp)$/;
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Request path quick control serv run rra command.
|
|
108
|
+
*
|
|
109
|
+
* @since 1.0.0
|
|
110
|
+
*/
|
|
111
|
+
export const requestPathQuickControlServRunRraCommand = /^(\/myhome\/)([0-9.-]+)(\/quickcontrol\/serv\/RunRRACommand)$/;
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Request path summary summary.
|
|
115
|
+
*
|
|
116
|
+
* @since 1.0.0
|
|
117
|
+
*/
|
|
118
|
+
export const requestPathSummarySummary = /^(\/myhome\/)([0-9.-]+)(\/summary\/summary\.jsp)$/;
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* Request path system device id 1.
|
|
122
|
+
*
|
|
123
|
+
* @since 1.0.0
|
|
124
|
+
*/
|
|
125
|
+
export const requestPathSystemDeviceId1 = /^(\/myhome\/)([0-9.-]+)(\/system\/device\.jsp\?id=1)$/;
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* Request path system gateway.
|
|
129
|
+
*
|
|
130
|
+
* @since 1.0.0
|
|
131
|
+
*/
|
|
132
|
+
export const requestPathSystemGateway = /^(\/myhome\/)([0-9.-]+)(\/system\/gateway\.jsp)$/;
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* Request path system system.
|
|
136
|
+
*
|
|
137
|
+
* @since 1.0.0
|
|
138
|
+
*/
|
|
139
|
+
export const requestPathSystemSystem = /^(\/myhome\/)([0-9.-]+)(\/system\/system\.jsp)$/;
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* Text orb sensor zone.
|
|
143
|
+
*
|
|
144
|
+
* @since 1.0.0
|
|
145
|
+
*/
|
|
146
|
+
export const textOrbSensorZone = /^(Zone )(.*)$/;
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* Text orb text summary.
|
|
150
|
+
*
|
|
151
|
+
* @since 1.0.0
|
|
152
|
+
*/
|
|
153
|
+
export const textOrbTextSummary = /^([A-Za-z0-9 ]+)\. ?([A-Za-z0-9 ]*)\.?$/;
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* Text panel emergency keys.
|
|
157
|
+
*
|
|
158
|
+
* @since 1.0.0
|
|
159
|
+
*/
|
|
160
|
+
export const textPanelEmergencyKeys = /([A-Za-z0-9]+: [A-Za-z0-9 ]+? \(Zone \d+\))/g;
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* Text sync code.
|
|
164
|
+
*
|
|
165
|
+
* @since 1.0.0
|
|
166
|
+
*/
|
|
167
|
+
export const textSyncCode = /^[0-9]+-[0-9]+-[0-9]+$/;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import z from 'zod';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Platform config.
|
|
5
|
+
*
|
|
6
|
+
* @since 1.0.0
|
|
7
|
+
*/
|
|
8
|
+
export const platformConfig = z.object({
|
|
9
|
+
platform: z.literal('ADTPulse'),
|
|
10
|
+
name: z.string().optional(),
|
|
11
|
+
subdomain: z.union([
|
|
12
|
+
z.literal('portal'),
|
|
13
|
+
z.literal('portal-ca'),
|
|
14
|
+
]),
|
|
15
|
+
username: z.string().min(1),
|
|
16
|
+
password: z.string().min(1),
|
|
17
|
+
fingerprint: z.string().min(1),
|
|
18
|
+
sensors: z.array(z.object({
|
|
19
|
+
name: z.string().optional(),
|
|
20
|
+
adtName: z.string().min(1),
|
|
21
|
+
adtType: z.union([
|
|
22
|
+
z.literal('co'),
|
|
23
|
+
z.literal('doorWindow'),
|
|
24
|
+
z.literal('fire'),
|
|
25
|
+
z.literal('flood'),
|
|
26
|
+
z.literal('glass'),
|
|
27
|
+
z.literal('motion'),
|
|
28
|
+
z.literal('temperature'),
|
|
29
|
+
]),
|
|
30
|
+
adtZone: z.number().finite(),
|
|
31
|
+
})).min(1),
|
|
32
|
+
pause: z.boolean().optional(),
|
|
33
|
+
reset: z.boolean().optional(),
|
|
34
|
+
});
|