New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@matter/create

Package Overview
Dependencies
Maintainers
0
Versions
86
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@matter/create - npm Package Compare versions

Comparing version 0.12.0-alpha.0-20250101-22e7c1044 to 0.12.0-alpha.0-20250103-ba0c01a01

100

dist/templates/device-onoff-advanced/DeviceNodeFull.ts

@@ -24,2 +24,3 @@ #!/usr/bin/env node

import {
Bytes,
DeviceTypeId,

@@ -38,3 +39,3 @@ Endpoint,

} from "@matter/main";
import { NetworkCommissioningServer, OnOffServer } from "@matter/main/behaviors";
import { OnOffServer } from "@matter/main/behaviors";
import { GeneralDiagnostics, NetworkCommissioning } from "@matter/main/clusters";

@@ -169,2 +170,3 @@ import { OnOffLightDevice, OnOffPlugInUnitDevice } from "@matter/main/devices";

this.state.testEventTriggersEnabled = true; // set to true if you support test triggers ...
this.state.deviceTestEnableKey = Bytes.fromHex("0102030405060708090a0b0c0d0e0f10");
super.initialize();

@@ -211,8 +213,4 @@ }

const OnOffDevice = isSocket
? vendorId === 0xfff4
? OnOffPlugInUnitDevice.with(OnOffShellExecServer, MyFancyOwnFunctionalityServer)
: OnOffPlugInUnitDevice.with(OnOffShellExecServer)
: vendorId === 0xfff4
? OnOffLightDevice.with(OnOffShellExecServer, MyFancyOwnFunctionalityServer)
: OnOffLightDevice.with(OnOffShellExecServer);
? OnOffPlugInUnitDevice.with(OnOffShellExecServer)
: OnOffLightDevice.with(OnOffShellExecServer);

