@brandonarrindell/homebridge-envisalink 1.3.0
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/.eslintrc.json +38 -0
- package/.github/FUNDING.yml +2 -0
- package/.github/ISSUE_TEMPLATE/bug-report.md +44 -0
- package/.github/ISSUE_TEMPLATE/config.yml +5 -0
- package/.github/ISSUE_TEMPLATE/feature-request.md +23 -0
- package/.github/ISSUE_TEMPLATE/support-request.md +38 -0
- package/.github/dependabot.yml +9 -0
- package/.github/workflows/build.yml +31 -0
- package/LICENSE +21 -0
- package/README.md +207 -0
- package/config.schema.json +240 -0
- package/dist/configTypes.d.ts +39 -0
- package/dist/configTypes.d.ts.map +1 -0
- package/dist/configTypes.js +3 -0
- package/dist/configTypes.js.map +1 -0
- package/dist/constants.d.ts +4 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +7 -0
- package/dist/constants.js.map +1 -0
- package/dist/customCommandAccessory.d.ts +17 -0
- package/dist/customCommandAccessory.d.ts.map +1 -0
- package/dist/customCommandAccessory.js +51 -0
- package/dist/customCommandAccessory.js.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -0
- package/dist/networkScanner.d.ts +42 -0
- package/dist/networkScanner.d.ts.map +1 -0
- package/dist/networkScanner.js +191 -0
- package/dist/networkScanner.js.map +1 -0
- package/dist/nodeAlarmProxyTypes.d.ts +17 -0
- package/dist/nodeAlarmProxyTypes.d.ts.map +1 -0
- package/dist/nodeAlarmProxyTypes.js +3 -0
- package/dist/nodeAlarmProxyTypes.js.map +1 -0
- package/dist/panicAccessory.d.ts +23 -0
- package/dist/panicAccessory.d.ts.map +1 -0
- package/dist/panicAccessory.js +69 -0
- package/dist/panicAccessory.js.map +1 -0
- package/dist/partitionAccessory.d.ts +21 -0
- package/dist/partitionAccessory.d.ts.map +1 -0
- package/dist/partitionAccessory.js +202 -0
- package/dist/partitionAccessory.js.map +1 -0
- package/dist/platform.d.ts +58 -0
- package/dist/platform.d.ts.map +1 -0
- package/dist/platform.js +529 -0
- package/dist/platform.js.map +1 -0
- package/dist/settings.d.ts +9 -0
- package/dist/settings.d.ts.map +1 -0
- package/dist/settings.js +12 -0
- package/dist/settings.js.map +1 -0
- package/dist/types.d.ts +55 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +52 -0
- package/dist/types.js.map +1 -0
- package/dist/util.d.ts +8 -0
- package/dist/util.d.ts.map +1 -0
- package/dist/util.js +75 -0
- package/dist/util.js.map +1 -0
- package/dist/zoneAccessory.d.ts +19 -0
- package/dist/zoneAccessory.d.ts.map +1 -0
- package/dist/zoneAccessory.js +74 -0
- package/dist/zoneAccessory.js.map +1 -0
- package/docs/EnvisaLinkTPI-1-08.pdf +0 -0
- package/jest.config.ts +30 -0
- package/nodemon.json +12 -0
- package/package.json +69 -0
- package/src/configTypes.ts +43 -0
- package/src/constants.ts +3 -0
- package/src/customCommandAccessory.ts +52 -0
- package/src/index.ts +11 -0
- package/src/networkScanner.ts +211 -0
- package/src/nodeAlarmProxyTypes.ts +20 -0
- package/src/panicAccessory.ts +72 -0
- package/src/partitionAccessory.ts +219 -0
- package/src/platform.ts +544 -0
- package/src/settings.ts +9 -0
- package/src/types.ts +85 -0
- package/src/util.ts +75 -0
- package/src/zoneAccessory.ts +95 -0
- package/test/integration.spec.ts +121 -0
- package/test/networkScanner.spec.ts +283 -0
- package/test/util.spec.ts +106 -0
- package/tsconfig.json +27 -0
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EnvisalinkPartitionAccessory = void 0;
|
|
4
|
+
const platform_1 = require("./platform");
|
|
5
|
+
const constants_1 = require("./constants");
|
|
6
|
+
const types_1 = require("./types");
|
|
7
|
+
const CHIME_SERVICE_NAME = 'Chime';
|
|
8
|
+
const BYPASS_SERVICE_NAME = 'Bypass';
|
|
9
|
+
/**
|
|
10
|
+
* Platform Accessory
|
|
11
|
+
* An instance of this class is created for each accessory your platform registers
|
|
12
|
+
* Each accessory may expose multiple services of different service types.
|
|
13
|
+
*/
|
|
14
|
+
class EnvisalinkPartitionAccessory {
|
|
15
|
+
constructor(platform, accessory) {
|
|
16
|
+
this.platform = platform;
|
|
17
|
+
this.accessory = accessory;
|
|
18
|
+
this.partition = this.accessory.context;
|
|
19
|
+
this.platform.log.debug(`Setting accessory details for partition: ${JSON.stringify(this.partition, null, 2)}`);
|
|
20
|
+
this.bindAccessoryDetails();
|
|
21
|
+
this.bindSecurityPanel();
|
|
22
|
+
this.bindBypassSwitch(1);
|
|
23
|
+
this.bindChimeSwitch(2);
|
|
24
|
+
}
|
|
25
|
+
bindAccessoryDetails() {
|
|
26
|
+
const serialNumber = `Partition ${this.partition.number}`;
|
|
27
|
+
const infoService = this.accessory.getService(this.platform.Service.AccessoryInformation);
|
|
28
|
+
if (infoService) {
|
|
29
|
+
infoService.setCharacteristic(this.platform.Characteristic.Manufacturer, constants_1.MANUFACTURER)
|
|
30
|
+
.setCharacteristic(this.platform.Characteristic.Model, constants_1.MODEL)
|
|
31
|
+
.setCharacteristic(this.platform.Characteristic.SerialNumber, serialNumber);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
bindChimeSwitch(index) {
|
|
35
|
+
if (!this.partition.enableChimeSwitch) {
|
|
36
|
+
return false;
|
|
37
|
+
}
|
|
38
|
+
let chimeService = this.accessory.getService(CHIME_SERVICE_NAME);
|
|
39
|
+
if (!chimeService) {
|
|
40
|
+
const displayName = `${this.partition.name} ${CHIME_SERVICE_NAME}`;
|
|
41
|
+
chimeService = new this.platform.Service.Switch(displayName, CHIME_SERVICE_NAME);
|
|
42
|
+
chimeService.setCharacteristic(this.platform.Characteristic.Name, displayName);
|
|
43
|
+
chimeService.setCharacteristic(this.platform.Characteristic.ServiceLabelIndex, index);
|
|
44
|
+
this.accessory.addService(chimeService);
|
|
45
|
+
}
|
|
46
|
+
chimeService.getCharacteristic(this.platform.Characteristic.On)
|
|
47
|
+
.onSet(this.setChimeActive.bind(this));
|
|
48
|
+
chimeService.updateCharacteristic(this.platform.Characteristic.On, this.partition.chimeActive === undefined ? false : this.partition.chimeActive);
|
|
49
|
+
}
|
|
50
|
+
bindBypassSwitch(index) {
|
|
51
|
+
let bypassService = this.accessory.getService(BYPASS_SERVICE_NAME);
|
|
52
|
+
if (!bypassService) {
|
|
53
|
+
const displayName = `${this.partition.name} ${BYPASS_SERVICE_NAME}`;
|
|
54
|
+
bypassService = new this.platform.Service.Switch(displayName, BYPASS_SERVICE_NAME);
|
|
55
|
+
bypassService.setCharacteristic(this.platform.Characteristic.Name, displayName);
|
|
56
|
+
bypassService.setCharacteristic(this.platform.Characteristic.ServiceLabelIndex, index);
|
|
57
|
+
this.accessory.addService(bypassService);
|
|
58
|
+
}
|
|
59
|
+
bypassService.getCharacteristic(this.platform.Characteristic.On)
|
|
60
|
+
.onSet(this.setBypassActive.bind(this));
|
|
61
|
+
bypassService.updateCharacteristic(this.platform.Characteristic.On, this.partition.bypassEnabled === undefined ? false : this.partition.bypassEnabled);
|
|
62
|
+
}
|
|
63
|
+
async setChimeActive(value) {
|
|
64
|
+
try {
|
|
65
|
+
this.platform.log.debug(`setChimeActive to ${value} for partition ${this.partition.number}`);
|
|
66
|
+
await this.platform.sendAlarmCommand(`071${this.partition.number}*4`);
|
|
67
|
+
this.platform.log.debug('setChimeActive complete.');
|
|
68
|
+
}
|
|
69
|
+
catch (error) {
|
|
70
|
+
this.platform.log.error(`Failed setting chime active to ${value}`, error);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
async setBypassActive(value) {
|
|
74
|
+
try {
|
|
75
|
+
this.platform.log.info(`setBypassActive to ${value} for partition ${this.partition.number}`);
|
|
76
|
+
this.partition.bypassEnabled = value;
|
|
77
|
+
this.platform.log.debug('setBypassActive complete.');
|
|
78
|
+
}
|
|
79
|
+
catch (error) {
|
|
80
|
+
this.platform.log.error(`Failed setting setBypassActive active to ${value}`, error);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
bindSecurityPanel() {
|
|
84
|
+
const service = this.accessory.getService(this.platform.Service.SecuritySystem)
|
|
85
|
+
|| this.accessory.addService(this.platform.Service.SecuritySystem);
|
|
86
|
+
service.setCharacteristic(this.platform.Characteristic.Name, this.partition.name);
|
|
87
|
+
let currentState = undefined;
|
|
88
|
+
let targetState = undefined;
|
|
89
|
+
let obstructionDetected = false;
|
|
90
|
+
this.platform.log.debug(`Partition ${this.partition.number}: ${this.partition.status.text}, ` +
|
|
91
|
+
`mode: ${this.partition.status.mode}.`);
|
|
92
|
+
switch (this.partition.status.text) {
|
|
93
|
+
case 'alarm':
|
|
94
|
+
currentState = this.platform.Characteristic.SecuritySystemCurrentState.ALARM_TRIGGERED;
|
|
95
|
+
break;
|
|
96
|
+
case 'partialclosing':
|
|
97
|
+
case 'specialclosing':
|
|
98
|
+
case 'chimedisabled':
|
|
99
|
+
case 'chimeenabled':
|
|
100
|
+
this.platform.log.debug(`Ignoring status ${this.partition.status.text}. Waiting for armed/armedbypass`);
|
|
101
|
+
break;
|
|
102
|
+
case 'armed':
|
|
103
|
+
case 'armedbypass':
|
|
104
|
+
case 'userclosing':
|
|
105
|
+
if (types_1.PartitionMode.Stay === this.partition.status.mode) {
|
|
106
|
+
currentState = this.platform.Characteristic.SecuritySystemCurrentState.STAY_ARM;
|
|
107
|
+
targetState = this.platform.Characteristic.SecuritySystemTargetState.STAY_ARM;
|
|
108
|
+
}
|
|
109
|
+
else if (types_1.PartitionMode.StayZeroEntry === this.partition.status.mode) {
|
|
110
|
+
currentState = this.platform.Characteristic.SecuritySystemCurrentState.NIGHT_ARM;
|
|
111
|
+
targetState = this.platform.Characteristic.SecuritySystemTargetState.NIGHT_ARM;
|
|
112
|
+
}
|
|
113
|
+
else {
|
|
114
|
+
currentState = this.platform.Characteristic.SecuritySystemCurrentState.AWAY_ARM;
|
|
115
|
+
targetState = this.platform.Characteristic.SecuritySystemTargetState.AWAY_ARM;
|
|
116
|
+
}
|
|
117
|
+
break;
|
|
118
|
+
case 'disarmed':
|
|
119
|
+
case 'notready':
|
|
120
|
+
case 'failedtoarm':
|
|
121
|
+
case 'useropening':
|
|
122
|
+
case 'specialopening':
|
|
123
|
+
currentState = this.platform.Characteristic.SecuritySystemCurrentState.DISARMED;
|
|
124
|
+
targetState = this.platform.Characteristic.SecuritySystemTargetState.DISARM;
|
|
125
|
+
obstructionDetected = true;
|
|
126
|
+
break;
|
|
127
|
+
case 'exitdelay':
|
|
128
|
+
case 'entrydelay':
|
|
129
|
+
case 'arming':
|
|
130
|
+
case 'busy':
|
|
131
|
+
case 'troubleledoff':
|
|
132
|
+
break;
|
|
133
|
+
case 'troubleledon':
|
|
134
|
+
this.platform.log.info(`Ignoring status '${this.partition.status.text}' (${this.partition.status.description})`);
|
|
135
|
+
break;
|
|
136
|
+
case 'ready':
|
|
137
|
+
case 'readyforce':
|
|
138
|
+
currentState = this.platform.Characteristic.SecuritySystemCurrentState.DISARMED;
|
|
139
|
+
targetState = this.platform.Characteristic.SecuritySystemTargetState.DISARM;
|
|
140
|
+
break;
|
|
141
|
+
default:
|
|
142
|
+
// If we do not recognise the security panel state then we should not assume
|
|
143
|
+
// that status is DISARMED. Leave it unchanged and log warning message. With
|
|
144
|
+
// luck user will report this and provide debug trace.
|
|
145
|
+
this.platform.log.warn(`Ignoring status '${this.partition.status.text}' (${this.partition.status.description})${platform_1.REPORT_ERROR_TXT}`);
|
|
146
|
+
}
|
|
147
|
+
if (currentState !== undefined) {
|
|
148
|
+
this.partition.currentState = currentState;
|
|
149
|
+
this.platform.log.debug(`Setting current state to ${currentState}`);
|
|
150
|
+
service.updateCharacteristic(this.platform.Characteristic.SecuritySystemCurrentState, this.partition.currentState);
|
|
151
|
+
}
|
|
152
|
+
if (targetState !== undefined) {
|
|
153
|
+
this.partition.targetState = targetState;
|
|
154
|
+
this.platform.log.debug(`Setting target state to ${currentState}`);
|
|
155
|
+
service.updateCharacteristic(this.platform.Characteristic.SecuritySystemTargetState, this.partition.targetState);
|
|
156
|
+
}
|
|
157
|
+
service.updateCharacteristic(this.platform.Characteristic.ObstructionDetected, obstructionDetected);
|
|
158
|
+
service.getCharacteristic(this.platform.Characteristic.SecuritySystemTargetState)
|
|
159
|
+
.onSet(this.setPanelState.bind(this));
|
|
160
|
+
}
|
|
161
|
+
async setPanelState(value) {
|
|
162
|
+
try {
|
|
163
|
+
this.platform.log.debug(`setPanelState to ${value} for partition ${this.partition.number}`);
|
|
164
|
+
let command = undefined;
|
|
165
|
+
let arming = true;
|
|
166
|
+
switch (value) {
|
|
167
|
+
case this.platform.Characteristic.SecuritySystemCurrentState.DISARMED:
|
|
168
|
+
this.partition.targetState = this.platform.Characteristic.SecuritySystemTargetState.DISARM;
|
|
169
|
+
arming = false;
|
|
170
|
+
command = `040${this.partition.number}${this.partition.pin}`;
|
|
171
|
+
break;
|
|
172
|
+
case this.platform.Characteristic.SecuritySystemCurrentState.STAY_ARM:
|
|
173
|
+
this.partition.targetState = this.platform.Characteristic.SecuritySystemTargetState.STAY_ARM;
|
|
174
|
+
command = `031${this.partition.number}`;
|
|
175
|
+
break;
|
|
176
|
+
case this.platform.Characteristic.SecuritySystemCurrentState.NIGHT_ARM:
|
|
177
|
+
this.partition.targetState = this.platform.Characteristic.SecuritySystemTargetState.NIGHT_ARM;
|
|
178
|
+
command = `032${this.partition.number}`;
|
|
179
|
+
break;
|
|
180
|
+
case this.platform.Characteristic.SecuritySystemCurrentState.AWAY_ARM:
|
|
181
|
+
this.partition.targetState = this.platform.Characteristic.SecuritySystemTargetState.AWAY_ARM;
|
|
182
|
+
command = `030${this.partition.number}`;
|
|
183
|
+
break;
|
|
184
|
+
}
|
|
185
|
+
if (command === undefined) {
|
|
186
|
+
this.platform.log.error(`Unhandled alarm state ${value}. Ignoring command.`);
|
|
187
|
+
return;
|
|
188
|
+
}
|
|
189
|
+
if (arming && this.partition.bypassEnabled) {
|
|
190
|
+
await this.platform.bypassAllOpenZones(this.partition.number);
|
|
191
|
+
}
|
|
192
|
+
this.platform.setLastPartitionAction(this.partition);
|
|
193
|
+
await this.platform.sendAlarmCommand(command);
|
|
194
|
+
this.platform.log.debug(`Successfully set alarm panel state to ${value} on partition ${this.partition.number}`);
|
|
195
|
+
}
|
|
196
|
+
catch (error) {
|
|
197
|
+
this.platform.log.error(`Failed setting panel state to ${value}`, error);
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
exports.EnvisalinkPartitionAccessory = EnvisalinkPartitionAccessory;
|
|
202
|
+
//# sourceMappingURL=partitionAccessory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"partitionAccessory.js","sourceRoot":"","sources":["../src/partitionAccessory.ts"],"names":[],"mappings":";;;AAEA,yCAA0E;AAC1E,2CAAgD;AAChD,mCAAiD;AAEjD,MAAM,kBAAkB,GAAG,OAAO,CAAC;AACnC,MAAM,mBAAmB,GAAG,QAAQ,CAAC;AAErC;;;;GAIG;AACH,MAAa,4BAA4B;IAGrC,YACqB,QAAsC,EACtC,SAA4B;QAD5B,aAAQ,GAAR,QAAQ,CAA8B;QACtC,cAAS,GAAT,SAAS,CAAmB;QAG7C,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC,OAAoB,CAAC;QAErD,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,4CAA4C,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;QAE/G,IAAI,CAAC,oBAAoB,EAAE,CAAC;QAC5B,IAAI,CAAC,iBAAiB,EAAE,CAAC;QACzB,IAAI,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC;QACzB,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC;IAC5B,CAAC;IAED,oBAAoB;QA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AAC,WAAW,GAAG,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC,yBAAyB,CAAC,QAAQ,CAAC;oBAC7F,OAAO,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,CAAC;oBACxC,MAAM;aACb;YAED,IAAI,OAAO,KAAK,SAAS,EAAE;gBACvB,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,yBAAyB,KAAK,qBAAqB,CAAC,CAAC;gBAC7E,OAAO;aACV;YACD,IAAI,MAAM,IAAI,IAAI,CAAC,SAAS,CAAC,aAAa,EAAE;gBACxC,MAAM,IAAI,CAAC,QAAQ,CAAC,kBAAkB,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;aACjE;YAED,IAAI,CAAC,QAAQ,CAAC,sBAAsB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;YACrD,MAAM,IAAI,CAAC,QAAQ,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC;YAC9C,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,yCAAyC,KAAK,iBAAiB,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,CAAC,CAAC;SACnH;QAAC,OAAO,KAAK,EAAE;YACZ,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,iCAAiC,KAAK,EAAE,EAAE,KAAK,CAAC,CAAC;SAC5E;IACL,CAAC;CACJ;AA5MD,oEA4MC"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { API as HomebridgeAPI, Characteristic, DynamicPlatformPlugin, Logger, PlatformAccessory, PlatformConfig, Service } from 'homebridge';
|
|
2
|
+
import { EnvisalinkConfig } from './configTypes';
|
|
3
|
+
import { Partition, PartitionStatus, Zone } from './types';
|
|
4
|
+
export declare const REPORT_ERROR_TXT: string;
|
|
5
|
+
/**
|
|
6
|
+
* HomebridgePlatform
|
|
7
|
+
* This class is the main constructor for your plugin, this is where you should
|
|
8
|
+
* parse the user config and discover/register accessories with Homebridge.
|
|
9
|
+
*/
|
|
10
|
+
export declare class EnvisalinkHomebridgePlatform implements DynamicPlatformPlugin {
|
|
11
|
+
readonly log: Logger;
|
|
12
|
+
readonly config: PlatformConfig;
|
|
13
|
+
readonly api: HomebridgeAPI;
|
|
14
|
+
readonly Service: typeof Service;
|
|
15
|
+
readonly Characteristic: typeof Characteristic;
|
|
16
|
+
readonly accessories: Map<string, PlatformAccessory>;
|
|
17
|
+
private alarm?;
|
|
18
|
+
private zoneConfigs;
|
|
19
|
+
private chimeInitialized;
|
|
20
|
+
private lastPartitionAction?;
|
|
21
|
+
constructor(log: Logger, config: PlatformConfig, api: HomebridgeAPI);
|
|
22
|
+
/**
|
|
23
|
+
* This function is invoked when homebridge restores cached accessories from disk at startup.
|
|
24
|
+
* It should be used to setup event handlers for characteristics and update respective values.
|
|
25
|
+
*/
|
|
26
|
+
configureAccessory(accessory: PlatformAccessory): void;
|
|
27
|
+
handleDisconnect(): Promise<void>;
|
|
28
|
+
resetConnection(err: any): Promise<void>;
|
|
29
|
+
initializeNodeAlarmProxy(partitionCount: number, zoneCount: number): any;
|
|
30
|
+
discoverCustomCommandAccessories(): void;
|
|
31
|
+
discoverPanicAccessories(): void;
|
|
32
|
+
setTime(): Promise<void>;
|
|
33
|
+
updateZoneAccessory(zone: Zone): void;
|
|
34
|
+
bypassAllOpenZones(partition: number): Promise<void>;
|
|
35
|
+
getPartitionStatus(partitionNumber: number): PartitionStatus;
|
|
36
|
+
updatePartitionAccessory(partition: Partition): void;
|
|
37
|
+
dataUpdate(data: any): void;
|
|
38
|
+
partitionUpdate(data: any): void;
|
|
39
|
+
setPartitionStatus(partitionNumber: number, statusCode: string): void;
|
|
40
|
+
partitionUserUpdate(data: any): void;
|
|
41
|
+
zoneUpdate(data: any): void;
|
|
42
|
+
/**
|
|
43
|
+
* Haven't actually seen this fire yet. Log it to see if we need to handle.
|
|
44
|
+
* @param data
|
|
45
|
+
*/
|
|
46
|
+
systemUpdate(data: any): void;
|
|
47
|
+
codeRequired(): Promise<void>;
|
|
48
|
+
json(data: any): string;
|
|
49
|
+
getConfig(): EnvisalinkConfig;
|
|
50
|
+
setLastPartitionAction(partition: Partition): void;
|
|
51
|
+
sleep(millis: number): Promise<void>;
|
|
52
|
+
sendAlarmCommand(command: string, waitForReadyPartition?: number, waitForStatusCodes?: Set<string>): Promise<void>;
|
|
53
|
+
/**
|
|
54
|
+
* Discover Envisalink device on the network
|
|
55
|
+
*/
|
|
56
|
+
private discoverEnvisalinkDevice;
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=platform.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"platform.d.ts","sourceRoot":"","sources":["../src/platform.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,GAAG,IAAI,aAAa,EACpB,cAAc,EACd,qBAAqB,EACrB,MAAM,EACN,iBAAiB,EACjB,cAAc,EACd,OAAO,EACV,MAAM,YAAY,CAAC;AAKpB,OAAO,EAAC,gBAAgB,EAAa,MAAM,eAAe,CAAC;AAO3D,OAAO,EAAqD,SAAS,EAAE,eAAe,EAAE,IAAI,EAAC,MAAM,SAAS,CAAC;AAW7G,eAAO,MAAM,gBAAgB,QAA+D,CAAC;AAQ7F;;;;GAIG;AACH,qBAAa,4BAA6B,YAAW,qBAAqB;aAalD,GAAG,EAAE,MAAM;aACX,MAAM,EAAE,cAAc;aACtB,GAAG,EAAE,aAAa;IAdtC,SAAgB,OAAO,EAAE,OAAO,OAAO,CAAwB;IAC/D,SAAgB,cAAc,EAAE,OAAO,cAAc,CAA+B;IAGpF,SAAgB,WAAW,EAAE,GAAG,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAa;IAExE,OAAO,CAAC,KAAK,CAAC,CAAiB;IAC/B,OAAO,CAAC,WAAW,CAA0B;IAC7C,OAAO,CAAC,gBAAgB,CAAS;IACjC,OAAO,CAAC,mBAAmB,CAAC,CAAY;gBAGpB,GA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