@matter/create 0.11.2 → 0.11.3-alpha.0-20241106-39bacbc00
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.
|
@@ -17,7 +17,7 @@ import { Ble, ClusterClientObj, ControllerCommissioningFlowOptions } from "@matt
|
|
|
17
17
|
import { ManualPairingCodeCodec, NodeId } from "@matter/main/types";
|
|
18
18
|
import { NodeJsBle } from "@matter/nodejs-ble";
|
|
19
19
|
import { CommissioningController, NodeCommissioningOptions } from "@project-chip/matter.js";
|
|
20
|
-
import {
|
|
20
|
+
import { NodeStates } from "@project-chip/matter.js/device";
|
|
21
21
|
|
|
22
22
|
const logger = Logger.get("Controller");
|
|
23
23
|
|
|
@@ -181,50 +181,51 @@ class ControllerNode {
|
|
|
181
181
|
throw new Error(`Node ${nodeId} not found in commissioned nodes`);
|
|
182
182
|
}
|
|
183
183
|
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
)
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
break;
|
|
222
|
-
}
|
|
223
|
-
},
|
|
184
|
+
// Trigger node connection. Returns once process started, events are there to wait for completion
|
|
185
|
+
// By default will subscript to all attributes and events
|
|
186
|
+
const node = await commissioningController.connectNode(nodeId);
|
|
187
|
+
|
|
188
|
+
// React on generic events
|
|
189
|
+
node.events.attributeChanged.on(({ path: { nodeId, clusterId, endpointId, attributeName }, value }) =>
|
|
190
|
+
console.log(
|
|
191
|
+
`attributeChangedCallback ${nodeId}: Attribute ${endpointId}/${clusterId}/${attributeName} changed to ${Logger.toJSON(
|
|
192
|
+
value,
|
|
193
|
+
)}`,
|
|
194
|
+
),
|
|
195
|
+
);
|
|
196
|
+
node.events.eventTriggered.on(({ path: { nodeId, clusterId, endpointId, eventName }, events }) =>
|
|
197
|
+
console.log(
|
|
198
|
+
`eventTriggeredCallback ${nodeId}: Event ${endpointId}/${clusterId}/${eventName} triggered with ${Logger.toJSON(
|
|
199
|
+
events,
|
|
200
|
+
)}`,
|
|
201
|
+
),
|
|
202
|
+
);
|
|
203
|
+
node.events.stateChanged.on(info => {
|
|
204
|
+
switch (info) {
|
|
205
|
+
case NodeStates.Connected:
|
|
206
|
+
console.log(`state changed: Node ${nodeId} connected`);
|
|
207
|
+
break;
|
|
208
|
+
case NodeStates.Disconnected:
|
|
209
|
+
console.log(`state changed: Node ${nodeId} disconnected`);
|
|
210
|
+
break;
|
|
211
|
+
case NodeStates.Reconnecting:
|
|
212
|
+
console.log(`state changed: Node ${nodeId} reconnecting`);
|
|
213
|
+
break;
|
|
214
|
+
case NodeStates.WaitingForDeviceDiscovery:
|
|
215
|
+
console.log(`state changed: Node ${nodeId} waiting for device discovery`);
|
|
216
|
+
break;
|
|
217
|
+
}
|
|
218
|
+
});
|
|
219
|
+
node.events.structureChanged.on(() => {
|
|
220
|
+
console.log(`Node ${nodeId} structure changed`);
|
|
224
221
|
});
|
|
225
222
|
|
|
226
|
-
//
|
|
227
|
-
|
|
223
|
+
// Now wait till the structure of the node gor initialized (potentially with persisted data)
|
|
224
|
+
await node.events.initialized;
|
|
225
|
+
|
|
226
|
+
// Or use this to wait for full remote initialization and reconnection.
|
|
227
|
+
// Will only return when node is connected!
|
|
228
|
+
// await node.events.initializedFromRemote;
|
|
228
229
|
|
|
229
230
|
node.logStructure();
|
|
230
231
|
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"typescriptVersion": "~5.6.2",
|
|
3
|
-
"nodeTypesVersion": "^22.8.
|
|
3
|
+
"nodeTypesVersion": "^22.8.7",
|
|
4
4
|
"templates": [
|
|
5
5
|
{
|
|
6
6
|
"name": "controller",
|
|
7
7
|
"dependencies": {
|
|
8
|
-
"@matter/main": "~0.11.
|
|
9
|
-
"@matter/nodejs-ble": "~0.11.
|
|
10
|
-
"@project-chip/matter.js": "~0.11.
|
|
8
|
+
"@matter/main": "~0.11.3-alpha.0-20241106-39bacbc00",
|
|
9
|
+
"@matter/nodejs-ble": "~0.11.3-alpha.0-20241106-39bacbc00",
|
|
10
|
+
"@project-chip/matter.js": "~0.11.3-alpha.0-20241106-39bacbc00"
|
|
11
11
|
},
|
|
12
12
|
"description": "Controller example to commission and connect devices",
|
|
13
13
|
"entrypoint": "ControllerNode.ts"
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
{
|
|
16
16
|
"name": "device-bridge-onoff",
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@matter/main": "~0.11.
|
|
18
|
+
"@matter/main": "~0.11.3-alpha.0-20241106-39bacbc00"
|
|
19
19
|
},
|
|
20
20
|
"description": "Bridge for multiple OnOff light/sockets with a CLI command execution interface",
|
|
21
21
|
"entrypoint": "BridgedDevicesNode.ts"
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
{
|
|
24
24
|
"name": "device-composed-onoff",
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@matter/main": "~0.11.
|
|
26
|
+
"@matter/main": "~0.11.3-alpha.0-20241106-39bacbc00"
|
|
27
27
|
},
|
|
28
28
|
"description": "Composed device for multiple OnOff light/sockets with a CLI command execution interface",
|
|
29
29
|
"entrypoint": "ComposedDeviceNode.ts"
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
{
|
|
32
32
|
"name": "device-composed-wc-light",
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@matter/main": "~0.11.
|
|
34
|
+
"@matter/main": "~0.11.3-alpha.0-20241106-39bacbc00"
|
|
35
35
|
},
|
|
36
36
|
"description": "Composed device with Window covering and a light endpoint that logs changes",
|
|
37
37
|
"entrypoint": "IlluminatedRollerShade.ts"
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
{
|
|
40
40
|
"name": "device-measuring-socket",
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@matter/main": "~0.11.
|
|
42
|
+
"@matter/main": "~0.11.3-alpha.0-20241106-39bacbc00"
|
|
43
43
|
},
|
|
44
44
|
"description": "Socket device that reports random Energy and Power measurements",
|
|
45
45
|
"entrypoint": "MeasuredSocketDevice.ts"
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
{
|
|
48
48
|
"name": "device-multiple-onoff",
|
|
49
49
|
"dependencies": {
|
|
50
|
-
"@matter/main": "~0.11.
|
|
50
|
+
"@matter/main": "~0.11.3-alpha.0-20241106-39bacbc00"
|
|
51
51
|
},
|
|
52
52
|
"description": "Multiple OnOff light/socket nodes in one process with a CLI command execution interface",
|
|
53
53
|
"entrypoint": "MultiDeviceNode.ts"
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
{
|
|
56
56
|
"name": "device-onoff",
|
|
57
57
|
"dependencies": {
|
|
58
|
-
"@matter/main": "~0.11.
|
|
58
|
+
"@matter/main": "~0.11.3-alpha.0-20241106-39bacbc00"
|
|
59
59
|
},
|
|
60
60
|
"description": "OnOff light/socket device with a CLI command execution interface",
|
|
61
61
|
"entrypoint": "DeviceNode.ts"
|
|
@@ -63,9 +63,9 @@
|
|
|
63
63
|
{
|
|
64
64
|
"name": "device-onoff-advanced",
|
|
65
65
|
"dependencies": {
|
|
66
|
-
"@matter/main": "~0.11.
|
|
67
|
-
"@matter/nodejs": "~0.11.
|
|
68
|
-
"@matter/nodejs-ble": "~0.11.
|
|
66
|
+
"@matter/main": "~0.11.3-alpha.0-20241106-39bacbc00",
|
|
67
|
+
"@matter/nodejs": "~0.11.3-alpha.0-20241106-39bacbc00",
|
|
68
|
+
"@matter/nodejs-ble": "~0.11.3-alpha.0-20241106-39bacbc00"
|
|
69
69
|
},
|
|
70
70
|
"description": "OnOff light/socket device with BLE support and advanced API usage",
|
|
71
71
|
"entrypoint": "DeviceNodeFull.ts"
|
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
{
|
|
74
74
|
"name": "device-onoff-light",
|
|
75
75
|
"dependencies": {
|
|
76
|
-
"@matter/main": "~0.11.
|
|
76
|
+
"@matter/main": "~0.11.3-alpha.0-20241106-39bacbc00"
|
|
77
77
|
},
|
|
78
78
|
"description": "OnOff light example which logs the state changes to the console",
|
|
79
79
|
"entrypoint": "LightDevice.ts"
|
|
@@ -81,7 +81,7 @@
|
|
|
81
81
|
{
|
|
82
82
|
"name": "device-sensor",
|
|
83
83
|
"dependencies": {
|
|
84
|
-
"@matter/main": "~0.11.
|
|
84
|
+
"@matter/main": "~0.11.3-alpha.0-20241106-39bacbc00"
|
|
85
85
|
},
|
|
86
86
|
"description": "Temperature/Humidity sensor with a CLI command interface to get the value",
|
|
87
87
|
"entrypoint": "SensorDeviceNode.ts"
|
|
@@ -89,7 +89,7 @@
|
|
|
89
89
|
{
|
|
90
90
|
"name": "device-simple",
|
|
91
91
|
"dependencies": {
|
|
92
|
-
"@matter/main": "~0.11.
|
|
92
|
+
"@matter/main": "~0.11.3-alpha.0-20241106-39bacbc00"
|
|
93
93
|
},
|
|
94
94
|
"description": "A simple on/off device",
|
|
95
95
|
"entrypoint": "main.ts"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@matter/create",
|
|
3
|
-
"version": "0.11.
|
|
3
|
+
"version": "0.11.3-alpha.0-20241106-39bacbc00",
|
|
4
4
|
"description": "Matter.js skeleton project generator",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
@@ -32,8 +32,8 @@
|
|
|
32
32
|
},
|
|
33
33
|
"homepage": "https://github.com/project-chip/matter.js#readme",
|
|
34
34
|
"devDependencies": {
|
|
35
|
-
"@matter/tools": "0.11.
|
|
36
|
-
"@types/node": "^22.8.
|
|
35
|
+
"@matter/tools": "0.11.3-alpha.0-20241106-39bacbc00",
|
|
36
|
+
"@types/node": "^22.8.7",
|
|
37
37
|
"@types/tar-stream": "^3.1.3"
|
|
38
38
|
},
|
|
39
39
|
"publishConfig": {
|