isy-nodejs 1.0.1-alpha.1 → 1.0.1-alpha.11
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/dist/cjs/Converters.js +66 -30
- package/dist/cjs/Converters.js.map +1 -1
- package/dist/cjs/Definitions/Global/Drivers.js +10 -3
- package/dist/cjs/Definitions/Global/Drivers.js.map +1 -1
- package/dist/cjs/Definitions/Global/Events.js +1 -2
- package/dist/cjs/Definitions/Global/Events.js.map +1 -1
- package/dist/cjs/Devices/Elk/ElkAlarmPanelDevice.js +3 -3
- package/dist/cjs/Devices/Elk/ElkAlarmSensorDevice.js +9 -6
- package/dist/cjs/Devices/Elk/ElkAlarmSensorDevice.js.map +1 -1
- package/dist/cjs/Devices/Insteon/InsteonBaseDevice.js +5 -3
- package/dist/cjs/Devices/Insteon/InsteonBaseDevice.js.map +1 -1
- package/dist/cjs/Devices/Insteon/InsteonFanDevice.js +7 -3
- package/dist/cjs/Devices/Insteon/InsteonFanDevice.js.map +1 -1
- package/dist/cjs/Devices/Insteon/InsteonMotionSensorDevice.js +5 -5
- package/dist/cjs/Devices/Insteon/InsteonRelayDevice.js +3 -8
- package/dist/cjs/Devices/Insteon/InsteonRelayDevice.js.map +1 -1
- package/dist/cjs/Devices/Insteon/RelayLampSwitch.js +72 -0
- package/dist/cjs/Devices/Insteon/RelayLampSwitch.js.map +1 -0
- package/dist/cjs/ISY.js +155 -135
- package/dist/cjs/ISY.js.map +1 -1
- package/dist/cjs/ISYNode.js +34 -15
- package/dist/cjs/ISYNode.js.map +1 -1
- package/dist/cjs/ISYScene.js +3 -3
- package/dist/cjs/ISYScene.js.map +1 -1
- package/dist/cjs/Matter/Behaviors/ISYBridgedDeviceBehavior.js +11 -4
- package/dist/cjs/Matter/Behaviors/ISYBridgedDeviceBehavior.js.map +1 -1
- package/dist/cjs/Matter/Behaviors/ISYClusterBehavior.js +26 -7
- package/dist/cjs/Matter/Behaviors/ISYClusterBehavior.js.map +1 -1
- package/dist/cjs/Matter/Behaviors/ISYOnOffBehavior.js +9 -7
- package/dist/cjs/Matter/Behaviors/ISYOnOffBehavior.js.map +1 -1
- package/dist/cjs/Matter/{Server → Bridge}/Server.js +27 -45
- package/dist/cjs/Matter/Bridge/Server.js.map +1 -0
- package/dist/cjs/Matter/Mappings/Insteon.js +19 -15
- package/dist/cjs/Matter/Mappings/Insteon.js.map +1 -1
- package/dist/cjs/Matter/Mappings/register.js +1 -0
- package/dist/cjs/Matter/Mappings/register.js.map +1 -0
- package/dist/cjs/Model/ClusterMap.js +12 -9
- package/dist/cjs/Model/ClusterMap.js.map +1 -1
- package/dist/cjs/Utils.js +29 -9
- package/dist/cjs/Utils.js.map +1 -1
- package/dist/cjs/types/CodeGeneration/EnumFactory.d.ts +1 -1
- package/dist/cjs/types/Converters.d.ts +28 -8
- package/dist/cjs/types/Converters.d.ts.map +1 -1
- package/dist/cjs/types/Definitions/Global/Drivers.d.ts +4 -3
- package/dist/cjs/types/Definitions/Global/Drivers.d.ts.map +1 -1
- package/dist/cjs/types/Definitions/Global/Events.d.ts.map +1 -1
- package/dist/cjs/types/Devices/Elk/ElkAlarmSensorDevice.d.ts.map +1 -1
- package/dist/cjs/types/Devices/EndpointFor.d.ts +2 -2
- package/dist/cjs/types/Devices/Insteon/InsteonBaseDevice.d.ts +3 -3
- package/dist/cjs/types/Devices/Insteon/InsteonBaseDevice.d.ts.map +1 -1
- package/dist/cjs/types/Devices/Insteon/InsteonDevice.d.ts +4 -4
- package/dist/cjs/types/Devices/Insteon/InsteonFanDevice.d.ts +5 -4
- package/dist/cjs/types/Devices/Insteon/InsteonFanDevice.d.ts.map +1 -1
- package/dist/cjs/types/Devices/Insteon/InsteonRelayDevice.d.ts +2 -4
- package/dist/cjs/types/Devices/Insteon/InsteonRelayDevice.d.ts.map +1 -1
- package/dist/cjs/types/Devices/Insteon/RelayLampSwitch.d.ts +93 -0
- package/dist/cjs/types/Devices/Insteon/RelayLampSwitch.d.ts.map +1 -0
- package/dist/cjs/types/ISY.d.ts +56 -52
- package/dist/cjs/types/ISY.d.ts.map +1 -1
- package/dist/cjs/types/ISYNode.d.ts +4 -4
- package/dist/cjs/types/ISYNode.d.ts.map +1 -1
- package/dist/cjs/types/Matter/Behaviors/ISYBridgedDeviceBehavior.d.ts +16 -6
- package/dist/cjs/types/Matter/Behaviors/ISYBridgedDeviceBehavior.d.ts.map +1 -1
- package/dist/cjs/types/Matter/Behaviors/ISYClusterBehavior.d.ts +13 -11
- package/dist/cjs/types/Matter/Behaviors/ISYClusterBehavior.d.ts.map +1 -1
- package/dist/cjs/types/Matter/Behaviors/ISYOnOffBehavior.d.ts +4 -4
- package/dist/cjs/types/Matter/Behaviors/ISYOnOffBehavior.d.ts.map +1 -1
- package/dist/cjs/types/Matter/Bridge/Server.d.ts +17 -0
- package/dist/cjs/types/Matter/Bridge/Server.d.ts.map +1 -0
- package/dist/cjs/types/Matter/Mappings/register.d.ts +1 -0
- package/dist/cjs/types/Matter/Mappings/register.d.ts.map +1 -0
- package/dist/cjs/types/Model/ClusterMap.d.ts +19 -11
- package/dist/cjs/types/Model/ClusterMap.d.ts.map +1 -1
- package/dist/cjs/types/Utils.d.ts +2 -5
- package/dist/cjs/types/Utils.d.ts.map +1 -1
- package/dist/esm/Converters.js +63 -28
- package/dist/esm/Converters.js.map +1 -1
- package/dist/esm/Definitions/Global/Drivers.js +10 -3
- package/dist/esm/Definitions/Global/Drivers.js.map +1 -1
- package/dist/esm/Definitions/Global/Events.js +1 -2
- package/dist/esm/Definitions/Global/Events.js.map +1 -1
- package/dist/esm/Devices/Elk/ElkAlarmPanelDevice.js +3 -3
- package/dist/esm/Devices/Elk/ElkAlarmSensorDevice.js +9 -6
- package/dist/esm/Devices/Elk/ElkAlarmSensorDevice.js.map +1 -1
- package/dist/esm/Devices/Insteon/InsteonBaseDevice.js +6 -4
- package/dist/esm/Devices/Insteon/InsteonBaseDevice.js.map +1 -1
- package/dist/esm/Devices/Insteon/InsteonFanDevice.js +7 -3
- package/dist/esm/Devices/Insteon/InsteonFanDevice.js.map +1 -1
- package/dist/esm/Devices/Insteon/InsteonMotionSensorDevice.js +5 -5
- package/dist/esm/Devices/Insteon/InsteonRelayDevice.js +3 -8
- package/dist/esm/Devices/Insteon/InsteonRelayDevice.js.map +1 -1
- package/dist/esm/Devices/Insteon/RelayLampSwitch.js +68 -0
- package/dist/esm/Devices/Insteon/RelayLampSwitch.js.map +1 -0
- package/dist/esm/ISY.js +191 -171
- package/dist/esm/ISY.js.map +1 -1
- package/dist/esm/ISYNode.js +34 -15
- package/dist/esm/ISYNode.js.map +1 -1
- package/dist/esm/ISYScene.js +3 -3
- package/dist/esm/ISYScene.js.map +1 -1
- package/dist/esm/Matter/Behaviors/ISYBridgedDeviceBehavior.js +11 -4
- package/dist/esm/Matter/Behaviors/ISYBridgedDeviceBehavior.js.map +1 -1
- package/dist/esm/Matter/Behaviors/ISYClusterBehavior.js +26 -7
- package/dist/esm/Matter/Behaviors/ISYClusterBehavior.js.map +1 -1
- package/dist/esm/Matter/Behaviors/ISYOnOffBehavior.js +10 -8
- package/dist/esm/Matter/Behaviors/ISYOnOffBehavior.js.map +1 -1
- package/dist/esm/Matter/{Server → Bridge}/Server.js +25 -44
- package/dist/esm/Matter/Bridge/Server.js.map +1 -0
- package/dist/esm/Matter/Mappings/Insteon.js +22 -18
- package/dist/esm/Matter/Mappings/Insteon.js.map +1 -1
- package/dist/esm/Matter/Mappings/register.js +2 -0
- package/dist/esm/Matter/Mappings/register.js.map +1 -0
- package/dist/esm/Model/ClusterMap.js +12 -9
- package/dist/esm/Model/ClusterMap.js.map +1 -1
- package/dist/esm/Utils.js +25 -8
- package/dist/esm/Utils.js.map +1 -1
- package/dist/esm/types/CodeGeneration/EnumFactory.d.ts +1 -1
- package/dist/esm/types/Converters.d.ts +28 -8
- package/dist/esm/types/Converters.d.ts.map +1 -1
- package/dist/esm/types/Definitions/Global/Drivers.d.ts +4 -3
- package/dist/esm/types/Definitions/Global/Drivers.d.ts.map +1 -1
- package/dist/esm/types/Definitions/Global/Events.d.ts.map +1 -1
- package/dist/esm/types/Devices/Elk/ElkAlarmSensorDevice.d.ts.map +1 -1
- package/dist/esm/types/Devices/EndpointFor.d.ts +2 -2
- package/dist/esm/types/Devices/Insteon/InsteonBaseDevice.d.ts +3 -3
- package/dist/esm/types/Devices/Insteon/InsteonBaseDevice.d.ts.map +1 -1
- package/dist/esm/types/Devices/Insteon/InsteonDevice.d.ts +4 -4
- package/dist/esm/types/Devices/Insteon/InsteonFanDevice.d.ts +5 -4
- package/dist/esm/types/Devices/Insteon/InsteonFanDevice.d.ts.map +1 -1
- package/dist/esm/types/Devices/Insteon/InsteonRelayDevice.d.ts +2 -4
- package/dist/esm/types/Devices/Insteon/InsteonRelayDevice.d.ts.map +1 -1
- package/dist/esm/types/Devices/Insteon/RelayLampSwitch.d.ts +93 -0
- package/dist/esm/types/Devices/Insteon/RelayLampSwitch.d.ts.map +1 -0
- package/dist/esm/types/ISY.d.ts +56 -52
- package/dist/esm/types/ISY.d.ts.map +1 -1
- package/dist/esm/types/ISYNode.d.ts +4 -4
- package/dist/esm/types/ISYNode.d.ts.map +1 -1
- package/dist/esm/types/Matter/Behaviors/ISYBridgedDeviceBehavior.d.ts +16 -6
- package/dist/esm/types/Matter/Behaviors/ISYBridgedDeviceBehavior.d.ts.map +1 -1
- package/dist/esm/types/Matter/Behaviors/ISYClusterBehavior.d.ts +13 -11
- package/dist/esm/types/Matter/Behaviors/ISYClusterBehavior.d.ts.map +1 -1
- package/dist/esm/types/Matter/Behaviors/ISYOnOffBehavior.d.ts +4 -4
- package/dist/esm/types/Matter/Behaviors/ISYOnOffBehavior.d.ts.map +1 -1
- package/dist/esm/types/Matter/Bridge/Server.d.ts +17 -0
- package/dist/esm/types/Matter/Bridge/Server.d.ts.map +1 -0
- package/dist/esm/types/Matter/Mappings/register.d.ts +2 -0
- package/dist/esm/types/Matter/Mappings/register.d.ts.map +1 -0
- package/dist/esm/types/Model/ClusterMap.d.ts +19 -11
- package/dist/esm/types/Model/ClusterMap.d.ts.map +1 -1
- package/dist/esm/types/Utils.d.ts +2 -5
- package/dist/esm/types/Utils.d.ts.map +1 -1
- package/dist/tsconfig.cjs.tsbuildinfo +1 -1
- package/dist/tsconfig.esm.tsbuildinfo +1 -1
- package/package.json +5 -9
- package/src/Converters.ts +137 -69
- package/src/Definitions/Global/Drivers.ts +16 -7
- package/src/Definitions/Global/Events.ts +4 -3
- package/src/Devices/Elk/ElkAlarmPanelDevice.ts +3 -3
- package/src/Devices/Elk/ElkAlarmSensorDevice.ts +15 -21
- package/src/Devices/Insteon/Generated/RelayLamp.ts +8 -7
- package/src/Devices/Insteon/InsteonBaseDevice.ts +10 -9
- package/src/Devices/Insteon/InsteonFanDevice.ts +16 -11
- package/src/Devices/Insteon/InsteonMotionSensorDevice.ts +5 -5
- package/src/Devices/Insteon/InsteonRelayDevice.ts +3 -5
- package/src/Devices/Insteon/RelayLampSwitch.ts +131 -0
- package/src/ISY.ts +816 -819
- package/src/ISYNode.ts +33 -17
- package/src/ISYScene.ts +3 -3
- package/src/Matter/Behaviors/ISYBridgedDeviceBehavior.ts +29 -11
- package/src/Matter/Behaviors/ISYClusterBehavior.ts +46 -28
- package/src/Matter/Behaviors/ISYOnOffBehavior.ts +49 -60
- package/src/Matter/{Server → Bridge}/Server.ts +47 -51
- package/src/Matter/Mappings/Insteon.ts +53 -60
- package/src/Matter/Mappings/register.ts +0 -0
- package/src/Model/ClassDefinition.ts +1 -1
- package/src/Model/ClusterMap.ts +31 -22
- package/src/Utils.ts +26 -19
- package/tsconfig.json +2 -2
- package/dist/cjs/Matter/Server/Server.js.map +0 -1
- package/dist/cjs/types/Matter/Server/Server.d.ts +0 -4
- package/dist/cjs/types/Matter/Server/Server.d.ts.map +0 -1
- package/dist/esm/Matter/Server/Server.js.map +0 -1
- package/dist/esm/types/Matter/Server/Server.d.ts +0 -4
- package/dist/esm/types/Matter/Server/Server.d.ts.map +0 -1
package/dist/cjs/ISY.js
CHANGED
|
@@ -34,7 +34,7 @@ const processors_js_1 = require("xml2js/lib/processors.js");
|
|
|
34
34
|
const xmldoc_1 = require("xmldoc");
|
|
35
35
|
const axios_1 = __importDefault(require("axios"));
|
|
36
36
|
const events_1 = require("events");
|
|
37
|
-
const winston_1 =
|
|
37
|
+
const winston_1 = require("winston");
|
|
38
38
|
const Categories_js_1 = require("./Definitions/Global/Categories.js");
|
|
39
39
|
Object.defineProperty(exports, "Categories", { enumerable: true, get: function () { return Categories_js_1.Category; } });
|
|
40
40
|
const Families_js_1 = require("./Definitions/Global/Families.js");
|
|
@@ -79,6 +79,8 @@ const InsteonSmokeSensorDevice_js_1 = require("./Devices/Insteon/InsteonSmokeSen
|
|
|
79
79
|
Object.defineProperty(exports, "InsteonSmokeSensorDevice", { enumerable: true, get: function () { return InsteonSmokeSensorDevice_js_1.InsteonSmokeSensorDevice; } });
|
|
80
80
|
const InsteonThermostatDevice_js_1 = require("./Devices/Insteon/InsteonThermostatDevice.js");
|
|
81
81
|
Object.defineProperty(exports, "InsteonThermostatDevice", { enumerable: true, get: function () { return InsteonThermostatDevice_js_1.InsteonThermostatDevice; } });
|
|
82
|
+
const ISYDeviceNode_js_1 = require("./Devices/ISYDeviceNode.js");
|
|
83
|
+
Object.defineProperty(exports, "ISYDevice", { enumerable: true, get: function () { return ISYDeviceNode_js_1.ISYDeviceNode; } });
|
|
82
84
|
const EventType_js_1 = require("./Events/EventType.js");
|
|
83
85
|
const ISYConstants_js_1 = require("./ISYConstants.js");
|
|
84
86
|
Object.defineProperty(exports, "NodeType", { enumerable: true, get: function () { return ISYConstants_js_1.NodeType; } });
|
|
@@ -87,8 +89,6 @@ Object.defineProperty(exports, "States", { enumerable: true, get: function () {
|
|
|
87
89
|
Object.defineProperty(exports, "VariableType", { enumerable: true, get: function () { return ISYConstants_js_1.VariableType; } });
|
|
88
90
|
const ISYNode_js_1 = require("./ISYNode.js");
|
|
89
91
|
Object.defineProperty(exports, "ISYNode", { enumerable: true, get: function () { return ISYNode_js_1.ISYNode; } });
|
|
90
|
-
const ISYDeviceNode_js_1 = require("./Devices/ISYDeviceNode.js");
|
|
91
|
-
Object.defineProperty(exports, "ISYDevice", { enumerable: true, get: function () { return ISYDeviceNode_js_1.ISYDeviceNode; } });
|
|
92
92
|
const ISYScene_js_1 = require("./ISYScene.js");
|
|
93
93
|
Object.defineProperty(exports, "ISYScene", { enumerable: true, get: function () { return ISYScene_js_1.ISYScene; } });
|
|
94
94
|
const ISYVariable_js_1 = require("./ISYVariable.js");
|
|
@@ -97,17 +97,18 @@ const Utils = __importStar(require("./Utils.js"));
|
|
|
97
97
|
exports.Utils = Utils;
|
|
98
98
|
const fast_xml_parser_1 = require("fast-xml-parser");
|
|
99
99
|
const NodeFactory_js_1 = require("./Devices/NodeFactory.js");
|
|
100
|
+
const Utils_js_1 = require("./Utils.js");
|
|
100
101
|
const defaultParserOptions = {
|
|
101
102
|
explicitArray: false,
|
|
102
103
|
mergeAttrs: true,
|
|
103
104
|
attrValueProcessors: [processors_js_1.parseNumbers, processors_js_1.parseBooleans],
|
|
104
105
|
valueProcessors: [processors_js_1.parseNumbers, processors_js_1.parseBooleans],
|
|
105
|
-
tagNameProcessors: [(tagName) => (tagName ===
|
|
106
|
+
tagNameProcessors: [(tagName) => (tagName === 'st' || tagName === 'cmd' || tagName === 'nodeDef' ? '' : tagName)]
|
|
106
107
|
};
|
|
107
108
|
const defaultXMLParserOptions = {
|
|
108
109
|
parseAttributeValue: true,
|
|
109
110
|
allowBooleanAttributes: true,
|
|
110
|
-
attributeNamePrefix:
|
|
111
|
+
attributeNamePrefix: '',
|
|
111
112
|
attributesGroupName: false,
|
|
112
113
|
ignoreAttributes: false,
|
|
113
114
|
// updateTag(tagName, jPath, attrs) {
|
|
@@ -115,20 +116,20 @@ const defaultXMLParserOptions = {
|
|
|
115
116
|
// // return false;
|
|
116
117
|
// //return tagName;
|
|
117
118
|
// },
|
|
118
|
-
textNodeName:
|
|
119
|
-
commentPropName:
|
|
120
|
-
cdataPropName:
|
|
119
|
+
textNodeName: '_',
|
|
120
|
+
commentPropName: '$comment',
|
|
121
|
+
cdataPropName: '$cdata',
|
|
121
122
|
ignoreDeclaration: true,
|
|
122
123
|
tagValueProcessor: (tagName, tagValue, jPath, hasAttributes, isLeafNode) => {
|
|
123
|
-
if (tagValue ===
|
|
124
|
+
if (tagValue === '')
|
|
124
125
|
return null;
|
|
125
126
|
return tagValue;
|
|
126
127
|
},
|
|
127
128
|
isArray(tagName, jPath, isLeafNode, isAttribute) {
|
|
128
|
-
if (tagName ===
|
|
129
|
+
if (tagName === 'property')
|
|
129
130
|
return true;
|
|
130
131
|
return false;
|
|
131
|
-
}
|
|
132
|
+
}
|
|
132
133
|
};
|
|
133
134
|
axios_1.default.defaults.transitional.forcedJSONParsing = false;
|
|
134
135
|
const parser = new xml2js_1.Parser(defaultParserOptions);
|
|
@@ -149,7 +150,7 @@ class ISY extends events_1.EventEmitter {
|
|
|
149
150
|
sceneList = new Map();
|
|
150
151
|
storagePath;
|
|
151
152
|
variableList = new Map();
|
|
152
|
-
wsprotocol =
|
|
153
|
+
wsprotocol = 'ws';
|
|
153
154
|
zoneMap = new Map();
|
|
154
155
|
static instance;
|
|
155
156
|
configInfo;
|
|
@@ -161,35 +162,36 @@ class ISY extends events_1.EventEmitter {
|
|
|
161
162
|
model;
|
|
162
163
|
nodesLoaded = false;
|
|
163
164
|
productId = 5226;
|
|
164
|
-
productName =
|
|
165
|
+
productName = 'eisy';
|
|
165
166
|
serverVersion;
|
|
166
|
-
vendorName =
|
|
167
|
+
vendorName = 'Universal Devices, Inc.';
|
|
167
168
|
webSocket;
|
|
169
|
+
apiVersion;
|
|
168
170
|
// #endregion Properties (30)
|
|
169
171
|
// #region Constructors (1)
|
|
170
172
|
constructor(config, logger = new winston_1.Logger(), storagePath) {
|
|
171
173
|
super();
|
|
172
174
|
this.enableWebSocket = config.enableWebSocket ?? true;
|
|
173
|
-
this.storagePath = storagePath ??
|
|
174
|
-
this.displayNameFormat = config.displayNameFormat ??
|
|
175
|
+
this.storagePath = storagePath ?? './';
|
|
176
|
+
this.displayNameFormat = config.displayNameFormat ?? '${location ?? folder} ${spokenName ?? name}';
|
|
175
177
|
this.host = config.host;
|
|
176
178
|
this.port = config.port;
|
|
177
179
|
this.credentials = {
|
|
178
180
|
username: config.username,
|
|
179
|
-
password: config.password
|
|
181
|
+
password: config.password
|
|
180
182
|
};
|
|
181
183
|
this.protocol = config.protocol;
|
|
182
|
-
this.wsprotocol = config.protocol ===
|
|
184
|
+
this.wsprotocol = config.protocol === 'https' ? 'wss' : 'ws';
|
|
183
185
|
this.elkEnabled = config.elkEnabled ?? false;
|
|
184
186
|
this.nodesLoaded = false;
|
|
185
187
|
var fopts = (0, winston_1.format)((info) => {
|
|
186
188
|
info.message = JSON.stringify(info.message);
|
|
187
189
|
return info;
|
|
188
|
-
})({ label:
|
|
189
|
-
this.logger = winston_1.loggers.add(
|
|
190
|
+
})({ label: 'ISY' });
|
|
191
|
+
this.logger = winston_1.loggers.add('isy', {
|
|
190
192
|
transports: logger.transports,
|
|
191
193
|
levels: logger.levels,
|
|
192
|
-
format: winston_1.format.label({ label:
|
|
194
|
+
format: winston_1.format.label({ label: 'ISY' })
|
|
193
195
|
});
|
|
194
196
|
this.guardianTimer = null;
|
|
195
197
|
if (this.elkEnabled) {
|
|
@@ -206,7 +208,15 @@ class ISY extends events_1.EventEmitter {
|
|
|
206
208
|
return this.logger?.isDebugEnabled();
|
|
207
209
|
}
|
|
208
210
|
// #endregion Public Getters And Setters (2)
|
|
209
|
-
// #region Public Methods (
|
|
211
|
+
// #region Public Methods (24)
|
|
212
|
+
[Symbol.dispose]() {
|
|
213
|
+
try {
|
|
214
|
+
this.webSocket?.close();
|
|
215
|
+
}
|
|
216
|
+
catch (e) {
|
|
217
|
+
this.logger.error(`Error closing websocket: ${e.message}`);
|
|
218
|
+
}
|
|
219
|
+
}
|
|
210
220
|
emit(event, node) {
|
|
211
221
|
return super.emit(event, node);
|
|
212
222
|
}
|
|
@@ -224,6 +234,9 @@ class ISY extends events_1.EventEmitter {
|
|
|
224
234
|
}
|
|
225
235
|
return s;
|
|
226
236
|
}
|
|
237
|
+
getElkAlarmPanel() {
|
|
238
|
+
return this.elkAlarmPanel;
|
|
239
|
+
}
|
|
227
240
|
getNode(address, parentsOnly = false) {
|
|
228
241
|
let s = this.nodeMap.get(address);
|
|
229
242
|
if (!parentsOnly) {
|
|
@@ -238,9 +251,6 @@ class ISY extends events_1.EventEmitter {
|
|
|
238
251
|
}
|
|
239
252
|
return s;
|
|
240
253
|
}
|
|
241
|
-
getElkAlarmPanel() {
|
|
242
|
-
return this.elkAlarmPanel;
|
|
243
|
-
}
|
|
244
254
|
getScene(address) {
|
|
245
255
|
return this.sceneList.get(address);
|
|
246
256
|
}
|
|
@@ -275,7 +285,7 @@ class ISY extends events_1.EventEmitter {
|
|
|
275
285
|
else if (evt.action instanceof Number || evt.action instanceof String) {
|
|
276
286
|
actionValue = Number(evt.action);
|
|
277
287
|
}
|
|
278
|
-
const stringControl = Number(evt.control?.replace(
|
|
288
|
+
const stringControl = Number(evt.control?.replace('_', ''));
|
|
279
289
|
switch (stringControl) {
|
|
280
290
|
case EventType_js_1.EventType.Elk:
|
|
281
291
|
if (actionValue === 2) {
|
|
@@ -304,11 +314,16 @@ class ISY extends events_1.EventEmitter {
|
|
|
304
314
|
this.logger.debug(`Received ${EventType_js_1.EventType[Number(stringControl)]} Signal from ISY: ${JSON.stringify(evt)}`);
|
|
305
315
|
break;
|
|
306
316
|
default:
|
|
307
|
-
if (evt.node !==
|
|
317
|
+
if (evt.node !== '' && evt.node !== undefined && evt.node !== null) {
|
|
308
318
|
//
|
|
309
|
-
const impactedDevice = this.
|
|
319
|
+
const impactedDevice = this.getNode(evt.node);
|
|
310
320
|
if (impactedDevice !== undefined && impactedDevice !== null) {
|
|
311
|
-
|
|
321
|
+
try {
|
|
322
|
+
impactedDevice.handleEvent(evt);
|
|
323
|
+
}
|
|
324
|
+
catch (e) {
|
|
325
|
+
this.logger.error(`Error handling event for ${impactedDevice.name}: ${e.message}`);
|
|
326
|
+
}
|
|
312
327
|
}
|
|
313
328
|
else {
|
|
314
329
|
this.logger.warn(`${EventType_js_1.EventType[stringControl]} Event for Unidentified Device: ${JSON.stringify(evt)}`);
|
|
@@ -327,6 +342,7 @@ class ISY extends events_1.EventEmitter {
|
|
|
327
342
|
async initialize() {
|
|
328
343
|
const that = this;
|
|
329
344
|
try {
|
|
345
|
+
this.apiVersion = (await (0, Utils_js_1.findPackageJson)()).content.version;
|
|
330
346
|
await this.loadConfig();
|
|
331
347
|
await this.loadNodes();
|
|
332
348
|
await this.loadVariables(ISYConstants_js_1.VariableType.Integer);
|
|
@@ -335,7 +351,7 @@ class ISY extends events_1.EventEmitter {
|
|
|
335
351
|
await this.#finishInitialize(true);
|
|
336
352
|
}
|
|
337
353
|
catch (e) {
|
|
338
|
-
this.handleInitializeError(
|
|
354
|
+
this.handleInitializeError('initialize', e);
|
|
339
355
|
}
|
|
340
356
|
finally {
|
|
341
357
|
if (this.nodesLoaded !== true) {
|
|
@@ -346,7 +362,7 @@ class ISY extends events_1.EventEmitter {
|
|
|
346
362
|
}
|
|
347
363
|
initializeWebSocket() {
|
|
348
364
|
const that = this;
|
|
349
|
-
const auth = `Basic ${Buffer.from(`${this.credentials.username}:${this.credentials.password}`).toString(
|
|
365
|
+
const auth = `Basic ${Buffer.from(`${this.credentials.username}:${this.credentials.password}`).toString('base64')}`;
|
|
350
366
|
this.logger.info(`Opening webSocket: ${this.wsprotocol}://${this.address}/rest/subscribe`);
|
|
351
367
|
if (this.webSocket) {
|
|
352
368
|
try {
|
|
@@ -356,42 +372,42 @@ class ISY extends events_1.EventEmitter {
|
|
|
356
372
|
this.logger.warn(`Error closing existing websocket: ${e.message}`);
|
|
357
373
|
}
|
|
358
374
|
}
|
|
359
|
-
this.webSocket = new faye_websocket_1.default.Client(`${this.wsprotocol}://${this.address}/rest/subscribe`, [
|
|
375
|
+
this.webSocket = new faye_websocket_1.default.Client(`${this.wsprotocol}://${this.address}/rest/subscribe`, ['ISYSUB'], {
|
|
360
376
|
headers: {
|
|
361
|
-
Origin:
|
|
362
|
-
Authorization: auth
|
|
377
|
+
Origin: 'com.universal-devices.websockets.isy',
|
|
378
|
+
Authorization: auth
|
|
363
379
|
},
|
|
364
|
-
ping: 10
|
|
380
|
+
ping: 10
|
|
365
381
|
});
|
|
366
382
|
this.lastActivity = new Date();
|
|
367
383
|
this.webSocket
|
|
368
|
-
.on(
|
|
384
|
+
.on('message', (event) => {
|
|
369
385
|
that.logger.silly(`Received message: ${JSON.stringify(event.data, null, 2)}`);
|
|
370
386
|
that.handleWebSocketMessage(event);
|
|
371
387
|
})
|
|
372
|
-
.on(
|
|
388
|
+
.on('error', (err, response) => {
|
|
373
389
|
that.logger.warn(`Websocket subscription error: ${JSON.stringify(err.message)}`);
|
|
374
390
|
/// throw new Error('Error calling ISY' + err);
|
|
375
391
|
})
|
|
376
|
-
.on(
|
|
392
|
+
.on('fail', (data, response) => {
|
|
377
393
|
that.logger.warn(`Websocket subscription failure: ${data}`);
|
|
378
|
-
throw new Error(
|
|
394
|
+
throw new Error('Failed calling ISY');
|
|
379
395
|
})
|
|
380
|
-
.on(
|
|
381
|
-
that.logger.warn(
|
|
382
|
-
throw new Error(
|
|
396
|
+
.on('abort', () => {
|
|
397
|
+
that.logger.warn('Websocket subscription aborted.');
|
|
398
|
+
throw new Error('Call to ISY was aborted');
|
|
383
399
|
})
|
|
384
|
-
.on(
|
|
400
|
+
.on('timeout', (ms) => {
|
|
385
401
|
that.logger.warn(`Websocket subscription timed out after ${ms} milliseconds.`);
|
|
386
|
-
throw new Error(
|
|
402
|
+
throw new Error('Timeout contacting ISY');
|
|
387
403
|
});
|
|
388
404
|
}
|
|
389
405
|
async loadConfig() {
|
|
390
406
|
try {
|
|
391
|
-
this.logger.info(
|
|
392
|
-
const configuration = (await this.sendRequest(
|
|
407
|
+
this.logger.info('Loading ISY Config');
|
|
408
|
+
const configuration = (await this.sendRequest('config')).configuration;
|
|
393
409
|
if (this.isDebugEnabled) {
|
|
394
|
-
(0, fs_1.writeFile)(this.storagePath +
|
|
410
|
+
(0, fs_1.writeFile)(this.storagePath + '/ISYConfigDump.json', JSON.stringify(configuration), this.logger.error);
|
|
395
411
|
}
|
|
396
412
|
const controls = configuration.controls;
|
|
397
413
|
this.model = configuration.deviceSpecs.model;
|
|
@@ -413,18 +429,18 @@ class ISY extends events_1.EventEmitter {
|
|
|
413
429
|
return configuration;
|
|
414
430
|
}
|
|
415
431
|
catch (e) {
|
|
416
|
-
this.handleInitializeError(
|
|
432
|
+
this.handleInitializeError('config', e);
|
|
417
433
|
throw Error(`Error Loading Config: ${e.message}`);
|
|
418
434
|
}
|
|
419
435
|
}
|
|
420
436
|
async loadNodes() {
|
|
421
437
|
try {
|
|
422
|
-
const result = await this.sendRequest(
|
|
438
|
+
const result = await this.sendRequest('nodes');
|
|
423
439
|
if (this.isDebugEnabled)
|
|
424
|
-
(0, fs_1.writeFile)(this.storagePath +
|
|
425
|
-
await this.#readFolderNodes(result).catch((p) => this.logger.error(
|
|
426
|
-
await this.#readDeviceNodes(result).catch((p) => this.logger.error(
|
|
427
|
-
await this.#readSceneNodes(result).catch((p) => this.logger.error(
|
|
440
|
+
(0, fs_1.writeFile)(this.storagePath + '/ISYNodesDump.json', JSON.stringify(result), this.logger.error);
|
|
441
|
+
await this.#readFolderNodes(result).catch((p) => this.logger.error('Error Loading Folders', p));
|
|
442
|
+
await this.#readDeviceNodes(result).catch((p) => this.logger.error('Error Loading Devices', p));
|
|
443
|
+
await this.#readSceneNodes(result).catch((p) => this.logger.error('Error Loading Scenes', p));
|
|
428
444
|
return result;
|
|
429
445
|
}
|
|
430
446
|
catch (e) {
|
|
@@ -453,9 +469,9 @@ class ISY extends events_1.EventEmitter {
|
|
|
453
469
|
async refreshStatuses() {
|
|
454
470
|
try {
|
|
455
471
|
const that = this;
|
|
456
|
-
const result = await that.sendRequest(
|
|
472
|
+
const result = await that.sendRequest('status');
|
|
457
473
|
if (that.isDebugEnabled) {
|
|
458
|
-
(0, fs_1.writeFile)(that.storagePath +
|
|
474
|
+
(0, fs_1.writeFile)(that.storagePath + '/ISYStatusDump.json', JSON.stringify(result), this.logger.error);
|
|
459
475
|
}
|
|
460
476
|
this.logger.debug(result);
|
|
461
477
|
for (const node of result.nodes.node) {
|
|
@@ -510,14 +526,14 @@ class ISY extends events_1.EventEmitter {
|
|
|
510
526
|
async sendNodeCommand(node, command, parameters) {
|
|
511
527
|
let uriToUse = `nodes/${node.address}/cmd/${command}`;
|
|
512
528
|
if (parameters !== null && parameters !== undefined) {
|
|
513
|
-
if (typeof parameters ==
|
|
529
|
+
if (typeof parameters == 'object') {
|
|
514
530
|
var q = parameters;
|
|
515
531
|
for (const paramName of Object.getOwnPropertyNames(q)) {
|
|
516
532
|
uriToUse += `/${paramName}/${q[paramName]}`;
|
|
517
533
|
}
|
|
518
534
|
//uriToUse += `/${q[((p : Record<string,number|number>) => `${p[]}/${p.paramValue}` ).join('/')}`;
|
|
519
535
|
}
|
|
520
|
-
else if (typeof parameters ==
|
|
536
|
+
else if (typeof parameters == 'number' || typeof parameters == 'string') {
|
|
521
537
|
uriToUse += `/${parameters}`;
|
|
522
538
|
}
|
|
523
539
|
}
|
|
@@ -525,37 +541,41 @@ class ISY extends events_1.EventEmitter {
|
|
|
525
541
|
return this.sendRequest(uriToUse);
|
|
526
542
|
}
|
|
527
543
|
async sendRequest(url, options = { trailingSlash: true }) {
|
|
528
|
-
const requestLogLevel = options.requestLogLevel ??
|
|
529
|
-
const responseLogLevel = options.responseLogLevel ??
|
|
530
|
-
url = `${this.protocol}://${this.address}/rest/${url}${options.trailingSlash ?
|
|
531
|
-
this.logger.log(`Sending request: ${url}
|
|
544
|
+
const requestLogLevel = options.requestLogLevel ?? 'debug';
|
|
545
|
+
const responseLogLevel = options.responseLogLevel ?? 'silly';
|
|
546
|
+
url = `${this.protocol}://${this.address}/rest/${url}${options.trailingSlash ? '/' : ''}`;
|
|
547
|
+
this.logger.log(requestLogLevel, `Sending request: ${url}`);
|
|
532
548
|
try {
|
|
533
549
|
const response = await axios_1.default.get(url, {
|
|
534
|
-
auth: { username: this.credentials.username, password: this.credentials.password }
|
|
550
|
+
auth: { username: this.credentials.username, password: this.credentials.password }
|
|
535
551
|
});
|
|
536
552
|
if (response.data) {
|
|
537
|
-
if (response.headers[
|
|
553
|
+
if (response.headers['content-type'].toString().includes('xml')) {
|
|
538
554
|
let curParser = parser;
|
|
539
555
|
if (options.parserOptions)
|
|
540
556
|
curParser = new xml2js_1.Parser({ ...defaultParserOptions, ...options.parserOptions });
|
|
541
557
|
var altParser = new fast_xml_parser_1.XMLParser(defaultXMLParserOptions);
|
|
542
558
|
var s = altParser.parse(response.data);
|
|
543
|
-
this.logger.log(`Response: ${JSON.stringify(s)}
|
|
559
|
+
this.logger.log(requestLogLevel ?? 'debug', `Response: ${JSON.stringify(s)}`);
|
|
544
560
|
return s;
|
|
545
561
|
}
|
|
546
|
-
else if (response.headers[
|
|
547
|
-
this.logger.log(`Response: ${JSON.stringify(response.data)}
|
|
562
|
+
else if (response.headers['content-type'].toString().includes('json')) {
|
|
563
|
+
this.logger.log(responseLogLevel ?? 'debug', `Response: ${JSON.stringify(response.data)}`);
|
|
548
564
|
return JSON.parse(response.data);
|
|
549
565
|
}
|
|
550
566
|
else {
|
|
551
|
-
this.logger.log(`Response Header: ${JSON.stringify(response.headers)} Response: ${JSON.stringify(response.data)}
|
|
567
|
+
this.logger.log(responseLogLevel ?? 'debug', `Response Header: ${JSON.stringify(response.headers)} Response: ${JSON.stringify(response.data)}`);
|
|
552
568
|
return response.data;
|
|
553
569
|
}
|
|
554
570
|
}
|
|
555
571
|
}
|
|
556
572
|
catch (error) {
|
|
557
|
-
|
|
558
|
-
|
|
573
|
+
if (options.errorLogLevel) {
|
|
574
|
+
this.logger.log(options.errorLogLevel, `Error sending request to ISY: ${error?.message}`);
|
|
575
|
+
}
|
|
576
|
+
else {
|
|
577
|
+
this.logger.error(`Error sending request to ISY: ${error?.message}`);
|
|
578
|
+
}
|
|
559
579
|
}
|
|
560
580
|
}
|
|
561
581
|
async sendSetVariable(id, type, value, handleResult) {
|
|
@@ -563,15 +583,17 @@ class ISY extends events_1.EventEmitter {
|
|
|
563
583
|
this.logger.info(`Sending ISY command...${uriToUse}`);
|
|
564
584
|
return this.sendRequest(uriToUse);
|
|
565
585
|
}
|
|
566
|
-
variableChangedHandler(variable) {
|
|
586
|
+
#variableChangedHandler(variable) {
|
|
567
587
|
this.logger.info(`Variable: ${variable.id} (${variable.type}) changed`);
|
|
568
588
|
}
|
|
569
|
-
|
|
589
|
+
close() {
|
|
590
|
+
if (this.webSocket)
|
|
591
|
+
this.webSocket.close();
|
|
592
|
+
}
|
|
593
|
+
// #endregion Public Methods (24)
|
|
570
594
|
// #region Private Methods (11)
|
|
571
595
|
#checkForFailure(response) {
|
|
572
|
-
return
|
|
573
|
-
response instanceof Error ||
|
|
574
|
-
(response.RestResponse !== undefined && response.RestResponse.status !== 200));
|
|
596
|
+
return response === null || response instanceof Error || (response.RestResponse !== undefined && response.RestResponse.status !== 200);
|
|
575
597
|
}
|
|
576
598
|
#createVariableKey(type, id) {
|
|
577
599
|
return `${type}:${id}`;
|
|
@@ -599,17 +621,18 @@ class ISY extends events_1.EventEmitter {
|
|
|
599
621
|
}
|
|
600
622
|
}
|
|
601
623
|
}
|
|
602
|
-
#guardian() {
|
|
624
|
+
async #guardian() {
|
|
603
625
|
const timeNow = new Date();
|
|
604
626
|
if (Number(timeNow) - Number(this.lastActivity) > 60000) {
|
|
605
|
-
this.logger.info(
|
|
606
|
-
this.
|
|
627
|
+
this.logger.info('Guardian: Detected no activity in more then 60 seconds. Reinitializing web sockets');
|
|
628
|
+
await this.refreshStatuses();
|
|
629
|
+
await this.initializeWebSocket();
|
|
607
630
|
}
|
|
608
631
|
}
|
|
609
632
|
#loadElkInitialStatus(result) {
|
|
610
633
|
const p = new xml2js_1.Parser({
|
|
611
634
|
explicitArray: false,
|
|
612
|
-
mergeAttrs: true
|
|
635
|
+
mergeAttrs: true
|
|
613
636
|
});
|
|
614
637
|
p.parseString(result, (err, res) => {
|
|
615
638
|
if (err) {
|
|
@@ -633,7 +656,7 @@ class ISY extends events_1.EventEmitter {
|
|
|
633
656
|
}
|
|
634
657
|
#loadElkNodes(result) {
|
|
635
658
|
const document = new xmldoc_1.XmlDocument(result);
|
|
636
|
-
const nodes = document.childNamed(
|
|
659
|
+
const nodes = document.childNamed('areas').childNamed('area').childrenNamed('zone');
|
|
637
660
|
for (let index = 0; index < nodes.length; index++) {
|
|
638
661
|
const id = nodes[index].attr.id;
|
|
639
662
|
const name = nodes[index].attr.name;
|
|
@@ -643,65 +666,70 @@ class ISY extends events_1.EventEmitter {
|
|
|
643
666
|
}
|
|
644
667
|
}
|
|
645
668
|
async #readDeviceNodes(obj) {
|
|
646
|
-
this.logger.info(
|
|
669
|
+
this.logger.info('Loading Device Nodes');
|
|
647
670
|
for (const nodeInfo of obj.nodes.node) {
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
else {
|
|
656
|
-
this.deviceMap[nodeInfo.pnode].push(nodeInfo.address);
|
|
657
|
-
}
|
|
658
|
-
let newDevice = null;
|
|
659
|
-
// let deviceTypeInfo = this.isyTypeToTypeName(device.type, device.address);
|
|
660
|
-
// this.logger.info(JSON.stringify(deviceTypeInfo));
|
|
661
|
-
const enabled = nodeInfo.enabled ?? true;
|
|
662
|
-
const d = await NodeFactory_js_1.NodeFactory.get(nodeInfo);
|
|
663
|
-
const m = DeviceFactory_js_1.DeviceFactory.getDeviceDetails(nodeInfo);
|
|
664
|
-
if (d) {
|
|
665
|
-
newDevice = new d(this, nodeInfo);
|
|
666
|
-
}
|
|
667
|
-
if (m) {
|
|
668
|
-
newDevice = newDevice ?? new m.class(this, nodeInfo);
|
|
669
|
-
newDevice.productName = m.name;
|
|
670
|
-
newDevice.model = `(${m.modelNumber}) ${m.name} v.${m.version}`;
|
|
671
|
-
newDevice.modelNumber = m.modelNumber;
|
|
672
|
-
newDevice.version = m.version;
|
|
673
|
-
}
|
|
674
|
-
if (enabled) {
|
|
675
|
-
if (newDevice === null) {
|
|
676
|
-
this.logger.warn(`Device type resolution failed for ${nodeInfo.name} with type: ${nodeInfo.type} and nodedef: ${nodeInfo.nodeDefId}`);
|
|
677
|
-
newDevice = new ISYDeviceNode_js_1.ISYDeviceNode(this, nodeInfo);
|
|
671
|
+
try {
|
|
672
|
+
this.logger.debug(`Loading Device Node: ${JSON.stringify(nodeInfo)}`);
|
|
673
|
+
if (!this.deviceMap.has(nodeInfo.pnode)) {
|
|
674
|
+
const address = nodeInfo.address;
|
|
675
|
+
this.deviceMap[nodeInfo.pnode] = {
|
|
676
|
+
address
|
|
677
|
+
};
|
|
678
678
|
}
|
|
679
|
-
else
|
|
680
|
-
|
|
681
|
-
|
|
679
|
+
else {
|
|
680
|
+
this.deviceMap[nodeInfo.pnode].push(nodeInfo.address);
|
|
681
|
+
}
|
|
682
|
+
let newDevice = null;
|
|
683
|
+
// let deviceTypeInfo = this.isyTypeToTypeName(device.type, device.address);
|
|
684
|
+
// this.logger.info(JSON.stringify(deviceTypeInfo));
|
|
685
|
+
const enabled = nodeInfo.enabled ?? true;
|
|
686
|
+
const d = await NodeFactory_js_1.NodeFactory.get(nodeInfo);
|
|
687
|
+
const m = DeviceFactory_js_1.DeviceFactory.getDeviceDetails(nodeInfo);
|
|
688
|
+
if (d) {
|
|
689
|
+
newDevice = new d(this, nodeInfo);
|
|
690
|
+
}
|
|
691
|
+
if (m) {
|
|
692
|
+
newDevice = newDevice ?? new m.class(this, nodeInfo);
|
|
693
|
+
newDevice.productName = m.name;
|
|
694
|
+
newDevice.model = `(${m.modelNumber}) ${m.name} v.${m.version}`;
|
|
695
|
+
newDevice.modelNumber = m.modelNumber;
|
|
696
|
+
newDevice.version = m.version;
|
|
697
|
+
}
|
|
698
|
+
if (enabled) {
|
|
699
|
+
if (newDevice === null) {
|
|
700
|
+
this.logger.warn(`Device type resolution failed for ${nodeInfo.name} with type: ${nodeInfo.type} and nodedef: ${nodeInfo.nodeDefId}`);
|
|
701
|
+
newDevice = new ISYDeviceNode_js_1.ISYDeviceNode(this, nodeInfo);
|
|
682
702
|
}
|
|
683
|
-
|
|
684
|
-
|
|
703
|
+
else if (newDevice !== null) {
|
|
704
|
+
if (m.unsupported) {
|
|
705
|
+
this.logger.warn('Device not currently supported: ' + JSON.stringify(nodeInfo) + ' /n It has been mapped to: ' + d.name);
|
|
706
|
+
}
|
|
707
|
+
try {
|
|
708
|
+
await newDevice.refreshNotes();
|
|
709
|
+
}
|
|
710
|
+
catch (e) {
|
|
711
|
+
this.logger.debug('No notes found.');
|
|
712
|
+
}
|
|
713
|
+
// if (!newDevice.hidden) {
|
|
714
|
+
// }
|
|
715
|
+
// this.deviceList.push(newDevice);
|
|
685
716
|
}
|
|
686
|
-
|
|
687
|
-
this.logger.debug("No notes found.");
|
|
717
|
+
else {
|
|
688
718
|
}
|
|
689
|
-
|
|
690
|
-
// }
|
|
691
|
-
// this.deviceList.push(newDevice);
|
|
719
|
+
this.nodeMap.set(newDevice.address, newDevice);
|
|
692
720
|
}
|
|
693
721
|
else {
|
|
722
|
+
this.logger.info(`Ignoring disabled device: ${nodeInfo.name}`);
|
|
694
723
|
}
|
|
695
|
-
this.nodeMap.set(newDevice.address, newDevice);
|
|
696
724
|
}
|
|
697
|
-
|
|
698
|
-
this.logger.
|
|
725
|
+
catch (e) {
|
|
726
|
+
this.logger.error(`Error loading device node: ${e.message}`);
|
|
699
727
|
}
|
|
700
728
|
}
|
|
701
729
|
this.logger.info(`${this.nodeMap.size} devices added.`);
|
|
702
730
|
}
|
|
703
731
|
async #readFolderNodes(result) {
|
|
704
|
-
this.logger.info(
|
|
732
|
+
this.logger.info('Loading Folder Nodes');
|
|
705
733
|
if (result?.nodes?.folder) {
|
|
706
734
|
for (const folder of result.nodes.folder) {
|
|
707
735
|
this.logger.info(`Loading Folder Node: ${JSON.stringify(folder)}`);
|
|
@@ -710,9 +738,9 @@ class ISY extends events_1.EventEmitter {
|
|
|
710
738
|
}
|
|
711
739
|
}
|
|
712
740
|
async #readSceneNodes(result) {
|
|
713
|
-
this.logger.info(
|
|
741
|
+
this.logger.info('Loading Scene Nodes');
|
|
714
742
|
for (const scene of result.nodes?.group) {
|
|
715
|
-
if (scene.name ===
|
|
743
|
+
if (scene.name === 'ISY' || scene.name === 'IoX' || scene.name === 'Auto DR') {
|
|
716
744
|
continue;
|
|
717
745
|
} // Skip ISY & Auto DR Scenes
|
|
718
746
|
const newScene = new ISYScene_js_1.ISYScene(this, scene);
|
|
@@ -720,7 +748,7 @@ class ISY extends events_1.EventEmitter {
|
|
|
720
748
|
await newScene.refreshNotes();
|
|
721
749
|
}
|
|
722
750
|
catch (e) {
|
|
723
|
-
this.logger.debug(
|
|
751
|
+
this.logger.debug('No notes found.');
|
|
724
752
|
}
|
|
725
753
|
this.sceneList.set(newScene.address, newScene);
|
|
726
754
|
}
|
|
@@ -737,14 +765,6 @@ class ISY extends events_1.EventEmitter {
|
|
|
737
765
|
}
|
|
738
766
|
}
|
|
739
767
|
}
|
|
740
|
-
[Symbol.dispose]() {
|
|
741
|
-
try {
|
|
742
|
-
this.webSocket.close();
|
|
743
|
-
}
|
|
744
|
-
catch (e) {
|
|
745
|
-
this.logger.error(`Error closing websocket: ${e.message}`);
|
|
746
|
-
}
|
|
747
|
-
}
|
|
748
768
|
}
|
|
749
769
|
exports.ISY = ISY;
|
|
750
770
|
//# sourceMappingURL=ISY.js.map
|