@@ -229,28 +227,4 @@ /**

// We use the Basic Root Endpoint without a NetworkCommissioning cluster
let RootEndpoint = ServerNode.RootEndpoint.with(TestGeneralDiagnosticsServer);
const RootEndpoint = ServerNode.RootEndpoint.with(TestGeneralDiagnosticsServer);
let wifiOrThreadAdded = false;
let threadAdded = false;
if (Ble.enabled) {
// matter.js will create a Ethernet-only device by default when ut comes to Network Commissioning Features.
// To offer e.g. a "Wi-Fi only device" (or any other combination) we need to override the Network Commissioning
// cluster and implement all the need handling here. This is a "static implementation" for pure demonstration
// purposes and just "simulates" the actions to be done. In a real world implementation this would be done by
// the device implementor based on the relevant networking stack.
// The NetworkCommissioningCluster and all logics are described in Matter Core Specifications section 11.8
if (environment.vars.has("ble.wifi.fake")) {
RootEndpoint = RootEndpoint.with(DummyWifiNetworkCommissioningServer);
wifiOrThreadAdded = true;
} else if (environment.vars.has("ble.thread.fake")) {
RootEndpoint = RootEndpoint.with(DummyThreadNetworkCommissioningServer);
wifiOrThreadAdded = true;
threadAdded = true;
}
} else {
RootEndpoint = RootEndpoint.with(
NetworkCommissioningServer.with(NetworkCommissioning.Feature.EthernetNetworkInterface),
);
}
const networkId = new Uint8Array(32);
// Physical devices appear as "nodes" on a Matter network. As a device implementer you use a NodeServer to bring a

@@ -289,24 +263,50 @@ // device online.

},
});
// @ts-expect-error ... TS do not see the types because both next clusters was added conditionally
networkCommissioning: {
maxNetworks: 1,
interfaceEnabled: true,
lastConnectErrorValue: 0,
lastNetworkId: wifiOrThreadAdded ? null : networkId,
lastNetworkingStatus: wifiOrThreadAdded ? null : NetworkCommissioning.NetworkCommissioningStatus.Success,
networks: [{ networkId: networkId, connected: !wifiOrThreadAdded }],
scanMaxTimeSeconds: wifiOrThreadAdded ? 3 : undefined,
connectMaxTimeSeconds: wifiOrThreadAdded ? 3 : undefined,
supportedWifiBands: wifiOrThreadAdded && !threadAdded ? [NetworkCommissioning.WiFiBand["2G4"]] : undefined,
supportedThreadFeatures: wifiOrThreadAdded && threadAdded ? { isFullThreadDevice: true } : undefined,
threadVersion: wifiOrThreadAdded && threadAdded ? 4 : undefined, // means: Thread 1.3
},
myFancyFunctionality: {
const networkId = new Uint8Array(32);
if (Ble.enabled) {
// matter.js will create an Ethernet-only device by default when it comes to Network Commissioning Features.
// To offer e.g. a "Wi-Fi only device" (or any other combination) we need to override the Network Commissioning
// cluster and implement all the need handling here. This is a "static implementation" for pure demonstration
// purposes and just "simulates" the actions to be done. In a real world implementation this would be done by
// the device implementor based on the relevant networking stack.
// The NetworkCommissioningCluster and all logics are described in Matter Core Specifications section 11.8
if (environment.vars.has("ble.wifi.fake")) {
server.behaviors.require(DummyWifiNetworkCommissioningServer, {
maxNetworks: 1,
interfaceEnabled: true,
lastConnectErrorValue: 0,
lastNetworkId: networkId,
lastNetworkingStatus: null,
networks: [{ networkId: networkId, connected: false }],
scanMaxTimeSeconds: 3,
connectMaxTimeSeconds: 3,
supportedWiFiBands: [NetworkCommissioning.WiFiBand["2G4"]],
});
} else if (environment.vars.has("ble.thread.fake")) {
server.behaviors.require(DummyThreadNetworkCommissioningServer, {
maxNetworks: 1,
interfaceEnabled: true,
lastConnectErrorValue: 0,
lastNetworkId: null,
lastNetworkingStatus: null,
networks: [{ networkId: networkId, connected: false }],
scanMaxTimeSeconds: 3,
connectMaxTimeSeconds: 3,
supportedThreadFeatures: { isFullThreadDevice: true },
threadVersion: 4, // means: Thread 1.3
});
}
}
// Also add our Custom behavior when vendor id is 0xfff4 (just to show how it works)
if (vendorId === 0xfff4) {
server.behaviors.require(MyFancyOwnFunctionalityServer, {
myFancyValue: 0,
},
});
});
}
// Nodes are a composition of endpoints. Add a single endpoint to the node, our example light device.
const endpoint = new Endpoint(OnOffDevice, { id: "onoff" });
await server.add(endpoint);

@@ -326,3 +326,3 @@

/** This event is triggered when the device went offline. it is not longer discoverable or connectable in the network. */
/** This event is triggered when the device went offline. It is no longer discoverable or connectable in the network. */
server.lifecycle.offline.on(() => console.log("Server is offline"));

@@ -329,0 +329,0 @@

