isy-nodejs 0.5.0-beta.55 → 0.5.0-beta.57
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/lib/Devices/ISYDevice.js +1 -2
- package/lib/ISY.d.ts +2 -0
- package/lib/ISY.js +28 -4
- package/lib/ISYNode.d.ts +2 -1
- package/lib/ISYNode.js +4 -3
- package/package.json +9 -1
- package/.babelrc +0 -12
- package/.travis.yml +0 -8
- package/ISYNodesDump.json +0 -1368
- package/isySampleOutput/config.json +0 -1825
- package/scratch.js +0 -95
- package/src/Categories.ts +0 -19
- package/src/Devices/DeviceFactory.ts +0 -20
- package/src/Devices/Elk/ElkAlarmPanelDevice.ts +0 -190
- package/src/Devices/Elk/ElkAlarmSensorDevice.ts +0 -104
- package/src/Devices/ISYDevice.ts +0 -282
- package/src/Devices/Insteon/InsteonBallastDimmerDevice.ts +0 -6
- package/src/Devices/Insteon/InsteonBaseDevice.ts +0 -43
- package/src/Devices/Insteon/InsteonCOSensorDevice.ts +0 -12
- package/src/Devices/Insteon/InsteonDeviceFactory.ts +0 -823
- package/src/Devices/Insteon/InsteonDimmableDevice.ts +0 -16
- package/src/Devices/Insteon/InsteonDimmerOutletDevice.ts +0 -7
- package/src/Devices/Insteon/InsteonDimmerSwitchDevice.ts +0 -8
- package/src/Devices/Insteon/InsteonDoorWindowSensorDevice.ts +0 -12
- package/src/Devices/Insteon/InsteonFanDevice.ts +0 -73
- package/src/Devices/Insteon/InsteonKeypadDevice.ts +0 -9
- package/src/Devices/Insteon/InsteonKeypadDimmerDevice.ts +0 -10
- package/src/Devices/Insteon/InsteonKeypadRelayDevice.ts +0 -7
- package/src/Devices/Insteon/InsteonLeakSensorDevice.ts +0 -12
- package/src/Devices/Insteon/InsteonLockDevice.ts +0 -42
- package/src/Devices/Insteon/InsteonMotionSensorDevice.ts +0 -43
- package/src/Devices/Insteon/InsteonOnOffOutletDevice.ts +0 -22
- package/src/Devices/Insteon/InsteonRelayDevice.ts +0 -21
- package/src/Devices/Insteon/InsteonRelaySwitchDevice.ts +0 -8
- package/src/Devices/Insteon/InsteonSmokeSensorDevice.ts +0 -12
- package/src/Devices/Insteon/InsteonThermostatDevice.ts +0 -39
- package/src/Devices/Insteon/insteondevice.ts +0 -41
- package/src/Events/EventType.ts +0 -27
- package/src/Events/ISYEvent.ts +0 -9
- package/src/Events/NodeEvent.ts +0 -9
- package/src/Events/PropertyChangedEvent.ts +0 -11
- package/src/Families.ts +0 -30
- package/src/ISY.ts +0 -768
- package/src/ISYConstants.ts +0 -182
- package/src/ISYNode.ts +0 -195
- package/src/ISYScene.ts +0 -120
- package/src/ISYVariable.ts +0 -49
- package/src/isyproductinfo.json +0 -378
- package/src/utils.ts +0 -108
- package/test/testsuite.js +0 -607
- package/tsconfig.json +0 -27
- package/tslint.json +0 -28
package/lib/Devices/ISYDevice.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2
2
|
exports.ISYUpdateableLevelDevice = exports.ISYLevelDevice = exports.ISYUpdateableBinaryStateDevice = exports.ISYBinaryStateDevice = exports.ISYDevice = void 0;
|
|
3
|
-
const util_1 = require("util");
|
|
4
3
|
const ISY_1 = require("../ISY");
|
|
5
4
|
const ISYConstants_1 = require("../ISYConstants");
|
|
6
5
|
const ISYNode_1 = require("../ISYNode");
|
|
@@ -26,7 +25,7 @@ class ISYDevice extends ISYNode_1.ISYNode {
|
|
|
26
25
|
if (this.parentAddress !== this.address &&
|
|
27
26
|
this.parentAddress !== undefined) {
|
|
28
27
|
this._parentDevice = isy.getDevice(this.parentAddress);
|
|
29
|
-
if (
|
|
28
|
+
if (this._parentDevice != null) {
|
|
30
29
|
this._parentDevice.addChild(this);
|
|
31
30
|
}
|
|
32
31
|
}
|
package/lib/ISY.d.ts
CHANGED
|
@@ -110,6 +110,8 @@ export declare class ISY extends EventEmitter {
|
|
|
110
110
|
data: any;
|
|
111
111
|
}): void;
|
|
112
112
|
initializeWebSocket(): void;
|
|
113
|
+
shutdown(): void;
|
|
114
|
+
private closeWebSocket;
|
|
113
115
|
getDevice(address: string, parentsOnly?: boolean): ISYDevice<any>;
|
|
114
116
|
getScene(address: string | number): any;
|
|
115
117
|
sendISYCommand(path: string): Promise<any>;
|
package/lib/ISY.js
CHANGED
|
@@ -390,6 +390,9 @@ class ISY extends events_1.EventEmitter {
|
|
|
390
390
|
device = child;
|
|
391
391
|
}
|
|
392
392
|
}
|
|
393
|
+
if (device === null || device === undefined) {
|
|
394
|
+
continue;
|
|
395
|
+
}
|
|
393
396
|
if (Array.isArray(node.property)) {
|
|
394
397
|
for (let prop of node.property) {
|
|
395
398
|
device[prop.id] = device.convertFrom(prop.value, prop.uom);
|
|
@@ -530,8 +533,9 @@ class ISY extends events_1.EventEmitter {
|
|
|
530
533
|
});
|
|
531
534
|
}
|
|
532
535
|
initializeWebSocket() {
|
|
536
|
+
this.closeWebSocket();
|
|
533
537
|
const that = this;
|
|
534
|
-
const auth = `Basic ${
|
|
538
|
+
const auth = `Basic ${Buffer.from(`${this.credentials.username}:${this.credentials.password}`).toString('base64')}`;
|
|
535
539
|
that.logger(`Connecting to: ${this.wsprotocol}://${this.address}/rest/subscribe`);
|
|
536
540
|
this.webSocket = new faye_websocket_1.Client(`${this.wsprotocol}://${this.address}/rest/subscribe`, ['ISYSUB'], {
|
|
537
541
|
headers: {
|
|
@@ -551,17 +555,37 @@ class ISY extends events_1.EventEmitter {
|
|
|
551
555
|
})
|
|
552
556
|
.on('fail', (data, response) => {
|
|
553
557
|
that.logger(`Websocket subscription failure: ${data}`);
|
|
554
|
-
|
|
558
|
+
that.closeWebSocket();
|
|
555
559
|
})
|
|
556
560
|
.on('abort', () => {
|
|
557
561
|
that.logger('Websocket subscription aborted.');
|
|
558
|
-
|
|
562
|
+
that.closeWebSocket();
|
|
559
563
|
})
|
|
560
564
|
.on('timeout', (ms) => {
|
|
561
565
|
that.logger(`Websocket subscription timed out after ${ms} milliseconds.`);
|
|
562
|
-
|
|
566
|
+
that.closeWebSocket();
|
|
563
567
|
});
|
|
564
568
|
}
|
|
569
|
+
shutdown() {
|
|
570
|
+
if (this.guardianTimer) {
|
|
571
|
+
clearInterval(this.guardianTimer);
|
|
572
|
+
this.guardianTimer = undefined;
|
|
573
|
+
}
|
|
574
|
+
this.closeWebSocket();
|
|
575
|
+
}
|
|
576
|
+
closeWebSocket() {
|
|
577
|
+
if (!this.webSocket) {
|
|
578
|
+
return;
|
|
579
|
+
}
|
|
580
|
+
const webSocket = this.webSocket;
|
|
581
|
+
this.webSocket = undefined;
|
|
582
|
+
try {
|
|
583
|
+
webSocket.close();
|
|
584
|
+
}
|
|
585
|
+
catch (error) {
|
|
586
|
+
this.logger(`Websocket close failed: ${error}`);
|
|
587
|
+
}
|
|
588
|
+
}
|
|
565
589
|
getDevice(address, parentsOnly = false) {
|
|
566
590
|
let s = this.deviceList.get(address);
|
|
567
591
|
if (!parentsOnly) {
|
package/lib/ISYNode.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import { EventEmitter } from 'events';
|
|
3
3
|
import { Family } from './Families';
|
|
4
|
-
import {
|
|
4
|
+
import { NodeType } from './ISYConstants';
|
|
5
|
+
import type { ISY } from './ISY';
|
|
5
6
|
import { PropertyChangedEventEmitter } from './Utils';
|
|
6
7
|
export declare class ISYNode extends EventEmitter implements PropertyChangedEventEmitter {
|
|
7
8
|
readonly isy: ISY;
|
package/lib/ISYNode.js
CHANGED
|
@@ -2,7 +2,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
2
2
|
exports.ISYNode = void 0;
|
|
3
3
|
const events_1 = require("events");
|
|
4
4
|
const Families_1 = require("./Families");
|
|
5
|
-
const
|
|
5
|
+
const ISYConstants_1 = require("./ISYConstants");
|
|
6
6
|
class ISYNode extends events_1.EventEmitter {
|
|
7
7
|
constructor(isy, node) {
|
|
8
8
|
var _a, _b;
|
|
@@ -24,7 +24,7 @@ class ISYNode extends events_1.EventEmitter {
|
|
|
24
24
|
//if (s.length > 1)
|
|
25
25
|
//s.shift();
|
|
26
26
|
this.baseDisplayName = s.join(' ').replace(/([A-Z])/g, ' $1').replace(' ', ' ').replace(' ', ' ').trim();
|
|
27
|
-
if (this.parentType ===
|
|
27
|
+
if (this.parentType === ISYConstants_1.NodeType.Folder) {
|
|
28
28
|
this.folder = isy.folderMap.get(this.parent._);
|
|
29
29
|
isy.logger(`${this.name} this node is in folder ${this.folder}`);
|
|
30
30
|
this.logger = (msg) => {
|
|
@@ -78,7 +78,8 @@ class ISYNode extends events_1.EventEmitter {
|
|
|
78
78
|
else {
|
|
79
79
|
// this.logger(event.control);
|
|
80
80
|
const e = event.control;
|
|
81
|
-
const
|
|
81
|
+
const { Controls } = require('./ISY');
|
|
82
|
+
const dispName = Controls[e];
|
|
82
83
|
if (dispName !== undefined && dispName !== null) {
|
|
83
84
|
this.logger(`Command ${dispName.label} (${e}) triggered.`);
|
|
84
85
|
}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "isy-nodejs",
|
|
3
3
|
"description": "Javascript wrapper for ISY interface including websockets for change notifications. Fork of isy-js by Rod Toll. Designed to be used in a node.js application.",
|
|
4
4
|
"license": "MIT",
|
|
5
|
-
"version": "0.5.0-beta.
|
|
5
|
+
"version": "0.5.0-beta.57",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "Rod Toll & Pradeep Mouli",
|
|
8
8
|
"email": "rod_toll@hotmail.com"
|
|
@@ -19,6 +19,11 @@
|
|
|
19
19
|
"ZWave"
|
|
20
20
|
],
|
|
21
21
|
"main": "./lib/ISY.js",
|
|
22
|
+
"files": [
|
|
23
|
+
"lib",
|
|
24
|
+
"LICENSE",
|
|
25
|
+
"README.md"
|
|
26
|
+
],
|
|
22
27
|
"devDependencies": {
|
|
23
28
|
"@types/node": "^10.17.15",
|
|
24
29
|
"@types/xml2js": "^0.4.5",
|
|
@@ -42,5 +47,8 @@
|
|
|
42
47
|
"repository": {
|
|
43
48
|
"type": "git",
|
|
44
49
|
"url": "https://github.com/pradeepmouli/isy-js.git"
|
|
50
|
+
},
|
|
51
|
+
"engines": {
|
|
52
|
+
"node": "^22.12.0 || ^24.0.0"
|
|
45
53
|
}
|
|
46
54
|
}
|
package/.babelrc
DELETED