dsc-itv2-client 2.0.0 ā 2.0.1
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/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsc-itv2-client",
|
|
3
3
|
"author": "fajitacat",
|
|
4
|
-
"version": "2.0.
|
|
4
|
+
"version": "2.0.1",
|
|
5
5
|
"description": "Reverse engineered DSC ITV2 Protocol Client Library for TL280/TL280E - Monitor and control DSC Neo alarm panels with real-time zone/partition status, arming, and trouble detail",
|
|
6
6
|
"main": "src/index.js",
|
|
7
7
|
"type": "module",
|
package/src/ITV2Client.js
CHANGED
|
@@ -566,6 +566,9 @@ export class ITV2Client extends EventEmitter {
|
|
|
566
566
|
case CMD.TROUBLE_DETAIL:
|
|
567
567
|
this._handleTroubleDetail(parsed);
|
|
568
568
|
break;
|
|
569
|
+
case CMD.NOTIFICATION_EXIT_DELAY:
|
|
570
|
+
this._handleExitDelayNotification(parsed);
|
|
571
|
+
break;
|
|
569
572
|
case CMD.NOTIFICATION_ARMING:
|
|
570
573
|
this._handleArmingNotification(parsed);
|
|
571
574
|
break;
|
|
@@ -1251,6 +1254,45 @@ export class ITV2Client extends EventEmitter {
|
|
|
1251
1254
|
|
|
1252
1255
|
// ==================== Notification Handlers ====================
|
|
1253
1256
|
|
|
1257
|
+
_handleExitDelayNotification(parsed) {
|
|
1258
|
+
// 0x0230 NotificationExitDelay (from neohub):
|
|
1259
|
+
// [CompactInt:Partition][DelayFlags:1B][CompactInt:DurationInSeconds]
|
|
1260
|
+
// Flags: 0x01=Audible, 0x02=Restarted, 0x04=Urgency, 0x80=Active
|
|
1261
|
+
const fullPayload = this._reconstructPayload(parsed);
|
|
1262
|
+
if (!fullPayload || fullPayload.length < 4) {
|
|
1263
|
+
this._ack();
|
|
1264
|
+
return;
|
|
1265
|
+
}
|
|
1266
|
+
|
|
1267
|
+
try {
|
|
1268
|
+
let offset = 0;
|
|
1269
|
+
const partition = ITv2Session.decodeVarBytes(fullPayload, offset);
|
|
1270
|
+
offset += partition.bytesRead;
|
|
1271
|
+
const flags = fullPayload[offset++];
|
|
1272
|
+
const duration = ITv2Session.decodeVarBytes(fullPayload, offset);
|
|
1273
|
+
|
|
1274
|
+
const active = !!(flags & 0x80);
|
|
1275
|
+
const audible = !!(flags & 0x01);
|
|
1276
|
+
const restarted = !!(flags & 0x02);
|
|
1277
|
+
const urgent = !!(flags & 0x04);
|
|
1278
|
+
|
|
1279
|
+
this._logMinimal(`[Partition ${partition.value}] Exit delay: ${duration.value}s${active ? ' ACTIVE' : ' ENDED'}${audible ? ' (audible)' : ''}`);
|
|
1280
|
+
|
|
1281
|
+
this.emit('partition:exitDelay', {
|
|
1282
|
+
partition: partition.value,
|
|
1283
|
+
duration: duration.value,
|
|
1284
|
+
active,
|
|
1285
|
+
audible,
|
|
1286
|
+
restarted,
|
|
1287
|
+
urgent,
|
|
1288
|
+
});
|
|
1289
|
+
} catch (e) {
|
|
1290
|
+
this._log(`[Exit Delay] Parse error: ${e.message}`);
|
|
1291
|
+
}
|
|
1292
|
+
|
|
1293
|
+
this._ack();
|
|
1294
|
+
}
|
|
1295
|
+
|
|
1254
1296
|
_handleArmingNotification(parsed) {
|
|
1255
1297
|
// NotificationArmDisarm (neohub format, IMessageData NOT CommandMessageBase):
|
|
1256
1298
|
// [CompactInt:Partition][ArmMode:1B][Method:1B][CompactInt:UserId]
|
|
@@ -1287,6 +1329,13 @@ export class ITV2Client extends EventEmitter {
|
|
|
1287
1329
|
method,
|
|
1288
1330
|
userId,
|
|
1289
1331
|
});
|
|
1332
|
+
|
|
1333
|
+
// Convenience events
|
|
1334
|
+
if (armMode === 0) {
|
|
1335
|
+
this.emit('partition:disarmed', partition.value);
|
|
1336
|
+
} else {
|
|
1337
|
+
this.emit('partition:armed', partition.value, modeName);
|
|
1338
|
+
}
|
|
1290
1339
|
} catch (e) {
|
|
1291
1340
|
this._log(`[Arming Notification] Parse error: ${e.message}`);
|
|
1292
1341
|
}
|
|
@@ -56,14 +56,9 @@ client.on('zone:closed', (zone) => {
|
|
|
56
56
|
if (sessionEstablished) rl.prompt();
|
|
57
57
|
});
|
|
58
58
|
|
|
59
|
-
// Partition events
|
|
60
|
-
client.on('partition:
|
|
61
|
-
console.log(`\nš”ļø Partition ${partition}
|
|
62
|
-
if (sessionEstablished) rl.prompt();
|
|
63
|
-
});
|
|
64
|
-
|
|
65
|
-
client.on('partition:disarmed', (partition) => {
|
|
66
|
-
console.log(`\nš Partition ${partition} DISARMED`);
|
|
59
|
+
// Partition events
|
|
60
|
+
client.on('partition:arming', ({ partition, modeName }) => {
|
|
61
|
+
console.log(`\nš”ļø Partition ${partition}: ${modeName}`);
|
|
67
62
|
if (sessionEstablished) rl.prompt();
|
|
68
63
|
});
|
|
69
64
|
|
package/src/itv2-session.js
CHANGED
|
@@ -107,8 +107,8 @@ export const CMD = {
|
|
|
107
107
|
NOTIFICATION_PARTITION_READY: 0x0239,
|
|
108
108
|
NOTIFICATION_PARTITION_TROUBLE: 0x023F,
|
|
109
109
|
ZONE_ALARM_STATUS: 0x0840,
|
|
110
|
-
//
|
|
111
|
-
|
|
110
|
+
// Notification events
|
|
111
|
+
NOTIFICATION_EXIT_DELAY: 0x0230,
|
|
112
112
|
DATA_UPDATE_NOTIFICATION: 0x0231,
|
|
113
113
|
};
|
|
114
114
|
|