@matter/create 0.12.0-alpha.0-20250101-22e7c1044 → 0.12.0-alpha.0-20250107-af5a068c3
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/esm/run.js.map
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/run.ts"],
|
|
4
|
-
"mappings": "AAAA;AAAA;AAAA;AAAA;AAAA;AAMA,SAAS,aAA6C;AAE/C,SAAS,IAAI,SAAiB,MAAiB,SAAwB;AAC1E,SAAO,IAAI,QAAc,CAAC,SAAS,WAAW;AAC1C,QAAI;AACJ,QAAI;AACA,aAAO,MAAM,SAAS,QAAQ,CAAC,GAAG;AAAA,QAC9B,OAAO;AAAA,QACP,GAAG;AAAA,MACP,CAAC;AAAA,IACL,SAAS,GAAG;AACR,aAAO,
|
|
4
|
+
"mappings": "AAAA;AAAA;AAAA;AAAA;AAAA;AAMA,SAAS,aAA6C;AAE/C,SAAS,IAAI,SAAiB,MAAiB,SAAwB;AAC1E,SAAO,IAAI,QAAc,CAAC,SAAS,WAAW;AAC1C,QAAI;AACJ,QAAI;AACA,aAAO,MAAM,SAAS,QAAQ,CAAC,GAAG;AAAA,QAC9B,OAAO;AAAA,QACP,GAAG;AAAA,MACP,CAAC;AAAA,IACL,SAAS,GAAG;AACR,aAAO,CAAU;AACjB;AAAA,IACJ;AAEA,SAAK,GAAG,SAAS,WAAS;AACtB,aAAO,KAAK;AAAA,IAChB,CAAC;AAED,SAAK,GAAG,SAAS,UAAQ;AACrB,UAAI,MAAM;AACN,eAAO,IAAI,MAAM,kCAAkC,IAAI,EAAE,CAAC;AAAA,MAC9D,OAAO;AACH,gBAAQ;AAAA,MACZ;AAAA,IACJ,CAAC;AAAA,EACL,CAAC;AACL;AAEO,SAAS,IAAI,MAAgB,SAA2B;AAC3D,SAAO,IAAI,OAAO,MAAM,OAAO;AACnC;",
|
|
5
5
|
"names": []
|
|
6
6
|
}
|
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
*/
|
|
22
22
|
|
|
23
23
|
import {
|
|
24
|
+
Bytes,
|
|
24
25
|
DeviceTypeId,
|
|
25
26
|
Endpoint,
|
|
26
27
|
EndpointServer,
|
|
@@ -34,7 +35,7 @@ import {
|
|
|
34
35
|
logLevelFromString,
|
|
35
36
|
singleton,
|
|
36
37
|
} from "@matter/main";
|
|
37
|
-
import {
|
|
38
|
+
import { OnOffServer } from "@matter/main/behaviors";
|
|
38
39
|
import { GeneralDiagnostics, NetworkCommissioning } from "@matter/main/clusters";
|
|
39
40
|
import { OnOffLightDevice, OnOffPlugInUnitDevice } from "@matter/main/devices";
|
|
40
41
|
import { RootRequirements } from "@matter/main/endpoints";
|
|
@@ -164,6 +165,7 @@ class OnOffShellExecServer extends OnOffServer {
|
|
|
164
165
|
class TestGeneralDiagnosticsServer extends RootRequirements.GeneralDiagnosticsServer {
|
|
165
166
|
override initialize() {
|
|
166
167
|
this.state.testEventTriggersEnabled = true; // set to true if you support test triggers ...
|
|
168
|
+
this.state.deviceTestEnableKey = Bytes.fromHex("0102030405060708090a0b0c0d0e0f10");
|
|
167
169
|
super.initialize();
|
|
168
170
|
}
|
|
169
171
|
|
|
@@ -205,12 +207,8 @@ class MyFancyOwnFunctionalityServer extends MyFancyOwnFunctionalityBehavior {
|
|
|
205
207
|
// In this case we are using with() to install our On/Off cluster behavior.
|
|
206
208
|
// .with("Lighting") not needed because we always have it in by default because we have default implementation
|
|
207
209
|
const OnOffDevice = isSocket
|
|
208
|
-
?
|
|
209
|
-
|
|
210
|
-
: OnOffPlugInUnitDevice.with(OnOffShellExecServer)
|
|
211
|
-
: vendorId === 0xfff4
|
|
212
|
-
? OnOffLightDevice.with(OnOffShellExecServer, MyFancyOwnFunctionalityServer)
|
|
213
|
-
: OnOffLightDevice.with(OnOffShellExecServer);
|
|
210
|
+
? OnOffPlugInUnitDevice.with(OnOffShellExecServer)
|
|
211
|
+
: OnOffLightDevice.with(OnOffShellExecServer);
|
|
214
212
|
|
|
215
213
|
/**
|
|
216
214
|
* Modify automatically added clusters of the Root endpoint if needed
|
|
@@ -222,32 +220,8 @@ const OnOffDevice = isSocket
|
|
|
222
220
|
*/
|
|
223
221
|
|
|
224
222
|
// We use the Basic Root Endpoint without a NetworkCommissioning cluster
|
|
225
|
-
|
|
223
|
+
const RootEndpoint = ServerNode.RootEndpoint.with(TestGeneralDiagnosticsServer);
|
|
226
224
|
|
|
227
|
-
let wifiOrThreadAdded = false;
|
|
228
|
-
let threadAdded = false;
|
|
229
|
-
if (Ble.enabled) {
|
|
230
|
-
// matter.js will create a Ethernet-only device by default when ut comes to Network Commissioning Features.
|
|
231
|
-
// To offer e.g. a "Wi-Fi only device" (or any other combination) we need to override the Network Commissioning
|
|
232
|
-
// cluster and implement all the need handling here. This is a "static implementation" for pure demonstration
|
|
233
|
-
// purposes and just "simulates" the actions to be done. In a real world implementation this would be done by
|
|
234
|
-
// the device implementor based on the relevant networking stack.
|
|
235
|
-
// The NetworkCommissioningCluster and all logics are described in Matter Core Specifications section 11.8
|
|
236
|
-
if (environment.vars.has("ble.wifi.fake")) {
|
|
237
|
-
RootEndpoint = RootEndpoint.with(DummyWifiNetworkCommissioningServer);
|
|
238
|
-
wifiOrThreadAdded = true;
|
|
239
|
-
} else if (environment.vars.has("ble.thread.fake")) {
|
|
240
|
-
RootEndpoint = RootEndpoint.with(DummyThreadNetworkCommissioningServer);
|
|
241
|
-
wifiOrThreadAdded = true;
|
|
242
|
-
threadAdded = true;
|
|
243
|
-
}
|
|
244
|
-
} else {
|
|
245
|
-
RootEndpoint = RootEndpoint.with(
|
|
246
|
-
NetworkCommissioningServer.with(NetworkCommissioning.Feature.EthernetNetworkInterface),
|
|
247
|
-
);
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
const networkId = new Uint8Array(32);
|
|
251
225
|
// Physical devices appear as "nodes" on a Matter network. As a device implementer you use a NodeServer to bring a
|
|
252
226
|
// device online.
|
|
253
227
|
//
|
|
@@ -281,28 +255,54 @@ const server = await ServerNode.create(RootEndpoint, {
|
|
|
281
255
|
serialNumber: `node-matter-${uniqueId}`,
|
|
282
256
|
uniqueId,
|
|
283
257
|
},
|
|
258
|
+
});
|
|
284
259
|
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
260
|
+
const networkId = new Uint8Array(32);
|
|
261
|
+
if (Ble.enabled) {
|
|
262
|
+
// matter.js will create an Ethernet-only device by default when it comes to Network Commissioning Features.
|
|
263
|
+
// To offer e.g. a "Wi-Fi only device" (or any other combination) we need to override the Network Commissioning
|
|
264
|
+
// cluster and implement all the need handling here. This is a "static implementation" for pure demonstration
|
|
265
|
+
// purposes and just "simulates" the actions to be done. In a real world implementation this would be done by
|
|
266
|
+
// the device implementor based on the relevant networking stack.
|
|
267
|
+
// The NetworkCommissioningCluster and all logics are described in Matter Core Specifications section 11.8
|
|
268
|
+
if (environment.vars.has("ble.wifi.fake")) {
|
|
269
|
+
server.behaviors.require(DummyWifiNetworkCommissioningServer, {
|
|
270
|
+
maxNetworks: 1,
|
|
271
|
+
interfaceEnabled: true,
|
|
272
|
+
lastConnectErrorValue: 0,
|
|
273
|
+
lastNetworkId: networkId,
|
|
274
|
+
lastNetworkingStatus: null,
|
|
275
|
+
networks: [{ networkId: networkId, connected: false }],
|
|
276
|
+
scanMaxTimeSeconds: 3,
|
|
277
|
+
connectMaxTimeSeconds: 3,
|
|
278
|
+
supportedWiFiBands: [NetworkCommissioning.WiFiBand["2G4"]],
|
|
279
|
+
});
|
|
280
|
+
} else if (environment.vars.has("ble.thread.fake")) {
|
|
281
|
+
server.behaviors.require(DummyThreadNetworkCommissioningServer, {
|
|
282
|
+
maxNetworks: 1,
|
|
283
|
+
interfaceEnabled: true,
|
|
284
|
+
lastConnectErrorValue: 0,
|
|
285
|
+
lastNetworkId: null,
|
|
286
|
+
lastNetworkingStatus: null,
|
|
287
|
+
networks: [{ networkId: networkId, connected: false }],
|
|
288
|
+
scanMaxTimeSeconds: 3,
|
|
289
|
+
connectMaxTimeSeconds: 3,
|
|
290
|
+
supportedThreadFeatures: { isFullThreadDevice: true },
|
|
291
|
+
threadVersion: 4, // means: Thread 1.3
|
|
292
|
+
});
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
// Also add our Custom behavior when vendor id is 0xfff4 (just to show how it works)
|
|
297
|
+
if (vendorId === 0xfff4) {
|
|
298
|
+
server.behaviors.require(MyFancyOwnFunctionalityServer, {
|
|
300
299
|
myFancyValue: 0,
|
|
301
|
-
}
|
|
302
|
-
}
|
|
300
|
+
});
|
|
301
|
+
}
|
|
303
302
|
|
|
304
303
|
// Nodes are a composition of endpoints. Add a single endpoint to the node, our example light device.
|
|
305
304
|
const endpoint = new Endpoint(OnOffDevice, { id: "onoff" });
|
|
305
|
+
|
|
306
306
|
await server.add(endpoint);
|
|
307
307
|
|
|
308
308
|
/**
|
|
@@ -317,7 +317,7 @@ server.lifecycle.decommissioned.on(() => console.log("Server was fully decommiss
|
|
|
317
317
|
/** This event is triggered when the device went online. This means that it is discoverable in the network. */
|
|
318
318
|
server.lifecycle.online.on(() => console.log("Server is online"));
|
|
319
319
|
|
|
320
|
-
/** This event is triggered when the device went offline.
|
|
320
|
+
/** This event is triggered when the device went offline. It is no longer discoverable or connectable in the network. */
|
|
321
321
|
server.lifecycle.offline.on(() => console.log("Server is offline"));
|
|
322
322
|
|
|
323
323
|
/**
|
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
{
|
|
6
6
|
"name": "controller",
|
|
7
7
|
"dependencies": {
|
|
8
|
-
"@matter/main": "~0.12.0-alpha.0-
|
|
9
|
-
"@matter/nodejs-ble": "~0.12.0-alpha.0-
|
|
10
|
-
"@project-chip/matter.js": "~0.12.0-alpha.0-
|
|
8
|
+
"@matter/main": "~0.12.0-alpha.0-20250107-af5a068c3",
|
|
9
|
+
"@matter/nodejs-ble": "~0.12.0-alpha.0-20250107-af5a068c3",
|
|
10
|
+
"@project-chip/matter.js": "~0.12.0-alpha.0-20250107-af5a068c3"
|
|
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.12.0-alpha.0-
|
|
18
|
+
"@matter/main": "~0.12.0-alpha.0-20250107-af5a068c3"
|
|
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.12.0-alpha.0-
|
|
26
|
+
"@matter/main": "~0.12.0-alpha.0-20250107-af5a068c3"
|
|
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.12.0-alpha.0-
|
|
34
|
+
"@matter/main": "~0.12.0-alpha.0-20250107-af5a068c3"
|
|
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.12.0-alpha.0-
|
|
42
|
+
"@matter/main": "~0.12.0-alpha.0-20250107-af5a068c3"
|
|
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.12.0-alpha.0-
|
|
50
|
+
"@matter/main": "~0.12.0-alpha.0-20250107-af5a068c3"
|
|
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.12.0-alpha.0-
|
|
58
|
+
"@matter/main": "~0.12.0-alpha.0-20250107-af5a068c3"
|
|
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.12.0-alpha.0-
|
|
67
|
-
"@matter/nodejs": "~0.12.0-alpha.0-
|
|
68
|
-
"@matter/nodejs-ble": "~0.12.0-alpha.0-
|
|
66
|
+
"@matter/main": "~0.12.0-alpha.0-20250107-af5a068c3",
|
|
67
|
+
"@matter/nodejs": "~0.12.0-alpha.0-20250107-af5a068c3",
|
|
68
|
+
"@matter/nodejs-ble": "~0.12.0-alpha.0-20250107-af5a068c3"
|
|
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.12.0-alpha.0-
|
|
76
|
+
"@matter/main": "~0.12.0-alpha.0-20250107-af5a068c3"
|
|
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.12.0-alpha.0-
|
|
84
|
+
"@matter/main": "~0.12.0-alpha.0-20250107-af5a068c3"
|
|
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.12.0-alpha.0-
|
|
92
|
+
"@matter/main": "~0.12.0-alpha.0-20250107-af5a068c3"
|
|
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.12.0-alpha.0-
|
|
3
|
+
"version": "0.12.0-alpha.0-20250107-af5a068c3",
|
|
4
4
|
"description": "Matter.js skeleton project generator",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
},
|
|
33
33
|
"homepage": "https://github.com/project-chip/matter.js#readme",
|
|
34
34
|
"devDependencies": {
|
|
35
|
-
"@matter/tools": "0.12.0-alpha.0-
|
|
35
|
+
"@matter/tools": "0.12.0-alpha.0-20250107-af5a068c3",
|
|
36
36
|
"@types/node": "^22.10.1",
|
|
37
37
|
"@types/tar-stream": "^3.1.3"
|
|
38
38
|
},
|