@@ -8,5 +8,5 @@ {

"dependencies": {
"@matter/main": "~0.12.0-alpha.0-20250101-22e7c1044",
"@matter/nodejs-ble": "~0.12.0-alpha.0-20250101-22e7c1044",
"@project-chip/matter.js": "~0.12.0-alpha.0-20250101-22e7c1044"
"@matter/main": "~0.12.0-alpha.0-20250103-ba0c01a01",
"@matter/nodejs-ble": "~0.12.0-alpha.0-20250103-ba0c01a01",
"@project-chip/matter.js": "~0.12.0-alpha.0-20250103-ba0c01a01"
},

@@ -19,3 +19,3 @@ "description": "Controller example to commission and connect devices",

"dependencies": {
"@matter/main": "~0.12.0-alpha.0-20250101-22e7c1044"
"@matter/main": "~0.12.0-alpha.0-20250103-ba0c01a01"
},

@@ -28,3 +28,3 @@ "description": "Bridge for multiple OnOff light/sockets with a CLI command execution interface",

"dependencies": {
"@matter/main": "~0.12.0-alpha.0-20250101-22e7c1044"
"@matter/main": "~0.12.0-alpha.0-20250103-ba0c01a01"
},

@@ -37,3 +37,3 @@ "description": "Composed device for multiple OnOff light/sockets with a CLI command execution interface",

"dependencies": {
"@matter/main": "~0.12.0-alpha.0-20250101-22e7c1044"
"@matter/main": "~0.12.0-alpha.0-20250103-ba0c01a01"
},

@@ -46,3 +46,3 @@ "description": "Composed device with Window covering and a light endpoint that logs changes",

"dependencies": {
"@matter/main": "~0.12.0-alpha.0-20250101-22e7c1044"
"@matter/main": "~0.12.0-alpha.0-20250103-ba0c01a01"
},

@@ -55,3 +55,3 @@ "description": "Socket device that reports random Energy and Power measurements",

"dependencies": {
"@matter/main": "~0.12.0-alpha.0-20250101-22e7c1044"
"@matter/main": "~0.12.0-alpha.0-20250103-ba0c01a01"
},

@@ -64,3 +64,3 @@ "description": "Multiple OnOff light/socket nodes in one process with a CLI command execution interface",

"dependencies": {
"@matter/main": "~0.12.0-alpha.0-20250101-22e7c1044"
"@matter/main": "~0.12.0-alpha.0-20250103-ba0c01a01"
},

@@ -73,5 +73,5 @@ "description": "OnOff light/socket device with a CLI command execution interface",

"dependencies": {
"@matter/main": "~0.12.0-alpha.0-20250101-22e7c1044",
"@matter/nodejs": "~0.12.0-alpha.0-20250101-22e7c1044",
"@matter/nodejs-ble": "~0.12.0-alpha.0-20250101-22e7c1044"
"@matter/main": "~0.12.0-alpha.0-20250103-ba0c01a01",
"@matter/nodejs": "~0.12.0-alpha.0-20250103-ba0c01a01",
"@matter/nodejs-ble": "~0.12.0-alpha.0-20250103-ba0c01a01"
},

@@ -84,3 +84,3 @@ "description": "OnOff light/socket device with BLE support and advanced API usage",

"dependencies": {
"@matter/main": "~0.12.0-alpha.0-20250101-22e7c1044"
"@matter/main": "~0.12.0-alpha.0-20250103-ba0c01a01"
},

@@ -93,3 +93,3 @@ "description": "OnOff light example which logs the state changes to the console",

"dependencies": {
"@matter/main": "~0.12.0-alpha.0-20250101-22e7c1044"
"@matter/main": "~0.12.0-alpha.0-20250103-ba0c01a01"
},

@@ -102,3 +102,3 @@ "description": "Temperature/Humidity sensor with a CLI command interface to get the value",

"dependencies": {
"@matter/main": "~0.12.0-alpha.0-20250101-22e7c1044"
"@matter/main": "~0.12.0-alpha.0-20250103-ba0c01a01"
},

@@ -105,0 +105,0 @@ "description": "A simple on/off device",

{
"name": "@matter/create",
"version": "0.12.0-alpha.0-20250101-22e7c1044",
"version": "0.12.0-alpha.0-20250103-ba0c01a01",
"description": "Matter.js skeleton project generator",

@@ -35,3 +35,3 @@ "type": "module",

"devDependencies": {
"@matter/tools": "0.12.0-alpha.0-20250101-22e7c1044",
"@matter/tools": "0.12.0-alpha.0-20250103-ba0c01a01",
"@types/node": "^22.10.1",

@@ -38,0 +38,0 @@ "@types/tar-stream": "^3.1.3"

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc