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/esm/ISY.js
CHANGED
|
@@ -1,54 +1,55 @@
|
|
|
1
|
-
import WebSocket from
|
|
2
|
-
import { writeFile } from
|
|
3
|
-
import { Parser } from
|
|
4
|
-
import { parseBooleans, parseNumbers } from
|
|
5
|
-
import { XmlDocument } from
|
|
6
|
-
import axios from
|
|
7
|
-
import { EventEmitter } from
|
|
8
|
-
import
|
|
9
|
-
import { Category } from
|
|
10
|
-
import { Family } from
|
|
11
|
-
import { DeviceFactory } from
|
|
12
|
-
import { ELKAlarmPanelDevice } from
|
|
13
|
-
import { ElkAlarmSensorDevice } from
|
|
14
|
-
import { InsteonBaseDevice } from
|
|
15
|
-
import { InsteonOutletDevice } from
|
|
16
|
-
import { InsteonDimmableDevice } from
|
|
17
|
-
import { InsteonDimmerOutletDevice } from
|
|
18
|
-
import { InsteonDimmerSwitchDevice } from
|
|
19
|
-
import { InsteonDoorWindowSensorDevice } from
|
|
20
|
-
import { InsteonFanDevice, InsteonFanMotorDevice } from
|
|
21
|
-
import { InsteonKeypadButtonDevice } from
|
|
22
|
-
import { InsteonKeypadDimmerDevice } from
|
|
23
|
-
import { InsteonKeypadRelayDevice } from
|
|
24
|
-
import { InsteonLeakSensorDevice } from
|
|
25
|
-
import { InsteonLockDevice } from
|
|
26
|
-
import { InsteonMotionSensorDevice } from
|
|
27
|
-
import { InsteonOnOffOutletDevice } from
|
|
28
|
-
import { InsteonRelayDevice } from
|
|
29
|
-
import { InsteonSmokeSensorDevice } from
|
|
30
|
-
import { InsteonThermostatDevice } from
|
|
31
|
-
import {
|
|
32
|
-
import {
|
|
33
|
-
import {
|
|
34
|
-
import {
|
|
35
|
-
import { ISYScene } from
|
|
36
|
-
import { ISYVariable } from
|
|
37
|
-
import * as Utils from
|
|
38
|
-
import { XMLParser } from
|
|
1
|
+
import WebSocket from 'faye-websocket';
|
|
2
|
+
import { writeFile } from 'fs';
|
|
3
|
+
import { Parser } from 'xml2js';
|
|
4
|
+
import { parseBooleans, parseNumbers } from 'xml2js/lib/processors.js';
|
|
5
|
+
import { XmlDocument } from 'xmldoc';
|
|
6
|
+
import axios from 'axios';
|
|
7
|
+
import { EventEmitter } from 'events';
|
|
8
|
+
import { format, Logger, loggers } from 'winston';
|
|
9
|
+
import { Category } from './Definitions/Global/Categories.js';
|
|
10
|
+
import { Family } from './Definitions/Global/Families.js';
|
|
11
|
+
import { DeviceFactory } from './Devices/DeviceFactory.js';
|
|
12
|
+
import { ELKAlarmPanelDevice } from './Devices/Elk/ElkAlarmPanelDevice.js';
|
|
13
|
+
import { ElkAlarmSensorDevice } from './Devices/Elk/ElkAlarmSensorDevice.js';
|
|
14
|
+
import { InsteonBaseDevice } from './Devices/Insteon/InsteonBaseDevice.js';
|
|
15
|
+
import { InsteonOutletDevice } from './Devices/Insteon/InsteonDevice.js';
|
|
16
|
+
import { InsteonDimmableDevice } from './Devices/Insteon/InsteonDimmableDevice.js';
|
|
17
|
+
import { InsteonDimmerOutletDevice } from './Devices/Insteon/InsteonDimmerOutletDevice.js';
|
|
18
|
+
import { InsteonDimmerSwitchDevice } from './Devices/Insteon/InsteonDimmerSwitchDevice.js';
|
|
19
|
+
import { InsteonDoorWindowSensorDevice } from './Devices/Insteon/InsteonDoorWindowSensorDevice.js';
|
|
20
|
+
import { InsteonFanDevice, InsteonFanMotorDevice } from './Devices/Insteon/InsteonFanDevice.js';
|
|
21
|
+
import { InsteonKeypadButtonDevice } from './Devices/Insteon/InsteonKeypadDevice.js';
|
|
22
|
+
import { InsteonKeypadDimmerDevice } from './Devices/Insteon/InsteonKeypadDimmerDevice.js';
|
|
23
|
+
import { InsteonKeypadRelayDevice } from './Devices/Insteon/InsteonKeypadRelayDevice.js';
|
|
24
|
+
import { InsteonLeakSensorDevice } from './Devices/Insteon/InsteonLeakSensorDevice.js';
|
|
25
|
+
import { InsteonLockDevice } from './Devices/Insteon/InsteonLockDevice.js';
|
|
26
|
+
import { InsteonMotionSensorDevice } from './Devices/Insteon/InsteonMotionSensorDevice.js';
|
|
27
|
+
import { InsteonOnOffOutletDevice } from './Devices/Insteon/InsteonOnOffOutletDevice.js';
|
|
28
|
+
import { InsteonRelayDevice } from './Devices/Insteon/InsteonRelayDevice.js';
|
|
29
|
+
import { InsteonSmokeSensorDevice } from './Devices/Insteon/InsteonSmokeSensorDevice.js';
|
|
30
|
+
import { InsteonThermostatDevice } from './Devices/Insteon/InsteonThermostatDevice.js';
|
|
31
|
+
import { ISYDeviceNode } from './Devices/ISYDeviceNode.js';
|
|
32
|
+
import { EventType } from './Events/EventType.js';
|
|
33
|
+
import { NodeType, Props, States, VariableType } from './ISYConstants.js';
|
|
34
|
+
import { ISYNode } from './ISYNode.js';
|
|
35
|
+
import { ISYScene } from './ISYScene.js';
|
|
36
|
+
import { ISYVariable } from './ISYVariable.js';
|
|
37
|
+
import * as Utils from './Utils.js';
|
|
38
|
+
import { XMLParser } from 'fast-xml-parser';
|
|
39
39
|
import { NodeFactory } from './Devices/NodeFactory.js';
|
|
40
|
-
|
|
40
|
+
import { findPackageJson } from './Utils.js';
|
|
41
|
+
export { Category as Categories, ELKAlarmPanelDevice, ElkAlarmSensorDevice, Family, InsteonBaseDevice, InsteonDimmableDevice, InsteonDimmerOutletDevice, InsteonDimmerSwitchDevice, InsteonDoorWindowSensorDevice, InsteonFanDevice, InsteonFanMotorDevice, InsteonKeypadButtonDevice, InsteonKeypadDimmerDevice, InsteonKeypadRelayDevice, InsteonLeakSensorDevice, InsteonLockDevice, InsteonMotionSensorDevice, InsteonOnOffOutletDevice, InsteonOutletDevice, InsteonRelayDevice, InsteonSmokeSensorDevice, InsteonThermostatDevice, ISYDeviceNode as ISYDevice, ISYNode, ISYScene, ISYVariable, NodeType, Props, States, Utils, VariableType };
|
|
41
42
|
const defaultParserOptions = {
|
|
42
43
|
explicitArray: false,
|
|
43
44
|
mergeAttrs: true,
|
|
44
45
|
attrValueProcessors: [parseNumbers, parseBooleans],
|
|
45
46
|
valueProcessors: [parseNumbers, parseBooleans],
|
|
46
|
-
tagNameProcessors: [(tagName) => (tagName ===
|
|
47
|
+
tagNameProcessors: [(tagName) => (tagName === 'st' || tagName === 'cmd' || tagName === 'nodeDef' ? '' : tagName)]
|
|
47
48
|
};
|
|
48
49
|
const defaultXMLParserOptions = {
|
|
49
50
|
parseAttributeValue: true,
|
|
50
51
|
allowBooleanAttributes: true,
|
|
51
|
-
attributeNamePrefix:
|
|
52
|
+
attributeNamePrefix: '',
|
|
52
53
|
attributesGroupName: false,
|
|
53
54
|
ignoreAttributes: false,
|
|
54
55
|
// updateTag(tagName, jPath, attrs) {
|
|
@@ -56,20 +57,20 @@ const defaultXMLParserOptions = {
|
|
|
56
57
|
// // return false;
|
|
57
58
|
// //return tagName;
|
|
58
59
|
// },
|
|
59
|
-
textNodeName:
|
|
60
|
-
commentPropName:
|
|
61
|
-
cdataPropName:
|
|
60
|
+
textNodeName: '_',
|
|
61
|
+
commentPropName: '$comment',
|
|
62
|
+
cdataPropName: '$cdata',
|
|
62
63
|
ignoreDeclaration: true,
|
|
63
64
|
tagValueProcessor: (tagName, tagValue, jPath, hasAttributes, isLeafNode) => {
|
|
64
|
-
if (tagValue ===
|
|
65
|
+
if (tagValue === '')
|
|
65
66
|
return null;
|
|
66
67
|
return tagValue;
|
|
67
68
|
},
|
|
68
69
|
isArray(tagName, jPath, isLeafNode, isAttribute) {
|
|
69
|
-
if (tagName ===
|
|
70
|
+
if (tagName === 'property')
|
|
70
71
|
return true;
|
|
71
72
|
return false;
|
|
72
|
-
}
|
|
73
|
+
}
|
|
73
74
|
};
|
|
74
75
|
axios.defaults.transitional.forcedJSONParsing = false;
|
|
75
76
|
const parser = new Parser(defaultParserOptions);
|
|
@@ -90,7 +91,7 @@ export class ISY extends EventEmitter {
|
|
|
90
91
|
sceneList = new Map();
|
|
91
92
|
storagePath;
|
|
92
93
|
variableList = new Map();
|
|
93
|
-
wsprotocol =
|
|
94
|
+
wsprotocol = 'ws';
|
|
94
95
|
zoneMap = new Map();
|
|
95
96
|
static instance;
|
|
96
97
|
configInfo;
|
|
@@ -102,35 +103,36 @@ export class ISY extends EventEmitter {
|
|
|
102
103
|
model;
|
|
103
104
|
nodesLoaded = false;
|
|
104
105
|
productId = 5226;
|
|
105
|
-
productName =
|
|
106
|
+
productName = 'eisy';
|
|
106
107
|
serverVersion;
|
|
107
|
-
vendorName =
|
|
108
|
+
vendorName = 'Universal Devices, Inc.';
|
|
108
109
|
webSocket;
|
|
110
|
+
apiVersion;
|
|
109
111
|
// #endregion Properties (30)
|
|
110
112
|
// #region Constructors (1)
|
|
111
113
|
constructor(config, logger = new Logger(), storagePath) {
|
|
112
114
|
super();
|
|
113
115
|
this.enableWebSocket = config.enableWebSocket ?? true;
|
|
114
|
-
this.storagePath = storagePath ??
|
|
115
|
-
this.displayNameFormat = config.displayNameFormat ??
|
|
116
|
+
this.storagePath = storagePath ?? './';
|
|
117
|
+
this.displayNameFormat = config.displayNameFormat ?? '${location ?? folder} ${spokenName ?? name}';
|
|
116
118
|
this.host = config.host;
|
|
117
119
|
this.port = config.port;
|
|
118
120
|
this.credentials = {
|
|
119
121
|
username: config.username,
|
|
120
|
-
password: config.password
|
|
122
|
+
password: config.password
|
|
121
123
|
};
|
|
122
124
|
this.protocol = config.protocol;
|
|
123
|
-
this.wsprotocol = config.protocol ===
|
|
125
|
+
this.wsprotocol = config.protocol === 'https' ? 'wss' : 'ws';
|
|
124
126
|
this.elkEnabled = config.elkEnabled ?? false;
|
|
125
127
|
this.nodesLoaded = false;
|
|
126
128
|
var fopts = format((info) => {
|
|
127
129
|
info.message = JSON.stringify(info.message);
|
|
128
130
|
return info;
|
|
129
|
-
})({ label:
|
|
130
|
-
this.logger = loggers.add(
|
|
131
|
+
})({ label: 'ISY' });
|
|
132
|
+
this.logger = loggers.add('isy', {
|
|
131
133
|
transports: logger.transports,
|
|
132
134
|
levels: logger.levels,
|
|
133
|
-
format: format.label({ label:
|
|
135
|
+
format: format.label({ label: 'ISY' })
|
|
134
136
|
});
|
|
135
137
|
this.guardianTimer = null;
|
|
136
138
|
if (this.elkEnabled) {
|
|
@@ -147,7 +149,15 @@ export class ISY extends EventEmitter {
|
|
|
147
149
|
return this.logger?.isDebugEnabled();
|
|
148
150
|
}
|
|
149
151
|
// #endregion Public Getters And Setters (2)
|
|
150
|
-
// #region Public Methods (
|
|
152
|
+
// #region Public Methods (24)
|
|
153
|
+
[Symbol.dispose]() {
|
|
154
|
+
try {
|
|
155
|
+
this.webSocket?.close();
|
|
156
|
+
}
|
|
157
|
+
catch (e) {
|
|
158
|
+
this.logger.error(`Error closing websocket: ${e.message}`);
|
|
159
|
+
}
|
|
160
|
+
}
|
|
151
161
|
emit(event, node) {
|
|
152
162
|
return super.emit(event, node);
|
|
153
163
|
}
|
|
@@ -165,6 +175,9 @@ export class ISY extends EventEmitter {
|
|
|
165
175
|
}
|
|
166
176
|
return s;
|
|
167
177
|
}
|
|
178
|
+
getElkAlarmPanel() {
|
|
179
|
+
return this.elkAlarmPanel;
|
|
180
|
+
}
|
|
168
181
|
getNode(address, parentsOnly = false) {
|
|
169
182
|
let s = this.nodeMap.get(address);
|
|
170
183
|
if (!parentsOnly) {
|
|
@@ -179,9 +192,6 @@ export class ISY extends EventEmitter {
|
|
|
179
192
|
}
|
|
180
193
|
return s;
|
|
181
194
|
}
|
|
182
|
-
getElkAlarmPanel() {
|
|
183
|
-
return this.elkAlarmPanel;
|
|
184
|
-
}
|
|
185
195
|
getScene(address) {
|
|
186
196
|
return this.sceneList.get(address);
|
|
187
197
|
}
|
|
@@ -216,7 +226,7 @@ export class ISY extends EventEmitter {
|
|
|
216
226
|
else if (evt.action instanceof Number || evt.action instanceof String) {
|
|
217
227
|
actionValue = Number(evt.action);
|
|
218
228
|
}
|
|
219
|
-
const stringControl = Number(evt.control?.replace(
|
|
229
|
+
const stringControl = Number(evt.control?.replace('_', ''));
|
|
220
230
|
switch (stringControl) {
|
|
221
231
|
case EventType.Elk:
|
|
222
232
|
if (actionValue === 2) {
|
|
@@ -245,11 +255,16 @@ export class ISY extends EventEmitter {
|
|
|
245
255
|
this.logger.debug(`Received ${EventType[Number(stringControl)]} Signal from ISY: ${JSON.stringify(evt)}`);
|
|
246
256
|
break;
|
|
247
257
|
default:
|
|
248
|
-
if (evt.node !==
|
|
258
|
+
if (evt.node !== '' && evt.node !== undefined && evt.node !== null) {
|
|
249
259
|
//
|
|
250
|
-
const impactedDevice = this.
|
|
260
|
+
const impactedDevice = this.getNode(evt.node);
|
|
251
261
|
if (impactedDevice !== undefined && impactedDevice !== null) {
|
|
252
|
-
|
|
262
|
+
try {
|
|
263
|
+
impactedDevice.handleEvent(evt);
|
|
264
|
+
}
|
|
265
|
+
catch (e) {
|
|
266
|
+
this.logger.error(`Error handling event for ${impactedDevice.name}: ${e.message}`);
|
|
267
|
+
}
|
|
253
268
|
}
|
|
254
269
|
else {
|
|
255
270
|
this.logger.warn(`${EventType[stringControl]} Event for Unidentified Device: ${JSON.stringify(evt)}`);
|
|
@@ -268,6 +283,7 @@ export class ISY extends EventEmitter {
|
|
|
268
283
|
async initialize() {
|
|
269
284
|
const that = this;
|
|
270
285
|
try {
|
|
286
|
+
this.apiVersion = (await findPackageJson()).content.version;
|
|
271
287
|
await this.loadConfig();
|
|
272
288
|
await this.loadNodes();
|
|
273
289
|
await this.loadVariables(VariableType.Integer);
|
|
@@ -276,7 +292,7 @@ export class ISY extends EventEmitter {
|
|
|
276
292
|
await this.#finishInitialize(true);
|
|
277
293
|
}
|
|
278
294
|
catch (e) {
|
|
279
|
-
this.handleInitializeError(
|
|
295
|
+
this.handleInitializeError('initialize', e);
|
|
280
296
|
}
|
|
281
297
|
finally {
|
|
282
298
|
if (this.nodesLoaded !== true) {
|
|
@@ -287,7 +303,7 @@ export class ISY extends EventEmitter {
|
|
|
287
303
|
}
|
|
288
304
|
initializeWebSocket() {
|
|
289
305
|
const that = this;
|
|
290
|
-
const auth = `Basic ${Buffer.from(`${this.credentials.username}:${this.credentials.password}`).toString(
|
|
306
|
+
const auth = `Basic ${Buffer.from(`${this.credentials.username}:${this.credentials.password}`).toString('base64')}`;
|
|
291
307
|
this.logger.info(`Opening webSocket: ${this.wsprotocol}://${this.address}/rest/subscribe`);
|
|
292
308
|
if (this.webSocket) {
|
|
293
309
|
try {
|
|
@@ -297,42 +313,42 @@ export class ISY extends EventEmitter {
|
|
|
297
313
|
this.logger.warn(`Error closing existing websocket: ${e.message}`);
|
|
298
314
|
}
|
|
299
315
|
}
|
|
300
|
-
this.webSocket = new WebSocket.Client(`${this.wsprotocol}://${this.address}/rest/subscribe`, [
|
|
316
|
+
this.webSocket = new WebSocket.Client(`${this.wsprotocol}://${this.address}/rest/subscribe`, ['ISYSUB'], {
|
|
301
317
|
headers: {
|
|
302
|
-
Origin:
|
|
303
|
-
Authorization: auth
|
|
318
|
+
Origin: 'com.universal-devices.websockets.isy',
|
|
319
|
+
Authorization: auth
|
|
304
320
|
},
|
|
305
|
-
ping: 10
|
|
321
|
+
ping: 10
|
|
306
322
|
});
|
|
307
323
|
this.lastActivity = new Date();
|
|
308
324
|
this.webSocket
|
|
309
|
-
.on(
|
|
325
|
+
.on('message', (event) => {
|
|
310
326
|
that.logger.silly(`Received message: ${JSON.stringify(event.data, null, 2)}`);
|
|
311
327
|
that.handleWebSocketMessage(event);
|
|
312
328
|
})
|
|
313
|
-
.on(
|
|
329
|
+
.on('error', (err, response) => {
|
|
314
330
|
that.logger.warn(`Websocket subscription error: ${JSON.stringify(err.message)}`);
|
|
315
331
|
/// throw new Error('Error calling ISY' + err);
|
|
316
332
|
})
|
|
317
|
-
.on(
|
|
333
|
+
.on('fail', (data, response) => {
|
|
318
334
|
that.logger.warn(`Websocket subscription failure: ${data}`);
|
|
319
|
-
throw new Error(
|
|
335
|
+
throw new Error('Failed calling ISY');
|
|
320
336
|
})
|
|
321
|
-
.on(
|
|
322
|
-
that.logger.warn(
|
|
323
|
-
throw new Error(
|
|
337
|
+
.on('abort', () => {
|
|
338
|
+
that.logger.warn('Websocket subscription aborted.');
|
|
339
|
+
throw new Error('Call to ISY was aborted');
|
|
324
340
|
})
|
|
325
|
-
.on(
|
|
341
|
+
.on('timeout', (ms) => {
|
|
326
342
|
that.logger.warn(`Websocket subscription timed out after ${ms} milliseconds.`);
|
|
327
|
-
throw new Error(
|
|
343
|
+
throw new Error('Timeout contacting ISY');
|
|
328
344
|
});
|
|
329
345
|
}
|
|
330
346
|
async loadConfig() {
|
|
331
347
|
try {
|
|
332
|
-
this.logger.info(
|
|
333
|
-
const configuration = (await this.sendRequest(
|
|
348
|
+
this.logger.info('Loading ISY Config');
|
|
349
|
+
const configuration = (await this.sendRequest('config')).configuration;
|
|
334
350
|
if (this.isDebugEnabled) {
|
|
335
|
-
writeFile(this.storagePath +
|
|
351
|
+
writeFile(this.storagePath + '/ISYConfigDump.json', JSON.stringify(configuration), this.logger.error);
|
|
336
352
|
}
|
|
337
353
|
const controls = configuration.controls;
|
|
338
354
|
this.model = configuration.deviceSpecs.model;
|
|
@@ -354,18 +370,18 @@ export class ISY extends EventEmitter {
|
|
|
354
370
|
return configuration;
|
|
355
371
|
}
|
|
356
372
|
catch (e) {
|
|
357
|
-
this.handleInitializeError(
|
|
373
|
+
this.handleInitializeError('config', e);
|
|
358
374
|
throw Error(`Error Loading Config: ${e.message}`);
|
|
359
375
|
}
|
|
360
376
|
}
|
|
361
377
|
async loadNodes() {
|
|
362
378
|
try {
|
|
363
|
-
const result = await this.sendRequest(
|
|
379
|
+
const result = await this.sendRequest('nodes');
|
|
364
380
|
if (this.isDebugEnabled)
|
|
365
|
-
writeFile(this.storagePath +
|
|
366
|
-
await this.#readFolderNodes(result).catch((p) => this.logger.error(
|
|
367
|
-
await this.#readDeviceNodes(result).catch((p) => this.logger.error(
|
|
368
|
-
await this.#readSceneNodes(result).catch((p) => this.logger.error(
|
|
381
|
+
writeFile(this.storagePath + '/ISYNodesDump.json', JSON.stringify(result), this.logger.error);
|
|
382
|
+
await this.#readFolderNodes(result).catch((p) => this.logger.error('Error Loading Folders', p));
|
|
383
|
+
await this.#readDeviceNodes(result).catch((p) => this.logger.error('Error Loading Devices', p));
|
|
384
|
+
await this.#readSceneNodes(result).catch((p) => this.logger.error('Error Loading Scenes', p));
|
|
369
385
|
return result;
|
|
370
386
|
}
|
|
371
387
|
catch (e) {
|
|
@@ -394,9 +410,9 @@ export class ISY extends EventEmitter {
|
|
|
394
410
|
async refreshStatuses() {
|
|
395
411
|
try {
|
|
396
412
|
const that = this;
|
|
397
|
-
const result = await that.sendRequest(
|
|
413
|
+
const result = await that.sendRequest('status');
|
|
398
414
|
if (that.isDebugEnabled) {
|
|
399
|
-
writeFile(that.storagePath +
|
|
415
|
+
writeFile(that.storagePath + '/ISYStatusDump.json', JSON.stringify(result), this.logger.error);
|
|
400
416
|
}
|
|
401
417
|
this.logger.debug(result);
|
|
402
418
|
for (const node of result.nodes.node) {
|
|
@@ -451,14 +467,14 @@ export class ISY extends EventEmitter {
|
|
|
451
467
|
async sendNodeCommand(node, command, parameters) {
|
|
452
468
|
let uriToUse = `nodes/${node.address}/cmd/${command}`;
|
|
453
469
|
if (parameters !== null && parameters !== undefined) {
|
|
454
|
-
if (typeof parameters ==
|
|
470
|
+
if (typeof parameters == 'object') {
|
|
455
471
|
var q = parameters;
|
|
456
472
|
for (const paramName of Object.getOwnPropertyNames(q)) {
|
|
457
473
|
uriToUse += `/${paramName}/${q[paramName]}`;
|
|
458
474
|
}
|
|
459
475
|
//uriToUse += `/${q[((p : Record<string,number|number>) => `${p[]}/${p.paramValue}` ).join('/')}`;
|
|
460
476
|
}
|
|
461
|
-
else if (typeof parameters ==
|
|
477
|
+
else if (typeof parameters == 'number' || typeof parameters == 'string') {
|
|
462
478
|
uriToUse += `/${parameters}`;
|
|
463
479
|
}
|
|
464
480
|
}
|
|
@@ -466,37 +482,41 @@ export class ISY extends EventEmitter {
|
|
|
466
482
|
return this.sendRequest(uriToUse);
|
|
467
483
|
}
|
|
468
484
|
async sendRequest(url, options = { trailingSlash: true }) {
|
|
469
|
-
const requestLogLevel = options.requestLogLevel ??
|
|
470
|
-
const responseLogLevel = options.responseLogLevel ??
|
|
471
|
-
url = `${this.protocol}://${this.address}/rest/${url}${options.trailingSlash ?
|
|
472
|
-
this.logger.log(`Sending request: ${url}
|
|
485
|
+
const requestLogLevel = options.requestLogLevel ?? 'debug';
|
|
486
|
+
const responseLogLevel = options.responseLogLevel ?? 'silly';
|
|
487
|
+
url = `${this.protocol}://${this.address}/rest/${url}${options.trailingSlash ? '/' : ''}`;
|
|
488
|
+
this.logger.log(requestLogLevel, `Sending request: ${url}`);
|
|
473
489
|
try {
|
|
474
490
|
const response = await axios.get(url, {
|
|
475
|
-
auth: { username: this.credentials.username, password: this.credentials.password }
|
|
491
|
+
auth: { username: this.credentials.username, password: this.credentials.password }
|
|
476
492
|
});
|
|
477
493
|
if (response.data) {
|
|
478
|
-
if (response.headers[
|
|
494
|
+
if (response.headers['content-type'].toString().includes('xml')) {
|
|
479
495
|
let curParser = parser;
|
|
480
496
|
if (options.parserOptions)
|
|
481
497
|
curParser = new Parser({ ...defaultParserOptions, ...options.parserOptions });
|
|
482
498
|
var altParser = new XMLParser(defaultXMLParserOptions);
|
|
483
499
|
var s = altParser.parse(response.data);
|
|
484
|
-
this.logger.log(`Response: ${JSON.stringify(s)}
|
|
500
|
+
this.logger.log(requestLogLevel ?? 'debug', `Response: ${JSON.stringify(s)}`);
|
|
485
501
|
return s;
|
|
486
502
|
}
|
|
487
|
-
else if (response.headers[
|
|
488
|
-
this.logger.log(`Response: ${JSON.stringify(response.data)}
|
|
503
|
+
else if (response.headers['content-type'].toString().includes('json')) {
|
|
504
|
+
this.logger.log(responseLogLevel ?? 'debug', `Response: ${JSON.stringify(response.data)}`);
|
|
489
505
|
return JSON.parse(response.data);
|
|
490
506
|
}
|
|
491
507
|
else {
|
|
492
|
-
this.logger.log(`Response Header: ${JSON.stringify(response.headers)} Response: ${JSON.stringify(response.data)}
|
|
508
|
+
this.logger.log(responseLogLevel ?? 'debug', `Response Header: ${JSON.stringify(response.headers)} Response: ${JSON.stringify(response.data)}`);
|
|
493
509
|
return response.data;
|
|
494
510
|
}
|
|
495
511
|
}
|
|
496
512
|
}
|
|
497
513
|
catch (error) {
|
|
498
|
-
|
|
499
|
-
|
|
514
|
+
if (options.errorLogLevel) {
|
|
515
|
+
this.logger.log(options.errorLogLevel, `Error sending request to ISY: ${error?.message}`);
|
|
516
|
+
}
|
|
517
|
+
else {
|
|
518
|
+
this.logger.error(`Error sending request to ISY: ${error?.message}`);
|
|
519
|
+
}
|
|
500
520
|
}
|
|
501
521
|
}
|
|
502
522
|
async sendSetVariable(id, type, value, handleResult) {
|
|
@@ -504,15 +524,17 @@ export class ISY extends EventEmitter {
|
|
|
504
524
|
this.logger.info(`Sending ISY command...${uriToUse}`);
|
|
505
525
|
return this.sendRequest(uriToUse);
|
|
506
526
|
}
|
|
507
|
-
variableChangedHandler(variable) {
|
|
527
|
+
#variableChangedHandler(variable) {
|
|
508
528
|
this.logger.info(`Variable: ${variable.id} (${variable.type}) changed`);
|
|
509
529
|
}
|
|
510
|
-
|
|
530
|
+
close() {
|
|
531
|
+
if (this.webSocket)
|
|
532
|
+
this.webSocket.close();
|
|
533
|
+
}
|
|
534
|
+
// #endregion Public Methods (24)
|
|
511
535
|
// #region Private Methods (11)
|
|
512
536
|
#checkForFailure(response) {
|
|
513
|
-
return
|
|
514
|
-
response instanceof Error ||
|
|
515
|
-
(response.RestResponse !== undefined && response.RestResponse.status !== 200));
|
|
537
|
+
return response === null || response instanceof Error || (response.RestResponse !== undefined && response.RestResponse.status !== 200);
|
|
516
538
|
}
|
|
517
539
|
#createVariableKey(type, id) {
|
|
518
540
|
return `${type}:${id}`;
|
|
@@ -540,17 +562,18 @@ export class ISY extends EventEmitter {
|
|
|
540
562
|
}
|
|
541
563
|
}
|
|
542
564
|
}
|
|
543
|
-
#guardian() {
|
|
565
|
+
async #guardian() {
|
|
544
566
|
const timeNow = new Date();
|
|
545
567
|
if (Number(timeNow) - Number(this.lastActivity) > 60000) {
|
|
546
|
-
this.logger.info(
|
|
547
|
-
this.
|
|
568
|
+
this.logger.info('Guardian: Detected no activity in more then 60 seconds. Reinitializing web sockets');
|
|
569
|
+
await this.refreshStatuses();
|
|
570
|
+
await this.initializeWebSocket();
|
|
548
571
|
}
|
|
549
572
|
}
|
|
550
573
|
#loadElkInitialStatus(result) {
|
|
551
574
|
const p = new Parser({
|
|
552
575
|
explicitArray: false,
|
|
553
|
-
mergeAttrs: true
|
|
576
|
+
mergeAttrs: true
|
|
554
577
|
});
|
|
555
578
|
p.parseString(result, (err, res) => {
|
|
556
579
|
if (err) {
|
|
@@ -574,7 +597,7 @@ export class ISY extends EventEmitter {
|
|
|
574
597
|
}
|
|
575
598
|
#loadElkNodes(result) {
|
|
576
599
|
const document = new XmlDocument(result);
|
|
577
|
-
const nodes = document.childNamed(
|
|
600
|
+
const nodes = document.childNamed('areas').childNamed('area').childrenNamed('zone');
|
|
578
601
|
for (let index = 0; index < nodes.length; index++) {
|
|
579
602
|
const id = nodes[index].attr.id;
|
|
580
603
|
const name = nodes[index].attr.name;
|
|
@@ -584,65 +607,70 @@ export class ISY extends EventEmitter {
|
|
|
584
607
|
}
|
|
585
608
|
}
|
|
586
609
|
async #readDeviceNodes(obj) {
|
|
587
|
-
this.logger.info(
|
|
610
|
+
this.logger.info('Loading Device Nodes');
|
|
588
611
|
for (const nodeInfo of obj.nodes.node) {
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
if (enabled) {
|
|
616
|
-
if (newDevice === null) {
|
|
617
|
-
this.logger.warn(`Device type resolution failed for ${nodeInfo.name} with type: ${nodeInfo.type} and nodedef: ${nodeInfo.nodeDefId}`);
|
|
618
|
-
newDevice = new ISYDeviceNode(this, nodeInfo);
|
|
612
|
+
try {
|
|
613
|
+
this.logger.debug(`Loading Device Node: ${JSON.stringify(nodeInfo)}`);
|
|
614
|
+
if (!this.deviceMap.has(nodeInfo.pnode)) {
|
|
615
|
+
const address = nodeInfo.address;
|
|
616
|
+
this.deviceMap[nodeInfo.pnode] = {
|
|
617
|
+
address
|
|
618
|
+
};
|
|
619
|
+
}
|
|
620
|
+
else {
|
|
621
|
+
this.deviceMap[nodeInfo.pnode].push(nodeInfo.address);
|
|
622
|
+
}
|
|
623
|
+
let newDevice = null;
|
|
624
|
+
// let deviceTypeInfo = this.isyTypeToTypeName(device.type, device.address);
|
|
625
|
+
// this.logger.info(JSON.stringify(deviceTypeInfo));
|
|
626
|
+
const enabled = nodeInfo.enabled ?? true;
|
|
627
|
+
const d = await NodeFactory.get(nodeInfo);
|
|
628
|
+
const m = DeviceFactory.getDeviceDetails(nodeInfo);
|
|
629
|
+
if (d) {
|
|
630
|
+
newDevice = new d(this, nodeInfo);
|
|
631
|
+
}
|
|
632
|
+
if (m) {
|
|
633
|
+
newDevice = newDevice ?? new m.class(this, nodeInfo);
|
|
634
|
+
newDevice.productName = m.name;
|
|
635
|
+
newDevice.model = `(${m.modelNumber}) ${m.name} v.${m.version}`;
|
|
636
|
+
newDevice.modelNumber = m.modelNumber;
|
|
637
|
+
newDevice.version = m.version;
|
|
619
638
|
}
|
|
620
|
-
|
|
621
|
-
if (
|
|
622
|
-
this.logger.warn(
|
|
639
|
+
if (enabled) {
|
|
640
|
+
if (newDevice === null) {
|
|
641
|
+
this.logger.warn(`Device type resolution failed for ${nodeInfo.name} with type: ${nodeInfo.type} and nodedef: ${nodeInfo.nodeDefId}`);
|
|
642
|
+
newDevice = new ISYDeviceNode(this, nodeInfo);
|
|
623
643
|
}
|
|
624
|
-
|
|
625
|
-
|
|
644
|
+
else if (newDevice !== null) {
|
|
645
|
+
if (m.unsupported) {
|
|
646
|
+
this.logger.warn('Device not currently supported: ' + JSON.stringify(nodeInfo) + ' /n It has been mapped to: ' + d.name);
|
|
647
|
+
}
|
|
648
|
+
try {
|
|
649
|
+
await newDevice.refreshNotes();
|
|
650
|
+
}
|
|
651
|
+
catch (e) {
|
|
652
|
+
this.logger.debug('No notes found.');
|
|
653
|
+
}
|
|
654
|
+
// if (!newDevice.hidden) {
|
|
655
|
+
// }
|
|
656
|
+
// this.deviceList.push(newDevice);
|
|
626
657
|
}
|
|
627
|
-
|
|
628
|
-
this.logger.debug("No notes found.");
|
|
658
|
+
else {
|
|
629
659
|
}
|
|
630
|
-
|
|
631
|
-
// }
|
|
632
|
-
// this.deviceList.push(newDevice);
|
|
660
|
+
this.nodeMap.set(newDevice.address, newDevice);
|
|
633
661
|
}
|
|
634
662
|
else {
|
|
663
|
+
this.logger.info(`Ignoring disabled device: ${nodeInfo.name}`);
|
|
635
664
|
}
|
|
636
|
-
this.nodeMap.set(newDevice.address, newDevice);
|
|
637
665
|
}
|
|
638
|
-
|
|
639
|
-
this.logger.
|
|
666
|
+
catch (e) {
|
|
667
|
+
this.logger.error(`Error loading device node: ${e.message}`);
|
|
640
668
|
}
|
|
641
669
|
}
|
|
642
670
|
this.logger.info(`${this.nodeMap.size} devices added.`);
|
|
643
671
|
}
|
|
644
672
|
async #readFolderNodes(result) {
|
|
645
|
-
this.logger.info(
|
|
673
|
+
this.logger.info('Loading Folder Nodes');
|
|
646
674
|
if (result?.nodes?.folder) {
|
|
647
675
|
for (const folder of result.nodes.folder) {
|
|
648
676
|
this.logger.info(`Loading Folder Node: ${JSON.stringify(folder)}`);
|
|
@@ -651,9 +679,9 @@ export class ISY extends EventEmitter {
|
|
|
651
679
|
}
|
|
652
680
|
}
|
|
653
681
|
async #readSceneNodes(result) {
|
|
654
|
-
this.logger.info(
|
|
682
|
+
this.logger.info('Loading Scene Nodes');
|
|
655
683
|
for (const scene of result.nodes?.group) {
|
|
656
|
-
if (scene.name ===
|
|
684
|
+
if (scene.name === 'ISY' || scene.name === 'IoX' || scene.name === 'Auto DR') {
|
|
657
685
|
continue;
|
|
658
686
|
} // Skip ISY & Auto DR Scenes
|
|
659
687
|
const newScene = new ISYScene(this, scene);
|
|
@@ -661,7 +689,7 @@ export class ISY extends EventEmitter {
|
|
|
661
689
|
await newScene.refreshNotes();
|
|
662
690
|
}
|
|
663
691
|
catch (e) {
|
|
664
|
-
this.logger.debug(
|
|
692
|
+
this.logger.debug('No notes found.');
|
|
665
693
|
}
|
|
666
694
|
this.sceneList.set(newScene.address, newScene);
|
|
667
695
|
}
|
|
@@ -678,13 +706,5 @@ export class ISY extends EventEmitter {
|
|
|
678
706
|
}
|
|
679
707
|
}
|
|
680
708
|
}
|
|
681
|
-
[Symbol.dispose]() {
|
|
682
|
-
try {
|
|
683
|
-
this.webSocket.close();
|
|
684
|
-
}
|
|
685
|
-
catch (e) {
|
|
686
|
-
this.logger.error(`Error closing websocket: ${e.message}`);
|
|
687
|
-
}
|
|
688
|
-
}
|
|
689
709
|
}
|
|
690
710
|
//# sourceMappingURL=ISY.js.map
|