zigbee-herdsman 0.48.1 → 0.49.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/.release-please-manifest.json +1 -1
- package/CHANGELOG.md +15 -0
- package/dist/adapter/ember/adapter/emberAdapter.d.ts +65 -5
- package/dist/adapter/ember/adapter/emberAdapter.d.ts.map +1 -1
- package/dist/adapter/ember/adapter/emberAdapter.js +159 -146
- package/dist/adapter/ember/adapter/emberAdapter.js.map +1 -1
- package/dist/zspec/zcl/definition/cluster.d.ts.map +1 -1
- package/dist/zspec/zcl/definition/cluster.js +0 -7
- package/dist/zspec/zcl/definition/cluster.js.map +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.49.1](https://github.com/Koenkk/zigbee-herdsman/compare/v0.49.0...v0.49.1) (2024-05-27)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fixes
|
|
7
|
+
|
|
8
|
+
* Fix `seMetering` cluster https://github.com/Koenkk/zigbee2mqtt/issues/22720 ([a76040f](https://github.com/Koenkk/zigbee-herdsman/commit/a76040fd08b5c59d66751f8cab04b749fb484b16))
|
|
9
|
+
* **ignore:** update dependencies ([#1074](https://github.com/Koenkk/zigbee-herdsman/issues/1074)) ([878bb57](https://github.com/Koenkk/zigbee-herdsman/commit/878bb57051ac559e8856ee5ae6e0614fde23cdc4))
|
|
10
|
+
|
|
11
|
+
## [0.49.0](https://github.com/Koenkk/zigbee-herdsman/compare/v0.48.1...v0.49.0) (2024-05-23)
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### Features
|
|
15
|
+
|
|
16
|
+
* Ember: Custom stack config support ([#1072](https://github.com/Koenkk/zigbee-herdsman/issues/1072)) ([bacf947](https://github.com/Koenkk/zigbee-herdsman/commit/bacf947192119fa4ac7d8fa44c89b95d4b9c7528))
|
|
17
|
+
|
|
3
18
|
## [0.48.1](https://github.com/Koenkk/zigbee-herdsman/compare/v0.48.0...v0.48.1) (2024-05-19)
|
|
4
19
|
|
|
5
20
|
|
|
@@ -23,6 +23,68 @@ type LinkKeyBackupData = {
|
|
|
23
23
|
outgoingFrameCounter: number;
|
|
24
24
|
incomingFrameCounter: number;
|
|
25
25
|
};
|
|
26
|
+
type StackConfig = {
|
|
27
|
+
CONCENTRATOR_RAM_TYPE: 'high' | 'low';
|
|
28
|
+
/**
|
|
29
|
+
* Minimum Time between broadcasts (in seconds) <1-60>
|
|
30
|
+
* Default: 10
|
|
31
|
+
* The minimum amount of time that must pass between MTORR broadcasts.
|
|
32
|
+
*/
|
|
33
|
+
CONCENTRATOR_MIN_TIME: number;
|
|
34
|
+
/**
|
|
35
|
+
* Maximum Time between broadcasts (in seconds) <30-300>
|
|
36
|
+
* Default: 60
|
|
37
|
+
* The maximum amount of time that can pass between MTORR broadcasts.
|
|
38
|
+
*/
|
|
39
|
+
CONCENTRATOR_MAX_TIME: number;
|
|
40
|
+
/**
|
|
41
|
+
* Route Error Threshold <1-100>
|
|
42
|
+
* Default: 3
|
|
43
|
+
* The number of route errors that will trigger a re-broadcast of the MTORR.
|
|
44
|
+
*/
|
|
45
|
+
CONCENTRATOR_ROUTE_ERROR_THRESHOLD: number;
|
|
46
|
+
/**
|
|
47
|
+
* Delivery Failure Threshold <1-100>
|
|
48
|
+
* Default: 1
|
|
49
|
+
* The number of APS delivery failures that will trigger a re-broadcast of the MTORR.
|
|
50
|
+
*/
|
|
51
|
+
CONCENTRATOR_DELIVERY_FAILURE_THRESHOLD: number;
|
|
52
|
+
/**
|
|
53
|
+
* Maximum number of hops for Broadcast <0-30>
|
|
54
|
+
* Default: 0
|
|
55
|
+
* The maximum number of hops that the MTORR broadcast will be allowed to have.
|
|
56
|
+
* A value of 0 will be converted to the EMBER_MAX_HOPS value set by the stack.
|
|
57
|
+
*/
|
|
58
|
+
CONCENTRATOR_MAX_HOPS: number;
|
|
59
|
+
/** <6-64> (Default: 6) @see EzspConfigId.MAX_END_DEVICE_CHILDREN */
|
|
60
|
+
MAX_END_DEVICE_CHILDREN: number;
|
|
61
|
+
/** <1-255> (Default: 10) @see EzspConfigId.APS_UNICAST_MESSAGE_COUNT */
|
|
62
|
+
APS_UNICAST_MESSAGE_COUNT: number;
|
|
63
|
+
/** <-> (Default: 16) @see EzspConfigId.RETRY_QUEUE_SIZE */
|
|
64
|
+
RETRY_QUEUE_SIZE: number;
|
|
65
|
+
/** <1-250> (Default: 2) @see EzspConfigId.ADDRESS_TABLE_SIZE */
|
|
66
|
+
ADDRESS_TABLE_SIZE: number;
|
|
67
|
+
/** <0-4> (Default: 2) @see EzspConfigId.TRUST_CENTER_ADDRESS_CACHE_SIZE */
|
|
68
|
+
TRUST_CENTER_ADDRESS_CACHE_SIZE: number;
|
|
69
|
+
/** <0-127> (Default: 0) @see EzspConfigId.KEY_TABLE_SIZE */
|
|
70
|
+
KEY_TABLE_SIZE: number;
|
|
71
|
+
/** <0-127> (Default: 2) @see EzspConfigId.BINDING_TABLE_SIZE */
|
|
72
|
+
BINDING_TABLE_SIZE: number;
|
|
73
|
+
/** <15-254> (Default: 15) @see EzspConfigId.BROADCAST_TABLE_SIZE */
|
|
74
|
+
BROADCAST_TABLE_SIZE: number;
|
|
75
|
+
/** <1-250> (Default: 8) @see EzspConfigId.MULTICAST_TABLE_SIZE */
|
|
76
|
+
MULTICAST_TABLE_SIZE: number;
|
|
77
|
+
/** [1, 16, 26] (Default: 16). @see EzspConfigId.NEIGHBOR_TABLE_SIZE */
|
|
78
|
+
NEIGHBOR_TABLE_SIZE: number;
|
|
79
|
+
/** <0-255> (Default: 0) @see EzspConfigId.SOURCE_ROUTE_TABLE_SIZE */
|
|
80
|
+
SOURCE_ROUTE_TABLE_SIZE: number;
|
|
81
|
+
/** <-> (Default: 10000) @see EzspValueId.TRANSIENT_DEVICE_TIMEOUT */
|
|
82
|
+
TRANSIENT_DEVICE_TIMEOUT: number;
|
|
83
|
+
/** <0-14> (Default: 8) @see EzspConfigId.END_DEVICE_POLL_TIMEOUT */
|
|
84
|
+
END_DEVICE_POLL_TIMEOUT: number;
|
|
85
|
+
/** <0-65535> (Default: 300) @see EzspConfigId.TRANSIENT_KEY_TIMEOUT_S */
|
|
86
|
+
TRANSIENT_KEY_TIMEOUT_S: number;
|
|
87
|
+
};
|
|
26
88
|
/**
|
|
27
89
|
* Relay calls between Z2M and EZSP-layer and handle any error that might occur via queue & waitress.
|
|
28
90
|
*
|
|
@@ -31,10 +93,7 @@ type LinkKeyBackupData = {
|
|
|
31
93
|
export declare class EmberAdapter extends Adapter {
|
|
32
94
|
/** Current manufacturer code assigned to the coordinator. Used for join workarounds... */
|
|
33
95
|
private manufacturerCode;
|
|
34
|
-
|
|
35
|
-
readonly stackConfig: 'default' | 'zigbeed';
|
|
36
|
-
/** EMBER_LOW_RAM_CONCENTRATOR or EMBER_HIGH_RAM_CONCENTRATOR. */
|
|
37
|
-
private readonly concentratorType;
|
|
96
|
+
readonly stackConfig: StackConfig;
|
|
38
97
|
private readonly ezsp;
|
|
39
98
|
private version;
|
|
40
99
|
private readonly requestQueue;
|
|
@@ -54,6 +113,7 @@ export declare class EmberAdapter extends Adapter {
|
|
|
54
113
|
*/
|
|
55
114
|
private networkCache;
|
|
56
115
|
constructor(networkOptions: TsType.NetworkOptions, serialPortOptions: TsType.SerialPortOptions, backupPath: string, adapterOptions: TsType.AdapterOptions);
|
|
116
|
+
private loadStackConfig;
|
|
57
117
|
/**
|
|
58
118
|
* Emitted from @see Ezsp.ezspStackStatusHandler
|
|
59
119
|
* @param status
|
|
@@ -181,7 +241,7 @@ export declare class EmberAdapter extends Adapter {
|
|
|
181
241
|
/**
|
|
182
242
|
* Loads currently stored backup and returns it in internal backup model.
|
|
183
243
|
*/
|
|
184
|
-
getStoredBackup
|
|
244
|
+
private getStoredBackup;
|
|
185
245
|
/**
|
|
186
246
|
* Export link keys for backup.
|
|
187
247
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"emberAdapter.d.ts","sourceRoot":"","sources":["../../../../src/adapter/ember/adapter/emberAdapter.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"emberAdapter.d.ts","sourceRoot":"","sources":["../../../../src/adapter/ember/adapter/emberAdapter.ts"],"names":[],"mappings":";AAOA,OAAO,EAAC,OAAO,EAAE,MAAM,EAAC,MAAM,OAAO,CAAC;AACtC,OAAO,EAAC,MAAM,EAAuB,MAAM,iBAAiB,CAAC;AAC7D,OAAO,KAAK,GAAG,MAAM,oBAAoB,CAAC;AAC1C,OAAO,EAKH,UAAU,EACb,MAAM,cAAc,CAAC;AAkBtB,OAAO,EASH,kBAAkB,EAerB,MAAM,UAAU,CAAC;AAClB,OAAO,EAGH,UAAU,EACV,kBAAkB,EAElB,YAAY,EAIZ,sBAAsB,EACtB,WAAW,EACX,UAAU,EAKb,MAAM,UAAU,CAAC;AA8ElB,OAAO,EAAC,gBAAgB,EAAC,MAAM,sBAAsB,CAAC;AAKtD,MAAM,MAAM,YAAY,GAAG;IAEvB,KAAK,EAAE,UAAU,CAAC;IAClB,UAAU,EAAE,sBAAsB,CAAC;IACnC,MAAM,EAAE,kBAAkB,CAAC;CAE9B,CAAC;AAGF;;;;;GAKG;AACH,KAAK,iBAAiB,GAAG;IACrB,WAAW,EAAE,UAAU,CAAC;IACxB,GAAG,EAAE,YAAY,CAAC;IAClB,oBAAoB,EAAE,MAAM,CAAC;IAC7B,oBAAoB,EAAE,MAAM,CAAC;CAChC,CAAC;AAsDF,KAAK,WAAW,GAAG;IACf,qBAAqB,EAAE,MAAM,GAAG,KAAK,CAAC;IACtC;;;;OAIG;IACH,qBAAqB,EAAE,MAAM,CAAC;IAC9B;;;;OAIG;IACH,qBAAqB,EAAE,MAAM,CAAC;IAC9B;;;;OAIG;IACH,kCAAkC,EAAE,MAAM,CAAC;IAC3C;;;;OAIG;IACH,uCAAuC,EAAE,MAAM,CAAC;IAChD;;;;;OAKG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M,GAAG,OAAO,CAAC,UAAU,CAAC;IAmExF,sBAAsB,IAAI,OAAO,CAAC,IAAI,CAAC;IA6BpD,OAAO,CAAC,iBAAiB;CAS5B"}
|
|
@@ -29,7 +29,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
29
29
|
exports.EmberAdapter = void 0;
|
|
30
30
|
/* istanbul ignore file */
|
|
31
31
|
const es6_1 = __importDefault(require("fast-deep-equal/es6"));
|
|
32
|
-
const
|
|
32
|
+
const fs_1 = require("fs");
|
|
33
|
+
const path_1 = __importDefault(require("path"));
|
|
33
34
|
const serialPortUtils_1 = __importDefault(require("../../serialPortUtils"));
|
|
34
35
|
const socketPortUtils_1 = __importDefault(require("../../socketPortUtils"));
|
|
35
36
|
const utils_1 = require("../../../utils");
|
|
@@ -86,30 +87,6 @@ const autoDetectDefinitions = [
|
|
|
86
87
|
/** NOTE: Manuf code "0x134B" for "Nabu Casa, Inc." */
|
|
87
88
|
{ manufacturer: 'Nabu Casa', vendorId: '10c4', productId: 'ea60' }, // Home Assistant SkyConnect
|
|
88
89
|
];
|
|
89
|
-
/**
|
|
90
|
-
* Config for EMBER_LOW_RAM_CONCENTRATOR type concentrator.
|
|
91
|
-
*
|
|
92
|
-
* Based on ZigbeeMinimalHost/zigpc
|
|
93
|
-
*/
|
|
94
|
-
const LOW_RAM_CONCENTRATOR_CONFIG = {
|
|
95
|
-
minTime: 5, // zigpc: 10
|
|
96
|
-
maxTime: 60, // zigpc: 60
|
|
97
|
-
routeErrorThreshold: 3, // zigpc: 3
|
|
98
|
-
deliveryFailureThreshold: 1, // zigpc: 1, ZigbeeMinimalHost: 3
|
|
99
|
-
mapHops: 0, // zigpc: 0
|
|
100
|
-
};
|
|
101
|
-
/**
|
|
102
|
-
* Config for EMBER_HIGH_RAM_CONCENTRATOR type concentrator.
|
|
103
|
-
*
|
|
104
|
-
* XXX: For now, same as low, until proper values can be determined.
|
|
105
|
-
*/
|
|
106
|
-
const HIGH_RAM_CONCENTRATOR_CONFIG = {
|
|
107
|
-
minTime: 5,
|
|
108
|
-
maxTime: 60,
|
|
109
|
-
routeErrorThreshold: 3,
|
|
110
|
-
deliveryFailureThreshold: 1,
|
|
111
|
-
mapHops: 0,
|
|
112
|
-
};
|
|
113
90
|
/**
|
|
114
91
|
* Application generated ZDO messages use sequence numbers 0-127, and the stack
|
|
115
92
|
* uses sequence numbers 128-255. This simplifies life by eliminating the need
|
|
@@ -129,80 +106,34 @@ const BACKUP_OLDEST_SUPPORTED_EZSP_VERSION = 12;
|
|
|
129
106
|
*/
|
|
130
107
|
const BROADCAST_NETWORK_KEY_SWITCH_WAIT_TIME = 15000;
|
|
131
108
|
/**
|
|
132
|
-
*
|
|
109
|
+
* Default stack configuration values.
|
|
110
|
+
* @see https://www.silabs.com/documents/public/user-guides/ug100-ezsp-reference-guide.pdf 2.3.1 for descriptions/RAM costs
|
|
133
111
|
*
|
|
134
112
|
* https://github.com/darkxst/silabs-firmware-builder/tree/main/manifests
|
|
135
113
|
* https://github.com/NabuCasa/silabs-firmware/wiki/Zigbee-EmberZNet-NCP-firmware-configuration#skyconnect
|
|
136
114
|
* https://github.com/SiliconLabs/UnifySDK/blob/main/applications/zigbeed/project_files/zigbeed.slcp
|
|
137
115
|
*/
|
|
138
|
-
const
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
TRANSIENT_DEVICE_TIMEOUT: 10000,
|
|
160
|
-
/** <0-127> (Default: 2) @see EzspConfigId.BINDING_TABLE_SIZE */
|
|
161
|
-
BINDING_TABLE_SIZE: 32, // zigpc: 2, Z3GatewayGPCombo: 5, nabucasa: 32
|
|
162
|
-
/** <0-127> (Default: 0) @see EzspConfigId.KEY_TABLE_SIZE */
|
|
163
|
-
KEY_TABLE_SIZE: 0, // zigpc: 4
|
|
164
|
-
/** <6-64> (Default: 6) @see EzspConfigId.MAX_END_DEVICE_CHILDREN */
|
|
165
|
-
MAX_END_DEVICE_CHILDREN: 32, // zigpc: 6, nabucasa: 32, Dongle-E (Sonoff firmware): 32
|
|
166
|
-
/** <1-255> (Default: 10) @see EzspConfigId.APS_UNICAST_MESSAGE_COUNT */
|
|
167
|
-
APS_UNICAST_MESSAGE_COUNT: 32, // zigpc: 10, darkxst: 20, nabucasa: 20
|
|
168
|
-
/** <15-254> (Default: 15) @see EzspConfigId.BROADCAST_TABLE_SIZE */
|
|
169
|
-
BROADCAST_TABLE_SIZE: 15, // zigpc: 15, Z3GatewayGPCombo: 35 - NOTE: Sonoff Dongle-E fails at 35
|
|
170
|
-
/** [1, 16, 26] (Default: 16). @see EzspConfigId.NEIGHBOR_TABLE_SIZE */
|
|
171
|
-
NEIGHBOR_TABLE_SIZE: 26, // zigpc: 16, darkxst: 26, nabucasa: 26
|
|
172
|
-
/** (Default: 8) @see EzspConfigId.END_DEVICE_POLL_TIMEOUT */
|
|
173
|
-
END_DEVICE_POLL_TIMEOUT: 8, // zigpc: 8
|
|
174
|
-
/** <0-65535> (Default: 300) @see EzspConfigId.TRANSIENT_KEY_TIMEOUT_S */
|
|
175
|
-
TRANSIENT_KEY_TIMEOUT_S: 300, // zigpc: 65535
|
|
176
|
-
/** <-> (Default: 16) @see EzspConfigId.RETRY_QUEUE_SIZE */
|
|
177
|
-
RETRY_QUEUE_SIZE: 16, // nabucasa: 16
|
|
178
|
-
/** <0-255> (Default: 0) @see EzspConfigId.SOURCE_ROUTE_TABLE_SIZE */
|
|
179
|
-
SOURCE_ROUTE_TABLE_SIZE: 200, // Z3GatewayGPCombo: 100, darkxst: 200, nabucasa: 200
|
|
180
|
-
/** <1-250> (Default: 8) @see EzspConfigId.MULTICAST_TABLE_SIZE */
|
|
181
|
-
MULTICAST_TABLE_SIZE: 16, // darkxst: 16, nabucasa: 16 - NOTE: should always be at least enough to register FIXED_ENDPOINTS multicastIds
|
|
182
|
-
},
|
|
183
|
-
"zigbeed": {
|
|
184
|
-
ADDRESS_TABLE_SIZE: 128,
|
|
185
|
-
TRUST_CENTER_ADDRESS_CACHE_SIZE: 2,
|
|
186
|
-
TX_POWER_MODE: enums_2.EmberTXPowerMode.USE_TOKEN,
|
|
187
|
-
SUPPORTED_NETWORKS: 1,
|
|
188
|
-
STACK_PROFILE: consts_2.STACK_PROFILE_ZIGBEE_PRO,
|
|
189
|
-
SECURITY_LEVEL: consts_2.SECURITY_LEVEL_Z3,
|
|
190
|
-
END_DEVICE_KEEP_ALIVE_SUPPORT_MODE: enums_2.EmberKeepAliveMode.KEEP_ALIVE_SUPPORT_ALL,
|
|
191
|
-
MAXIMUM_INCOMING_TRANSFER_SIZE: consts_2.MAXIMUM_APS_PAYLOAD_LENGTH,
|
|
192
|
-
MAXIMUM_OUTGOING_TRANSFER_SIZE: consts_2.MAXIMUM_APS_PAYLOAD_LENGTH,
|
|
193
|
-
TRANSIENT_DEVICE_TIMEOUT: 10000,
|
|
194
|
-
BINDING_TABLE_SIZE: 128,
|
|
195
|
-
KEY_TABLE_SIZE: 0, // zigbeed 128
|
|
196
|
-
MAX_END_DEVICE_CHILDREN: 64,
|
|
197
|
-
APS_UNICAST_MESSAGE_COUNT: 32,
|
|
198
|
-
BROADCAST_TABLE_SIZE: 15,
|
|
199
|
-
NEIGHBOR_TABLE_SIZE: 26,
|
|
200
|
-
END_DEVICE_POLL_TIMEOUT: 8,
|
|
201
|
-
TRANSIENT_KEY_TIMEOUT_S: 300,
|
|
202
|
-
RETRY_QUEUE_SIZE: 16,
|
|
203
|
-
SOURCE_ROUTE_TABLE_SIZE: 254,
|
|
204
|
-
MULTICAST_TABLE_SIZE: 128,
|
|
205
|
-
},
|
|
116
|
+
const DEFAULT_STACK_CONFIG = {
|
|
117
|
+
CONCENTRATOR_RAM_TYPE: 'high',
|
|
118
|
+
CONCENTRATOR_MIN_TIME: 5, // zigpc: 10
|
|
119
|
+
CONCENTRATOR_MAX_TIME: 60, // zigpc: 60
|
|
120
|
+
CONCENTRATOR_ROUTE_ERROR_THRESHOLD: 3, // zigpc: 3
|
|
121
|
+
CONCENTRATOR_DELIVERY_FAILURE_THRESHOLD: 1, // zigpc: 1, ZigbeeMinimalHost: 3
|
|
122
|
+
CONCENTRATOR_MAX_HOPS: 0, // zigpc: 0
|
|
123
|
+
MAX_END_DEVICE_CHILDREN: 32, // zigpc: 6, nabucasa: 32, Dongle-E (Sonoff firmware): 32
|
|
124
|
+
APS_UNICAST_MESSAGE_COUNT: 32, // zigpc: 10, darkxst: 20, nabucasa: 20
|
|
125
|
+
RETRY_QUEUE_SIZE: 16, // nabucasa: 16
|
|
126
|
+
ADDRESS_TABLE_SIZE: 16, // zigpc: 32, darkxst: 16, nabucasa: 16
|
|
127
|
+
TRUST_CENTER_ADDRESS_CACHE_SIZE: 2,
|
|
128
|
+
KEY_TABLE_SIZE: 0, // zigpc: 4
|
|
129
|
+
BINDING_TABLE_SIZE: 32, // zigpc: 2, Z3GatewayGPCombo: 5, nabucasa: 32
|
|
130
|
+
BROADCAST_TABLE_SIZE: 15, // zigpc: 15, Z3GatewayGPCombo: 35 - NOTE: Sonoff Dongle-E fails at 35
|
|
131
|
+
MULTICAST_TABLE_SIZE: 16, // darkxst: 16, nabucasa: 16 - NOTE: should always be at least enough to register FIXED_ENDPOINTS multicastIds
|
|
132
|
+
NEIGHBOR_TABLE_SIZE: 26, // zigpc: 16, darkxst: 26, nabucasa: 26
|
|
133
|
+
SOURCE_ROUTE_TABLE_SIZE: 200, // Z3GatewayGPCombo: 100, darkxst: 200, nabucasa: 200
|
|
134
|
+
TRANSIENT_DEVICE_TIMEOUT: 10000,
|
|
135
|
+
END_DEVICE_POLL_TIMEOUT: 8, // zigpc: 8
|
|
136
|
+
TRANSIENT_KEY_TIMEOUT_S: 300, // zigpc: 65535
|
|
206
137
|
};
|
|
207
138
|
/**
|
|
208
139
|
* NOTE: This from SDK is currently ignored here because of issues in below links:
|
|
@@ -246,10 +177,7 @@ const WORKAROUND_JOIN_MANUF_IEEE_PREFIX_TO_CODE = {
|
|
|
246
177
|
class EmberAdapter extends __1.Adapter {
|
|
247
178
|
/** Current manufacturer code assigned to the coordinator. Used for join workarounds... */
|
|
248
179
|
manufacturerCode;
|
|
249
|
-
/** Key in STACK_CONFIGS */
|
|
250
180
|
stackConfig;
|
|
251
|
-
/** EMBER_LOW_RAM_CONCENTRATOR or EMBER_HIGH_RAM_CONCENTRATOR. */
|
|
252
|
-
concentratorType;
|
|
253
181
|
ezsp;
|
|
254
182
|
version;
|
|
255
183
|
requestQueue;
|
|
@@ -270,11 +198,7 @@ class EmberAdapter extends __1.Adapter {
|
|
|
270
198
|
networkCache;
|
|
271
199
|
constructor(networkOptions, serialPortOptions, backupPath, adapterOptions) {
|
|
272
200
|
super(networkOptions, serialPortOptions, backupPath, adapterOptions);
|
|
273
|
-
|
|
274
|
-
// XXX: 'zigbeed': 4.4.x/7.4.x not supported by multiprotocol at the moment, will need refactoring when/if support is added
|
|
275
|
-
this.stackConfig = 'default';
|
|
276
|
-
// TODO config
|
|
277
|
-
this.concentratorType = consts_2.EMBER_HIGH_RAM_CONCENTRATOR;
|
|
201
|
+
this.stackConfig = this.loadStackConfig();
|
|
278
202
|
const delay = (typeof this.adapterOptions.delay === 'number') ? Math.min(Math.max(this.adapterOptions.delay, 5), 60) : 5;
|
|
279
203
|
logger_1.logger.debug(`Using delay=${delay}.`, NS);
|
|
280
204
|
this.requestQueue = new requestQueue_1.EmberRequestQueue(delay);
|
|
@@ -290,6 +214,102 @@ class EmberAdapter extends __1.Adapter {
|
|
|
290
214
|
this.ezsp.on(ezsp_1.EzspEvents.GREENPOWER_MESSAGE, this.onGreenpowerMessage.bind(this));
|
|
291
215
|
this.ezsp.on(ezsp_1.EzspEvents.TRUST_CENTER_JOIN, this.onTrustCenterJoin.bind(this));
|
|
292
216
|
}
|
|
217
|
+
loadStackConfig() {
|
|
218
|
+
// store stack config in same dir as backup
|
|
219
|
+
const configPath = path_1.default.join(path_1.default.dirname(this.backupPath), 'stack_config.json');
|
|
220
|
+
try {
|
|
221
|
+
const customConfig = JSON.parse((0, fs_1.readFileSync)(configPath, 'utf8'));
|
|
222
|
+
// set any undefined config to default
|
|
223
|
+
const config = { ...DEFAULT_STACK_CONFIG, ...customConfig };
|
|
224
|
+
const inRange = (value, min, max) => (value == undefined || value < min || value > max) ? false : true;
|
|
225
|
+
if (!['high', 'low'].includes(config.CONCENTRATOR_RAM_TYPE)) {
|
|
226
|
+
config.CONCENTRATOR_RAM_TYPE = DEFAULT_STACK_CONFIG.CONCENTRATOR_RAM_TYPE;
|
|
227
|
+
logger_1.logger.error(`[STACK CONFIG] Invalid CONCENTRATOR_RAM_TYPE, using default.`, NS);
|
|
228
|
+
}
|
|
229
|
+
if (!inRange(config.CONCENTRATOR_MIN_TIME, 1, 60) || (config.CONCENTRATOR_MIN_TIME >= config.CONCENTRATOR_MAX_TIME)) {
|
|
230
|
+
config.CONCENTRATOR_MIN_TIME = DEFAULT_STACK_CONFIG.CONCENTRATOR_MIN_TIME;
|
|
231
|
+
logger_1.logger.error(`[STACK CONFIG] Invalid CONCENTRATOR_MIN_TIME, using default.`, NS);
|
|
232
|
+
}
|
|
233
|
+
if (!inRange(config.CONCENTRATOR_MAX_TIME, 30, 300) || (config.CONCENTRATOR_MAX_TIME <= config.CONCENTRATOR_MIN_TIME)) {
|
|
234
|
+
config.CONCENTRATOR_MAX_TIME = DEFAULT_STACK_CONFIG.CONCENTRATOR_MAX_TIME;
|
|
235
|
+
logger_1.logger.error(`[STACK CONFIG] Invalid CONCENTRATOR_MAX_TIME, using default.`, NS);
|
|
236
|
+
}
|
|
237
|
+
if (!inRange(config.CONCENTRATOR_ROUTE_ERROR_THRESHOLD, 1, 100)) {
|
|
238
|
+
config.CONCENTRATOR_ROUTE_ERROR_THRESHOLD = DEFAULT_STACK_CONFIG.CONCENTRATOR_ROUTE_ERROR_THRESHOLD;
|
|
239
|
+
logger_1.logger.error(`[STACK CONFIG] Invalid CONCENTRATOR_ROUTE_ERROR_THRESHOLD, using default.`, NS);
|
|
240
|
+
}
|
|
241
|
+
if (!inRange(config.CONCENTRATOR_DELIVERY_FAILURE_THRESHOLD, 1, 100)) {
|
|
242
|
+
config.CONCENTRATOR_DELIVERY_FAILURE_THRESHOLD = DEFAULT_STACK_CONFIG.CONCENTRATOR_DELIVERY_FAILURE_THRESHOLD;
|
|
243
|
+
logger_1.logger.error(`[STACK CONFIG] Invalid CONCENTRATOR_DELIVERY_FAILURE_THRESHOLD, using default.`, NS);
|
|
244
|
+
}
|
|
245
|
+
if (!inRange(config.CONCENTRATOR_MAX_HOPS, 0, 30)) {
|
|
246
|
+
config.CONCENTRATOR_MAX_HOPS = DEFAULT_STACK_CONFIG.CONCENTRATOR_MAX_HOPS;
|
|
247
|
+
logger_1.logger.error(`[STACK CONFIG] Invalid CONCENTRATOR_MAX_HOPS, using default.`, NS);
|
|
248
|
+
}
|
|
249
|
+
if (!inRange(config.MAX_END_DEVICE_CHILDREN, 6, 64)) {
|
|
250
|
+
config.MAX_END_DEVICE_CHILDREN = DEFAULT_STACK_CONFIG.MAX_END_DEVICE_CHILDREN;
|
|
251
|
+
logger_1.logger.error(`[STACK CONFIG] Invalid MAX_END_DEVICE_CHILDREN, using default.`, NS);
|
|
252
|
+
}
|
|
253
|
+
if (!inRange(config.APS_UNICAST_MESSAGE_COUNT, 1, 255)) {
|
|
254
|
+
config.APS_UNICAST_MESSAGE_COUNT = DEFAULT_STACK_CONFIG.APS_UNICAST_MESSAGE_COUNT;
|
|
255
|
+
logger_1.logger.error(`[STACK CONFIG] Invalid APS_UNICAST_MESSAGE_COUNT, using default.`, NS);
|
|
256
|
+
}
|
|
257
|
+
if (!inRange(config.RETRY_QUEUE_SIZE, 0, 255)) {
|
|
258
|
+
config.RETRY_QUEUE_SIZE = DEFAULT_STACK_CONFIG.RETRY_QUEUE_SIZE;
|
|
259
|
+
logger_1.logger.error(`[STACK CONFIG] Invalid RETRY_QUEUE_SIZE, using default.`, NS);
|
|
260
|
+
}
|
|
261
|
+
if (!inRange(config.ADDRESS_TABLE_SIZE, 1, 250)) {
|
|
262
|
+
config.ADDRESS_TABLE_SIZE = DEFAULT_STACK_CONFIG.ADDRESS_TABLE_SIZE;
|
|
263
|
+
logger_1.logger.error(`[STACK CONFIG] Invalid ADDRESS_TABLE_SIZE, using default.`, NS);
|
|
264
|
+
}
|
|
265
|
+
if (!inRange(config.TRUST_CENTER_ADDRESS_CACHE_SIZE, 0, 4)) {
|
|
266
|
+
config.TRUST_CENTER_ADDRESS_CACHE_SIZE = DEFAULT_STACK_CONFIG.TRUST_CENTER_ADDRESS_CACHE_SIZE;
|
|
267
|
+
logger_1.logger.error(`[STACK CONFIG] Invalid TRUST_CENTER_ADDRESS_CACHE_SIZE, using default.`, NS);
|
|
268
|
+
}
|
|
269
|
+
if (!inRange(config.KEY_TABLE_SIZE, 0, 127)) {
|
|
270
|
+
config.KEY_TABLE_SIZE = DEFAULT_STACK_CONFIG.KEY_TABLE_SIZE;
|
|
271
|
+
logger_1.logger.error(`[STACK CONFIG] Invalid KEY_TABLE_SIZE, using default.`, NS);
|
|
272
|
+
}
|
|
273
|
+
if (!inRange(config.BINDING_TABLE_SIZE, 0, 127)) {
|
|
274
|
+
config.BINDING_TABLE_SIZE = DEFAULT_STACK_CONFIG.BINDING_TABLE_SIZE;
|
|
275
|
+
logger_1.logger.error(`[STACK CONFIG] Invalid BINDING_TABLE_SIZE, using default.`, NS);
|
|
276
|
+
}
|
|
277
|
+
if (!inRange(config.BROADCAST_TABLE_SIZE, 15, 254)) {
|
|
278
|
+
config.BROADCAST_TABLE_SIZE = DEFAULT_STACK_CONFIG.BROADCAST_TABLE_SIZE;
|
|
279
|
+
logger_1.logger.error(`[STACK CONFIG] Invalid BROADCAST_TABLE_SIZE, using default.`, NS);
|
|
280
|
+
}
|
|
281
|
+
// min should always be enough to cover `multicastIds` in `FIXED_ENDPOINTS`
|
|
282
|
+
if (!inRange(config.MULTICAST_TABLE_SIZE, 5, 250)) {
|
|
283
|
+
config.MULTICAST_TABLE_SIZE = DEFAULT_STACK_CONFIG.MULTICAST_TABLE_SIZE;
|
|
284
|
+
logger_1.logger.error(`[STACK CONFIG] Invalid MULTICAST_TABLE_SIZE, using default.`, NS);
|
|
285
|
+
}
|
|
286
|
+
if (![16, 26].includes(config.NEIGHBOR_TABLE_SIZE)) {
|
|
287
|
+
config.NEIGHBOR_TABLE_SIZE = DEFAULT_STACK_CONFIG.NEIGHBOR_TABLE_SIZE;
|
|
288
|
+
logger_1.logger.error(`[STACK CONFIG] Invalid NEIGHBOR_TABLE_SIZE, using default.`, NS);
|
|
289
|
+
}
|
|
290
|
+
if (!inRange(config.SOURCE_ROUTE_TABLE_SIZE, 0, 254)) {
|
|
291
|
+
config.SOURCE_ROUTE_TABLE_SIZE = DEFAULT_STACK_CONFIG.SOURCE_ROUTE_TABLE_SIZE;
|
|
292
|
+
logger_1.logger.error(`[STACK CONFIG] Invalid SOURCE_ROUTE_TABLE_SIZE, using default.`, NS);
|
|
293
|
+
}
|
|
294
|
+
if (!inRange(config.TRANSIENT_DEVICE_TIMEOUT, 0, 65535)) {
|
|
295
|
+
config.TRANSIENT_DEVICE_TIMEOUT = DEFAULT_STACK_CONFIG.TRANSIENT_DEVICE_TIMEOUT;
|
|
296
|
+
logger_1.logger.error(`[STACK CONFIG] Invalid TRANSIENT_DEVICE_TIMEOUT, using default.`, NS);
|
|
297
|
+
}
|
|
298
|
+
if (!inRange(config.END_DEVICE_POLL_TIMEOUT, 0, 14)) {
|
|
299
|
+
config.END_DEVICE_POLL_TIMEOUT = DEFAULT_STACK_CONFIG.END_DEVICE_POLL_TIMEOUT;
|
|
300
|
+
logger_1.logger.error(`[STACK CONFIG] Invalid END_DEVICE_POLL_TIMEOUT, using default.`, NS);
|
|
301
|
+
}
|
|
302
|
+
if (!inRange(config.TRANSIENT_KEY_TIMEOUT_S, 0, 65535)) {
|
|
303
|
+
config.TRANSIENT_KEY_TIMEOUT_S = DEFAULT_STACK_CONFIG.TRANSIENT_KEY_TIMEOUT_S;
|
|
304
|
+
logger_1.logger.error(`[STACK CONFIG] Invalid TRANSIENT_KEY_TIMEOUT_S, using default.`, NS);
|
|
305
|
+
}
|
|
306
|
+
logger_1.logger.info(`Using stack config ${JSON.stringify(config)}.`, NS);
|
|
307
|
+
return config;
|
|
308
|
+
}
|
|
309
|
+
catch { }
|
|
310
|
+
logger_1.logger.info(`Using default stack config.`, NS);
|
|
311
|
+
return DEFAULT_STACK_CONFIG;
|
|
312
|
+
}
|
|
293
313
|
/**
|
|
294
314
|
* Emitted from @see Ezsp.ezspStackStatusHandler
|
|
295
315
|
* @param status
|
|
@@ -587,37 +607,35 @@ class EmberAdapter extends __1.Adapter {
|
|
|
587
607
|
*/
|
|
588
608
|
async initNCPPreConfiguration() {
|
|
589
609
|
// this can only decrease, not increase, NCP-side value
|
|
590
|
-
await this.emberSetEzspConfigValue(enums_1.EzspConfigId.ADDRESS_TABLE_SIZE,
|
|
591
|
-
await this.emberSetEzspConfigValue(enums_1.EzspConfigId.TRUST_CENTER_ADDRESS_CACHE_SIZE,
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
await this.
|
|
601
|
-
await this.emberSetEzspConfigValue(enums_1.EzspConfigId.SUPPORTED_NETWORKS, STACK_CONFIGS[this.stackConfig].SUPPORTED_NETWORKS);
|
|
602
|
-
await this.emberSetEzspValue(enums_1.EzspValueId.END_DEVICE_KEEP_ALIVE_SUPPORT_MODE, 1, [STACK_CONFIGS[this.stackConfig].END_DEVICE_KEEP_ALIVE_SUPPORT_MODE]);
|
|
610
|
+
await this.emberSetEzspConfigValue(enums_1.EzspConfigId.ADDRESS_TABLE_SIZE, this.stackConfig.ADDRESS_TABLE_SIZE);
|
|
611
|
+
await this.emberSetEzspConfigValue(enums_1.EzspConfigId.TRUST_CENTER_ADDRESS_CACHE_SIZE, this.stackConfig.TRUST_CENTER_ADDRESS_CACHE_SIZE);
|
|
612
|
+
// BUG 14222: If stack profile is 2 (ZigBee Pro), we need to enforce
|
|
613
|
+
// the standard stack configuration values for that feature set.
|
|
614
|
+
/** MAC indirect timeout should be 7.68 secs */
|
|
615
|
+
await this.emberSetEzspConfigValue(enums_1.EzspConfigId.INDIRECT_TRANSMISSION_TIMEOUT, 7680);
|
|
616
|
+
/** Max hops should be 2 * nwkMaxDepth, where nwkMaxDepth is 15 */
|
|
617
|
+
await this.emberSetEzspConfigValue(enums_1.EzspConfigId.MAX_HOPS, 30);
|
|
618
|
+
await this.emberSetEzspConfigValue(enums_1.EzspConfigId.TX_POWER_MODE, enums_2.EmberTXPowerMode.USE_TOKEN);
|
|
619
|
+
await this.emberSetEzspConfigValue(enums_1.EzspConfigId.SUPPORTED_NETWORKS, 1);
|
|
620
|
+
await this.emberSetEzspValue(enums_1.EzspValueId.END_DEVICE_KEEP_ALIVE_SUPPORT_MODE, 1, [enums_2.EmberKeepAliveMode.KEEP_ALIVE_SUPPORT_ALL]);
|
|
603
621
|
// allow other devices to modify the binding table
|
|
604
622
|
await this.emberSetEzspPolicy(enums_1.EzspPolicyId.BINDING_MODIFICATION_POLICY, enums_1.EzspDecisionId.CHECK_BINDING_MODIFICATIONS_ARE_VALID_ENDPOINT_CLUSTERS);
|
|
605
623
|
// return message tag and message contents in ezspMessageSentHandler()
|
|
606
624
|
await this.emberSetEzspPolicy(enums_1.EzspPolicyId.MESSAGE_CONTENTS_IN_CALLBACK_POLICY, enums_1.EzspDecisionId.MESSAGE_TAG_AND_CONTENTS_IN_CALLBACK);
|
|
607
|
-
await this.emberSetEzspValue(enums_1.EzspValueId.MAXIMUM_INCOMING_TRANSFER_SIZE, 2, (0, math_1.lowHighBytes)(
|
|
608
|
-
await this.emberSetEzspValue(enums_1.EzspValueId.MAXIMUM_OUTGOING_TRANSFER_SIZE, 2, (0, math_1.lowHighBytes)(
|
|
609
|
-
await this.emberSetEzspValue(enums_1.EzspValueId.TRANSIENT_DEVICE_TIMEOUT, 2, (0, math_1.lowHighBytes)(
|
|
625
|
+
await this.emberSetEzspValue(enums_1.EzspValueId.MAXIMUM_INCOMING_TRANSFER_SIZE, 2, (0, math_1.lowHighBytes)(consts_2.MAXIMUM_APS_PAYLOAD_LENGTH));
|
|
626
|
+
await this.emberSetEzspValue(enums_1.EzspValueId.MAXIMUM_OUTGOING_TRANSFER_SIZE, 2, (0, math_1.lowHighBytes)(consts_2.MAXIMUM_APS_PAYLOAD_LENGTH));
|
|
627
|
+
await this.emberSetEzspValue(enums_1.EzspValueId.TRANSIENT_DEVICE_TIMEOUT, 2, (0, math_1.lowHighBytes)(this.stackConfig.TRANSIENT_DEVICE_TIMEOUT));
|
|
610
628
|
await this.ezsp.ezspSetManufacturerCode(this.manufacturerCode);
|
|
611
629
|
// network security init
|
|
612
|
-
await this.emberSetEzspConfigValue(enums_1.EzspConfigId.STACK_PROFILE,
|
|
613
|
-
await this.emberSetEzspConfigValue(enums_1.EzspConfigId.SECURITY_LEVEL,
|
|
630
|
+
await this.emberSetEzspConfigValue(enums_1.EzspConfigId.STACK_PROFILE, consts_2.STACK_PROFILE_ZIGBEE_PRO);
|
|
631
|
+
await this.emberSetEzspConfigValue(enums_1.EzspConfigId.SECURITY_LEVEL, consts_2.SECURITY_LEVEL_Z3);
|
|
614
632
|
}
|
|
615
633
|
/**
|
|
616
634
|
* NCP Address table init.
|
|
617
635
|
* @returns
|
|
618
636
|
*/
|
|
619
637
|
async initNCPAddressTable() {
|
|
620
|
-
const desiredTableSize =
|
|
638
|
+
const desiredTableSize = this.stackConfig.ADDRESS_TABLE_SIZE;
|
|
621
639
|
// If the host and the ncp disagree on the address table size, explode.
|
|
622
640
|
const [status, addressTableSize] = (await this.ezsp.ezspGetConfigurationValue(enums_1.EzspConfigId.ADDRESS_TABLE_SIZE));
|
|
623
641
|
// After the change of ncp memory model in UC, we can not increase the default NCP table sizes anymore.
|
|
@@ -631,17 +649,17 @@ class EmberAdapter extends __1.Adapter {
|
|
|
631
649
|
* NCP configuration init
|
|
632
650
|
*/
|
|
633
651
|
async initNCPConfiguration() {
|
|
634
|
-
await this.emberSetEzspConfigValue(enums_1.EzspConfigId.BINDING_TABLE_SIZE,
|
|
635
|
-
await this.emberSetEzspConfigValue(enums_1.EzspConfigId.KEY_TABLE_SIZE,
|
|
636
|
-
await this.emberSetEzspConfigValue(enums_1.EzspConfigId.MAX_END_DEVICE_CHILDREN,
|
|
637
|
-
await this.emberSetEzspConfigValue(enums_1.EzspConfigId.APS_UNICAST_MESSAGE_COUNT,
|
|
638
|
-
await this.emberSetEzspConfigValue(enums_1.EzspConfigId.BROADCAST_TABLE_SIZE,
|
|
639
|
-
await this.emberSetEzspConfigValue(enums_1.EzspConfigId.NEIGHBOR_TABLE_SIZE,
|
|
640
|
-
await this.emberSetEzspConfigValue(enums_1.EzspConfigId.END_DEVICE_POLL_TIMEOUT,
|
|
641
|
-
await this.emberSetEzspConfigValue(enums_1.EzspConfigId.TRANSIENT_KEY_TIMEOUT_S,
|
|
642
|
-
await this.emberSetEzspConfigValue(enums_1.EzspConfigId.RETRY_QUEUE_SIZE,
|
|
643
|
-
await this.emberSetEzspConfigValue(enums_1.EzspConfigId.SOURCE_ROUTE_TABLE_SIZE,
|
|
644
|
-
await this.emberSetEzspConfigValue(enums_1.EzspConfigId.MULTICAST_TABLE_SIZE,
|
|
652
|
+
await this.emberSetEzspConfigValue(enums_1.EzspConfigId.BINDING_TABLE_SIZE, this.stackConfig.BINDING_TABLE_SIZE);
|
|
653
|
+
await this.emberSetEzspConfigValue(enums_1.EzspConfigId.KEY_TABLE_SIZE, this.stackConfig.KEY_TABLE_SIZE);
|
|
654
|
+
await this.emberSetEzspConfigValue(enums_1.EzspConfigId.MAX_END_DEVICE_CHILDREN, this.stackConfig.MAX_END_DEVICE_CHILDREN);
|
|
655
|
+
await this.emberSetEzspConfigValue(enums_1.EzspConfigId.APS_UNICAST_MESSAGE_COUNT, this.stackConfig.APS_UNICAST_MESSAGE_COUNT);
|
|
656
|
+
await this.emberSetEzspConfigValue(enums_1.EzspConfigId.BROADCAST_TABLE_SIZE, this.stackConfig.BROADCAST_TABLE_SIZE);
|
|
657
|
+
await this.emberSetEzspConfigValue(enums_1.EzspConfigId.NEIGHBOR_TABLE_SIZE, this.stackConfig.NEIGHBOR_TABLE_SIZE);
|
|
658
|
+
await this.emberSetEzspConfigValue(enums_1.EzspConfigId.END_DEVICE_POLL_TIMEOUT, this.stackConfig.END_DEVICE_POLL_TIMEOUT);
|
|
659
|
+
await this.emberSetEzspConfigValue(enums_1.EzspConfigId.TRANSIENT_KEY_TIMEOUT_S, this.stackConfig.TRANSIENT_KEY_TIMEOUT_S);
|
|
660
|
+
await this.emberSetEzspConfigValue(enums_1.EzspConfigId.RETRY_QUEUE_SIZE, this.stackConfig.RETRY_QUEUE_SIZE);
|
|
661
|
+
await this.emberSetEzspConfigValue(enums_1.EzspConfigId.SOURCE_ROUTE_TABLE_SIZE, this.stackConfig.SOURCE_ROUTE_TABLE_SIZE);
|
|
662
|
+
await this.emberSetEzspConfigValue(enums_1.EzspConfigId.MULTICAST_TABLE_SIZE, this.stackConfig.MULTICAST_TABLE_SIZE);
|
|
645
663
|
}
|
|
646
664
|
/**
|
|
647
665
|
* NCP concentrator init. Also enables source route discovery mode with RESCHEDULE.
|
|
@@ -658,8 +676,7 @@ class EmberAdapter extends __1.Adapter {
|
|
|
658
676
|
* (through a target node that is neither the trust center nor one of its neighboring routers.)
|
|
659
677
|
*/
|
|
660
678
|
async initNCPConcentrator() {
|
|
661
|
-
const
|
|
662
|
-
const status = (await this.ezsp.ezspSetConcentrator(true, this.concentratorType, config.minTime, config.maxTime, config.routeErrorThreshold, config.deliveryFailureThreshold, config.mapHops));
|
|
679
|
+
const status = (await this.ezsp.ezspSetConcentrator(true, (this.stackConfig.CONCENTRATOR_RAM_TYPE === 'low') ? consts_2.EMBER_LOW_RAM_CONCENTRATOR : consts_2.EMBER_HIGH_RAM_CONCENTRATOR, this.stackConfig.CONCENTRATOR_MIN_TIME, this.stackConfig.CONCENTRATOR_MAX_TIME, this.stackConfig.CONCENTRATOR_ROUTE_ERROR_THRESHOLD, this.stackConfig.CONCENTRATOR_DELIVERY_FAILURE_THRESHOLD, this.stackConfig.CONCENTRATOR_MAX_HOPS));
|
|
663
680
|
if (status !== enums_2.EmberStatus.SUCCESS) {
|
|
664
681
|
throw new Error(`[CONCENTRATOR] Failed to set concentrator with status=${status}.`);
|
|
665
682
|
}
|
|
@@ -719,8 +736,7 @@ class EmberAdapter extends __1.Adapter {
|
|
|
719
736
|
throw new Error(`[INIT TC] Failed to set EzspPolicyId TC_KEY_REQUEST_POLICY to ALLOW_TC_KEY_REQUESTS_AND_SEND_CURRENT_KEY `
|
|
720
737
|
+ `with status=${enums_2.EzspStatus[status]}.`);
|
|
721
738
|
}
|
|
722
|
-
const appKeyPolicy =
|
|
723
|
-
? enums_1.EzspDecisionId.ALLOW_APP_KEY_REQUESTS : enums_1.EzspDecisionId.DENY_APP_KEY_REQUESTS;
|
|
739
|
+
const appKeyPolicy = this.stackConfig.KEY_TABLE_SIZE ? enums_1.EzspDecisionId.ALLOW_APP_KEY_REQUESTS : enums_1.EzspDecisionId.DENY_APP_KEY_REQUESTS;
|
|
724
740
|
status = (await this.emberSetEzspPolicy(enums_1.EzspPolicyId.APP_KEY_REQUEST_POLICY, appKeyPolicy));
|
|
725
741
|
if (status !== enums_2.EzspStatus.SUCCESS) {
|
|
726
742
|
throw new Error(`[INIT TC] Failed to set EzspPolicyId APP_KEY_REQUEST_POLICY to ${enums_1.EzspDecisionId[appKeyPolicy]} `
|
|
@@ -778,7 +794,7 @@ class EmberAdapter extends __1.Adapter {
|
|
|
778
794
|
action = NetworkInitAction.LEFT;
|
|
779
795
|
}
|
|
780
796
|
}
|
|
781
|
-
const backup =
|
|
797
|
+
const backup = this.getStoredBackup();
|
|
782
798
|
if ((initStatus === enums_2.EmberStatus.NOT_JOINED) || (action === NetworkInitAction.LEFT)) {
|
|
783
799
|
// no network
|
|
784
800
|
if (backup != null) {
|
|
@@ -881,7 +897,7 @@ class EmberAdapter extends __1.Adapter {
|
|
|
881
897
|
if (extSecStatus !== enums_2.EzspStatus.SUCCESS) {
|
|
882
898
|
throw new Error(`[INIT FORM] Failed to set extended security bitmask to ${extended} with status=${enums_2.EzspStatus[extSecStatus]}.`);
|
|
883
899
|
}
|
|
884
|
-
if (!fromBackup &&
|
|
900
|
+
if (!fromBackup && this.stackConfig.KEY_TABLE_SIZE > 0) {
|
|
885
901
|
emberStatus = await this.ezsp.ezspClearKeyTable();
|
|
886
902
|
if (emberStatus !== enums_2.EmberStatus.SUCCESS) {
|
|
887
903
|
throw new Error(`[INIT FORM] Failed to clear key table with status=${enums_2.EmberStatus[emberStatus]}.`);
|
|
@@ -910,16 +926,13 @@ class EmberAdapter extends __1.Adapter {
|
|
|
910
926
|
/**
|
|
911
927
|
* Loads currently stored backup and returns it in internal backup model.
|
|
912
928
|
*/
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
await mz_1.fs.access(this.backupPath);
|
|
916
|
-
}
|
|
917
|
-
catch (error) {
|
|
929
|
+
getStoredBackup() {
|
|
930
|
+
if (!(0, fs_1.existsSync)(this.backupPath)) {
|
|
918
931
|
return null;
|
|
919
932
|
}
|
|
920
933
|
let data;
|
|
921
934
|
try {
|
|
922
|
-
data = JSON.parse((
|
|
935
|
+
data = JSON.parse(((0, fs_1.readFileSync)(this.backupPath)).toString());
|
|
923
936
|
}
|
|
924
937
|
catch (error) {
|
|
925
938
|
throw new Error(`[BACKUP] Coordinator backup is corrupted.`);
|
|
@@ -2082,7 +2095,7 @@ class EmberAdapter extends __1.Adapter {
|
|
|
2082
2095
|
throw new Error(`[BACKUP] No network key set.`);
|
|
2083
2096
|
}
|
|
2084
2097
|
let keyList = [];
|
|
2085
|
-
if (
|
|
2098
|
+
if (this.stackConfig.KEY_TABLE_SIZE > 0) {
|
|
2086
2099
|
keyList = (await this.exportLinkKeys());
|
|
2087
2100
|
}
|
|
2088
2101
|
// XXX: this only makes sense on stop (if that), not hourly/on start, plus network needs to be at near-standstill @see AN1387
|
|
@@ -2117,7 +2130,7 @@ class EmberAdapter extends __1.Adapter {
|
|
|
2117
2130
|
sequenceNumber: netKeyInfo.networkKeySequenceNumber,
|
|
2118
2131
|
frameCounter: netKeyInfo.networkKeyFrameCounter,
|
|
2119
2132
|
},
|
|
2120
|
-
securityLevel:
|
|
2133
|
+
securityLevel: consts_2.SECURITY_LEVEL_Z3,
|
|
2121
2134
|
networkUpdateId: netParams.nwkUpdateId,
|
|
2122
2135
|
coordinatorIeeeAddress: Buffer.from(this.networkCache.eui64.substring(2) /*take out 0x*/, 'hex').reverse(),
|
|
2123
2136
|
devices: keyList.map((key) => ({
|