@matter/examples 0.16.0-alpha.0-20250916-d577beb1d → 0.16.0-alpha.0-20250920-809524dba

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/README.md CHANGED
@@ -6,6 +6,9 @@ This project provides a set of reference implementations to show several types o
6
6
 
7
7
  > This package supports all Node.js LTS versions starting with 18.x
8
8
 
9
+ > [!IMPORTANT]
10
+ > matter.js as library, along with all related tools (such as the Shell app) and examples, is not certified by the Connectivity Standards Alliance (CSA). They are provided solely to demonstrate the capabilities of our solution and to support testing and development. Using matter.js does not certify your product — Connectivity Standards Alliance membership and product certification are required to release official Matter devices. For more details, see [A note on certification](https://github.com/matter-js/matter.js/blob/main/README.md#a-note-on-certification).
11
+
9
12
  To better show how to use the library we provide some reference implementations in the examples directory. They are usable as CLI scripts without changes in the first place but are very simple. They are meant to be used as a starting point for your own implementation, or to experiment with Matter at all in a first place.
10
13
 
11
14
  For BLE usage please also see the [@matter/node-ble README.md](../nodejs-ble/README.md) for prerequisites and limitations!
@@ -21,7 +21,7 @@ switch (command) {
21
21
  case "toggle":
22
22
  {
23
23
  const endpointNo = Number.parseInt(args[0]);
24
- if (args.length !== 1 || Number.isNaN(endpointNo)) {
24
+ if (args.length !== 1 || !Number.isFinite(endpointNo)) {
25
25
  die(`Usage: ${process.argv[0]} toggle <endpoint number>`);
26
26
  }
27
27
  const node = controller.nodes.get("device");
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/control-onoff/OnOffController.ts"],
4
- "mappings": "AAAA;AAAA;AAAA;AAAA;AAAA;AAYA,SAAS,kBAAkB;AAC3B,SAAS,mBAAmB;AAG5B,MAAM,aAAa,MAAM,WAAW,OAAO;AAE3C,MAAM,CAAC,EAAE,EAAE,SAAS,GAAG,IAAI,IAAI,QAAQ,KAAK,MAAM,CAAC;AAEnD,QAAQ,SAAS;AAAA,EACb,KAAK;AAED,QAAI,WAAW,MAAM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ha.0-20250916-d577beb1d",
3
+ "version": "0.16.0-alpha.0-20250920-809524dba",
4
4
  "description": "Matter.js examples and reference implementations",
5
5
  "keywords": [
6
6
  "iot",
@@ -55,14 +55,14 @@
55
55
  "matter-controller": "dist/esm/controller/ControllerNode.js"
56
56
  },
57
57
  "dependencies": {
58
- "@matter/main": "0.16.0-alpha.0-20250916-d577beb1d",
59
- "@matter/nodejs": "0.16.0-alpha.0-20250916-d577beb1d",
60
- "@matter/tools": "0.16.0-alpha.0-20250916-d577beb1d",
61
- "@project-chip/matter.js": "0.16.0-alpha.0-20250916-d577beb1d",
58
+ "@matter/main": "0.16.0-alpha.0-20250920-809524dba",
59
+ "@matter/nodejs": "0.16.0-alpha.0-20250920-809524dba",
60
+ "@matter/tools": "0.16.0-alpha.0-20250920-809524dba",
61
+ "@project-chip/matter.js": "0.16.0-alpha.0-20250920-809524dba",
62
62
  "esbuild": "^0.25.9"
63
63
  },
64
64
  "optionalDependencies": {
65
- "@matter/nodejs-ble": "0.16.0-alpha.0-20250916-d577beb1d"
65
+ "@matter/nodejs-ble": "0.16.0-alpha.0-20250920-809524dba"
66
66
  },
67
67
  "engines": {
68
68
  "node": ">=20.19.0 <22.0.0 || >=22.13.0"
@@ -38,7 +38,7 @@ switch (command) {
38
38
  {
39
39
  // Validation
40
40
  const endpointNo = Number.parseInt(args[0]);
41
- if (args.length !== 1 || Number.isNaN(endpointNo)) {
41
+ if (args.length !== 1 || !Number.isFinite(endpointNo)) {
42
42
  die(`Usage: ${process.argv[0]} toggle <endpoint number>`);
43
43
  }
44
44
  const node = controller.nodes.get("device");
@@ -1,6 +1,9 @@
1
1
  # Simple light controller
2
2
 
3
+ > [!IMPORTANT]
4
+ > matter.js as library, along with all related tools (such as the Shell app) and examples, is not certified by the Connectivity Standards Alliance (CSA). They are provided solely to demonstrate the capabilities of our solution and to support testing and development. Using matter.js does not certify your product — Connectivity Standards Alliance membership and product certification are required to release official Matter devices. For more details, see [A note on certification](https://github.com/matter-js/matter.js/blob/main/README.md#a-note-on-certification).
5
+
3
6
  This is an example of a simple Matter controller. A "controller" is a device that can add another device to a Matter
4
7
  network. This process is called "commissioning".
5
8
 
6
- In this case the device can add another device that supports the "on/off" cluster and toggle it on or off.
9
+ In this case the device can add another device that supports the "on/off" cluster and toggle it on or off.
@@ -1,5 +1,8 @@
1
1
  # Controller example to commission and connect devices
2
2
 
3
+ > [!IMPORTANT]
4
+ > matter.js as library, along with all related tools (such as the Shell app) and examples, is not certified by the Connectivity Standards Alliance (CSA). They are provided solely to demonstrate the capabilities of our solution and to support testing and development. Using matter.js does not certify your product — Connectivity Standards Alliance membership and product certification are required to release official Matter devices. For more details, see [A note on certification](https://github.com/matter-js/matter.js/blob/main/README.md#a-note-on-certification).
5
+
3
6
  This example shows basically how a controller could be implemented by showing pairing and connections to a paired device. When there is an OnOff Endpoint with ID 1 then this is controlled and toggled.
4
7
 
5
8
  ## Usage
@@ -1,5 +1,8 @@
1
1
  # Air quality sensor example
2
2
 
3
+ > [!IMPORTANT]
4
+ > matter.js as library, along with all related tools (such as the Shell app) and examples, is not certified by the Connectivity Standards Alliance (CSA). They are provided solely to demonstrate the capabilities of our solution and to support testing and development. Using matter.js does not certify your product — Connectivity Standards Alliance membership and product certification are required to release official Matter devices. For more details, see [A note on certification](https://github.com/matter-js/matter.js/blob/main/README.md#a-note-on-certification).
5
+
3
6
  This example shows how to build a simple Air quality Sensor device with temperature, humidity, PMx and TVOC measurements.
4
7
  It just defines initial static values, so it won't change over time.
5
8
 
@@ -1,5 +1,8 @@
1
1
  # Bridge for multiple OnOff light/sockets with a CLI command execution interface
2
2
 
3
+ > [!IMPORTANT]
4
+ > matter.js as library, along with all related tools (such as the Shell app) and examples, is not certified by the Connectivity Standards Alliance (CSA). They are provided solely to demonstrate the capabilities of our solution and to support testing and development. Using matter.js does not certify your product — Connectivity Standards Alliance membership and product certification are required to release official Matter devices. For more details, see [A note on certification](https://github.com/matter-js/matter.js/blob/main/README.md#a-note-on-certification).
5
+
3
6
  This example shows how to build a Matter-Bridge that offers multiple OnOff lights and sockets as a bridge. It can be configured via command line and allows for specifications of shell commands to be executed when on and off commands are received at the numbered devices. For more details see below.
4
7
 
5
8
  A Bridge is used to expose multiple devices at once.
@@ -1,5 +1,8 @@
1
1
  # Composed device for multiple OnOff light/sockets with a CLI command execution interface
2
2
 
3
+ > [!IMPORTANT]
4
+ > matter.js as library, along with all related tools (such as the Shell app) and examples, is not certified by the Connectivity Standards Alliance (CSA). They are provided solely to demonstrate the capabilities of our solution and to support testing and development. Using matter.js does not certify your product — Connectivity Standards Alliance membership and product certification are required to release official Matter devices. For more details, see [A note on certification](https://github.com/matter-js/matter.js/blob/main/README.md#a-note-on-certification).
5
+
3
6
  This example shows how to build a "simple" composed device where multiple OnOff lights and sockets are combined as a single device. The devices are all added at the root level, so no bridge is used. It can be configured via command line and allows for specifications of shell commands to be executed when on and off commands are received at the numbered devices. For more details see below.
4
7
 
5
8
  A composed device is one device with multiple different device types combined. This is useful for devices that have multiple functions, e.g. a light bulb with a temperature sensor.
@@ -1,5 +1,8 @@
1
1
  # Composed device with Window covering and a light endpoint that logs changes
2
2
 
3
+ > [!IMPORTANT]
4
+ > matter.js as library, along with all related tools (such as the Shell app) and examples, is not certified by the Connectivity Standards Alliance (CSA). They are provided solely to demonstrate the capabilities of our solution and to support testing and development. Using matter.js does not certify your product — Connectivity Standards Alliance membership and product certification are required to release official Matter devices. For more details, see [A note on certification](https://github.com/matter-js/matter.js/blob/main/README.md#a-note-on-certification).
5
+
3
6
  This example implements the Window Covering cluster server logic and also overrides a OnOff cluster server to build a composed devices with a window covering nd a light.
4
7
 
5
8
  ## Usage
@@ -1,5 +1,8 @@
1
1
  # Socket device that reports random Energy and Power measurements
2
2
 
3
+ > [!IMPORTANT]
4
+ > matter.js as library, along with all related tools (such as the Shell app) and examples, is not certified by the Connectivity Standards Alliance (CSA). They are provided solely to demonstrate the capabilities of our solution and to support testing and development. Using matter.js does not certify your product — Connectivity Standards Alliance membership and product certification are required to release official Matter devices. For more details, see [A note on certification](https://github.com/matter-js/matter.js/blob/main/README.md#a-note-on-certification).
5
+
3
6
  This example shows how to run a simple socket device that also includes a power and energy measurement. It is not configurable via CLI and only sets random energy and power values when turned on.
4
7
 
5
8
 
@@ -1,5 +1,8 @@
1
1
  # Multiple OnOff light/socket nodes in one process with a CLI command execution interface
2
2
 
3
+ > [!IMPORTANT]
4
+ > matter.js as library, along with all related tools (such as the Shell app) and examples, is not certified by the Connectivity Standards Alliance (CSA). They are provided solely to demonstrate the capabilities of our solution and to support testing and development. Using matter.js does not certify your product — Connectivity Standards Alliance membership and product certification are required to release official Matter devices. For more details, see [A note on certification](https://github.com/matter-js/matter.js/blob/main/README.md#a-note-on-certification).
5
+
3
6
  This example shows how to start multiple Matter nodes on one MatterServer where each node is run on its own Port, but share a single MDNS broadcaster and scanner in order to optimize resources. Each node can be configured via CLI to be an onoff socket or a light. CLI. Options also allow specification of shell commands to be executed for on and off commands.
4
7
 
5
8
  matter.js also allows it to start multiple devices in one process. With this especially the MDNS functionalities are shared between these processes and it should use less resources. How many devices you acn add in one process depends on the load they produce and how many devices run in the single Node.js thread.
@@ -1,5 +1,8 @@
1
1
  # OnOff light/socket device with a CLI command execution interface
2
2
 
3
+ > [!IMPORTANT]
4
+ > matter.js as library, along with all related tools (such as the Shell app) and examples, is not certified by the Connectivity Standards Alliance (CSA). They are provided solely to demonstrate the capabilities of our solution and to support testing and development. Using matter.js does not certify your product — Connectivity Standards Alliance membership and product certification are required to release official Matter devices. For more details, see [A note on certification](https://github.com/matter-js/matter.js/blob/main/README.md#a-note-on-certification).
5
+
3
6
  This example shows how to build a simple minimalistic DeviceNode with just one socket or light endpoint. The shell commands to be executed by on/off commands can be configured via CLI.
4
7
 
5
8
  ## Usage
@@ -1,5 +1,8 @@
1
1
  # OnOff light/socket device with BLE support and advanced API usage
2
2
 
3
+ > [!IMPORTANT]
4
+ > matter.js as library, along with all related tools (such as the Shell app) and examples, is not certified by the Connectivity Standards Alliance (CSA). They are provided solely to demonstrate the capabilities of our solution and to support testing and development. Using matter.js does not certify your product — Connectivity Standards Alliance membership and product certification are required to release official Matter devices. For more details, see [A note on certification](https://github.com/matter-js/matter.js/blob/main/README.md#a-note-on-certification).
5
+
3
6
  This example shows how to build a simple Device node with just one socket or light endpoint. The shell commands to be executed by on/off commands can be configured via CLI. Additionally, this example also shows the following use cases:
4
7
  - it shows how to enable BLE for a device node and tweaks the announcement so that BLE is only announced in the beginning.
5
8
  -it includes a dummy WifiNetworkCommissioning and a dummy ThreadNetworkCommissioning implementation that simulates Wi-Fi/Thread logic for the commissioner and logs the Wi-Fi/Thread credentials the commissioner sends to the device.
@@ -1,5 +1,8 @@
1
1
  # OnOff light example which logs the state changes to the console
2
2
 
3
+ > [!IMPORTANT]
4
+ > matter.js as library, along with all related tools (such as the Shell app) and examples, is not certified by the Connectivity Standards Alliance (CSA). They are provided solely to demonstrate the capabilities of our solution and to support testing and development. Using matter.js does not certify your product — Connectivity Standards Alliance membership and product certification are required to release official Matter devices. For more details, see [A note on certification](https://github.com/matter-js/matter.js/blob/main/README.md#a-note-on-certification).
5
+
3
6
  This example shows how to run a Light device which is not configurable via CLI and only logs changes, so it is the most minimalistic example. It shows how to enhance the OnOff cluster server with own logic.
4
7
 
5
8
  ## Usage
@@ -1,5 +1,8 @@
1
1
  # Robotic Vacuum Cleaner Example
2
2
 
3
+ > [!IMPORTANT]
4
+ > matter.js as library, along with all related tools (such as the Shell app) and examples, is not certified by the Connectivity Standards Alliance (CSA). They are provided solely to demonstrate the capabilities of our solution and to support testing and development. Using matter.js does not certify your product — Connectivity Standards Alliance membership and product certification are required to release official Matter devices. For more details, see [A note on certification](https://github.com/matter-js/matter.js/blob/main/README.md#a-note-on-certification).
5
+
3
6
  This example shows how to run a Robot Vacuum Cleaning device. This is a bit more complex and implements the following
4
7
  (fictional) features and state engine:
5
8
  * Supports Run Modes: Idle, Quick-Clean (one cleaning round), Auto-Clean (3 rounds for one cycle and does cleaning again after 3h)
@@ -1,5 +1,8 @@
1
1
  # Temperature/Humidity sensor with a CLI command interface to get the value
2
2
 
3
+ > [!IMPORTANT]
4
+ > matter.js as library, along with all related tools (such as the Shell app) and examples, is not certified by the Connectivity Standards Alliance (CSA). They are provided solely to demonstrate the capabilities of our solution and to support testing and development. Using matter.js does not certify your product — Connectivity Standards Alliance membership and product certification are required to release official Matter devices. For more details, see [A note on certification](https://github.com/matter-js/matter.js/blob/main/README.md#a-note-on-certification).
5
+
3
6
  This example shows how to build a simple Sensor device with a temperature (default) or humidity (`--type humidity`) sensor. The sensor values are updated by default every 60 seconds, or the number of seconds specified via the CLI parameter `--interval`. The value can be defined by the output of a CLI script provided via parameter `--value` or, if no command is specified, are randomly set in the interval -50..+50. To read the Temperature of a Raspberry Pi as example use `--value ="echo \$((\$(</sys/class/thermal/thermal_zone0/temp)/10))"` or to read temperature of your location `--value="curl -s 'wttr.in/?format=%t\&m' | sed 's/°C//'| awk '{print \$1*100}'"` (or use `?format=%h` for humidity).
4
7
 
5
8
  ## Usage
@@ -1,3 +1,6 @@
1
1
  # A simple on/off device
2
2
 
3
+ > [!IMPORTANT]
4
+ > matter.js as library, along with all related tools (such as the Shell app) and examples, is not certified by the Connectivity Standards Alliance (CSA). They are provided solely to demonstrate the capabilities of our solution and to support testing and development. Using matter.js does not certify your product — Connectivity Standards Alliance membership and product certification are required to release official Matter devices. For more details, see [A note on certification](https://github.com/matter-js/matter.js/blob/main/README.md#a-note-on-certification).
5
+
3
6
  This is the simplest possible matter.js device.
@@ -1,5 +1,8 @@
1
1
  # Smoke CO Alarm Example
2
2
 
3
+ > [!IMPORTANT]
4
+ > matter.js as library, along with all related tools (such as the Shell app) and examples, is not certified by the Connectivity Standards Alliance (CSA). They are provided solely to demonstrate the capabilities of our solution and to support testing and development. Using matter.js does not certify your product — Connectivity Standards Alliance membership and product certification are required to release official Matter devices. For more details, see [A note on certification](https://github.com/matter-js/matter.js/blob/main/README.md#a-note-on-certification).
5
+
3
6
  This example shows how to build a simple Smoke&CO Alarm Sensor Matter device. It just defines initial static values,
4
7
  so it won't change over time.
5
8