You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
samples: matter: Added custom events to the Matter MS sample
Added custom events to NordicDevKit and Basic Information
clusters:
* UserButtonChanged emitted on UserButton state change
* RandomNumberChanged emitted on RandomNumber change
Updated the documentation to contain steps for the events.
Additionally fixed ids for attributes and commands that were not
compatible with the spec and fixed few minor issues in
the documentation.
Signed-off-by: Kamil Kasperczyk <kamil.kasperczyk@nordicsemi.no>
<description>Event that is generated by the server.</description>
320
322
<argname="arg1"type="int8u"/>
321
323
</event>
@@ -361,7 +363,7 @@ This guide focuses on the :ref:`ug_matter_gs_tools_matter_west_commands_zap_tool
361
363
362
364
.. code-block::
363
365
364
-
west zap-gui -j ./zcl.json ./MyCluster.xml
366
+
west zap-gui -j ./zcl.json --clusters ./MyCluster.xml
365
367
366
368
This example command copies the original :file:`<default Matter SDK location>/src/app/zap-templates/zcl/zcl.json` file, adds the :file:`MyCluster.xml` cluster, and saves the new :file:`zcl.json` file in the sample directory.
367
369
The newly generated :file:`zcl.json` file is used as an input to the ZAP tool.
Copy file name to clipboardexpand all lines: samples/matter/manufacturer_specific/README.rst
+32-17
Original file line number
Diff line number
Diff line change
@@ -37,32 +37,33 @@ The development kits for this sample offer the following IPv6 network support fo
37
37
38
38
Overview
39
39
********
40
+
41
+
The sample starts the Bluetooth® LE advertising automatically and prepares the Matter device for commissioning into a Matter-enabled IPv6 network.
42
+
40
43
.. tabs::
41
44
42
45
.. group-tab:: nRF52, nRF53 and nRF70 DKs
43
46
44
-
The sample starts the Bluetooth® LE advertising automatically and prepares the Matter device for commissioning into a Matter-enabled IPv6 network.
45
47
The sample uses the **LED 1** to show the state of the connection.
46
48
You can press **Button 1** to start the factory reset when needed.
47
49
**Button 2** is used to set the state of the ``NordicDevkit`` cluster's attribute, ``UserButton``.
48
-
Matter command ``SetLED`` is used to control the state of ``UserLED``.
49
-
It takes one argument - the action to be performed (``0`` to turn the LED off, ``1`` to turn it on, ``2`` to toggle the state).
50
50
**LED 2** reflects the state of the ``UserLED``.
51
-
The ``NordicDevkit`` cluster introduces a writable ``DevKitName`` attribute, of string type as well.
52
-
The sample additionally extends the ``Basic Information`` cluster with a ``RandomNumber`` attribute and ``GenerateRandom`` command that updates the ``RandomNumber`` with a random value.
53
51
54
52
.. group-tab:: nRF54 DKs
55
53
56
-
The sample starts the Bluetooth LE advertising automatically and prepares the Matter device for commissioning into a Matter-enabled IPv6 network.
57
54
The sample uses the **LED 0** to show the state of the connection.
58
55
You can press **Button 0** to start the factory reset when needed.
59
56
**Button 1** is used to set the state of the ``NordicDevkit`` cluster's attribute, ``UserButton``.
60
-
Matter command ``SetLED`` is used to control the state of ``UserLED``.
61
-
It takes one argument - the action to be performed (``0`` to turn the LED off, ``1`` to turn it on, ``2`` to toggle the state).
62
57
**LED 1** reflects the state of the ``UserLED``.
63
-
The ``NordicDevkit`` cluster introduces a writable ``DevKitName`` attribute, of string type as well.
64
-
The sample additionally extends the ``Basic Information`` cluster with a ``RandomNumber`` attribute and ``GenerateRandom`` command that updates the ``RandomNumber`` with a random value.
65
58
59
+
The Matter command ``SetLED`` is used to control the state of ``UserLED``.
60
+
It takes one argument - the action to be performed (``0`` to turn the LED off, ``1`` to turn it on, ``2`` to toggle the state).
61
+
The ``UserButtonChanged`` event is generated when the ``UserButton`` attribute is changed.
62
+
63
+
The ``NordicDevkit`` cluster introduces a writable ``DevKitName`` attribute, of string type as well.
64
+
The sample additionally extends the ``Basic Information`` cluster with a ``RandomNumber`` attribute and ``GenerateRandom`` command that updates the ``RandomNumber`` with a random value.
65
+
The ``RandomNumberChanged`` event is generated when the ``RandomNumber`` attribute is changed.
66
+
The ``RandomNumber`` attribute value is not persistent and it is generated on each application's boot.
66
67
67
68
Custom manufacturer-specific cluster
68
69
====================================
@@ -132,7 +133,7 @@ User interface
132
133
.. include:: /includes/matter_sample_button.txt
133
134
134
135
Button 2:
135
-
Sets the state of ``UserButton`` attribute in the ``NordicDevkit`` cluster.
136
+
Sets the state of ``UserButton`` attribute in the ``NordicDevkit`` cluster to ``true`` on press and ``false`` on release.
136
137
137
138
.. include:: /includes/matter_segger_usb.txt
138
139
@@ -148,7 +149,7 @@ User interface
148
149
.. include:: /includes/matter_sample_button.txt
149
150
150
151
Button 1:
151
-
Sets the state of ``UserButton`` attribute in the ``NordicDevkit`` cluster.
152
+
Sets the state of ``UserButton`` attribute in the ``NordicDevkit`` cluster to ``true`` on press and ``false`` on release.
152
153
153
154
.. include:: /includes/matter_segger_usb.txt
154
155
@@ -234,24 +235,24 @@ To test ``NordicDevkit`` cluster's attributes and commands, complete the followi
234
235
.. parsed-literal::
235
236
:class: highlight
236
237
237
-
any read-by-id read-by-id 0xFFF1FC01 *attribute-id* 1 1
238
+
any read-by-id 0xFFF1FC01 *attribute-id* 1 1
238
239
239
-
* *attribute-id* is the attribute's ID, equal to ``1`` for ``DevKitName``, ``2`` for ``UserLED`` and ``3`` for ``UserButton`` attributes for the ``NordicDevkit`` cluster in this sample.
240
+
* *attribute-id* is the attribute's ID, equal to ``0xFFF10000`` for ``DevKitName``, ``0xFFF10001`` for ``UserLED`` and ``0xFFF10002`` for ``UserButton`` attributes for the ``NordicDevkit`` cluster in this sample.
240
241
#. Verify that all attributes have been read correctly and are equal to the default values defined in cluster's configuration.
241
242
#. Write the ``DevkitName`` attribute:
242
243
243
244
.. parsed-literal::
244
245
:class: highlight
245
246
246
-
any write-by-id 0xFFF1FC01 1 "NewName" 1 1
247
+
any write-by-id 0xFFF1FC01 0xFFF10000 "NewName" 1 1
247
248
248
249
#. Read the ``DevkitName`` attribute again to check if it has changed.
249
250
#. Send the ``SetLED`` command to the device to control the LED state:
250
251
251
252
.. parsed-literal::
252
253
:class: highlight
253
254
254
-
any command-by-id 0xFFF1FC01 0 '{ "0x0": "u:*action*" }' 1 1
255
+
any command-by-id 0xFFF1FC01 0xFFF10000 '{ "0x0": "u:*action*" }' 1 1
255
256
256
257
* *action* is the action that should be performed on LED attribute: ``0`` to turn the LED off, ``1`` to turn it on, ``2`` to toggle the state.
257
258
@@ -261,9 +262,16 @@ To test ``NordicDevkit`` cluster's attributes and commands, complete the followi
261
262
.. parsed-literal::
262
263
:class: highlight
263
264
264
-
any subscribe-by-id 0xFFF1FC01 3 0 120 1 1
265
+
any subscribe-by-id 0xFFF1FC01 0xFFF10002 0 120 1 1
265
266
266
267
#. Press the button assigned to the ``UserButton`` and check if the attribute state is updated in the chip-tool.
268
+
#. Read the ``UserButtonChanged`` event to check that events were generated on ``UserButton`` attribute changes.
269
+
270
+
.. parsed-literal::
271
+
:class: highlight
272
+
273
+
any read-event-by-id 0xFFF1FC01 0xFFF10000 1 1
274
+
267
275
#. Read the ``Basic Information`` cluster's ``RandomNumber`` attribute:
268
276
269
277
.. parsed-literal::
@@ -279,6 +287,13 @@ To test ``NordicDevkit`` cluster's attributes and commands, complete the followi
279
287
any command-by-id 0x0028 0 '{}' 1 0
280
288
281
289
#. Verify that the random value has been generated and the attribute value is updated.
290
+
#. Read the ``Basic Information`` cluster's ``RandomNumberChanged`` event to check that events were generated on ``RandomNumber`` attribute changes.
291
+
292
+
.. parsed-literal::
293
+
:class: highlight
294
+
295
+
any read-event-by-id 0x0028 0x4 1 0
296
+
282
297
#. Reboot the device, restart the chip-tool, and check if the attributes are persisting after joining the network.
<attributeside="server"code="0x01"define="DEV_KIT_NAME"type="char_string"writable="true"optional="false"default="Nordic Development Kit">DevKitName</attribute>
<attributeside="server"code="0xFFF10000"define="DEV_KIT_NAME"type="char_string"writable="true"optional="false"default="Nordic Development Kit">DevKitName</attribute>
0 commit comments