Skip to content

Commit ba8947e

Browse files
authoredNov 25, 2024··
(fix/doc) Move the Python example a little further in README (#970)
1 parent e623404 commit ba8947e

File tree

1 file changed

+20
-16
lines changed

1 file changed

+20
-16
lines changed
 

‎README.md

+20-16
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,26 @@ When the start_listening command is issued, the server will dump all existing no
246246

247247
**Send a command**
248248

249-
Because we use the datamodels of the Matter SDK, this is a little bit more involved. Here is an example of turning on a switch:
249+
Here is an example of turning on a switch (OnOff cluster)
250+
251+
```json
252+
{
253+
"message_id": "example",
254+
"command": "device_command",
255+
"args": {
256+
"endpoint_id": 1,
257+
"node_id": 1,
258+
"payload": {},
259+
"cluster_id": 6,
260+
"command_name": "On"
261+
}
262+
}
263+
```
264+
265+
**Python script to send a command**
266+
267+
Because we use the datamodels of the Matter SDK, this is a little bit more involved.
268+
Here is an example of turning on a switch:
250269

251270
```python
252271
import json
@@ -275,21 +294,6 @@ message = {
275294

276295
print(json.dumps(message, indent=2))
277296
```
278-
279-
```json
280-
{
281-
"message_id": "example",
282-
"command": "device_command",
283-
"args": {
284-
"endpoint_id": 1,
285-
"node_id": 1,
286-
"payload": {},
287-
"cluster_id": 6,
288-
"command_name": "On"
289-
}
290-
}
291-
```
292-
293297
You can also provide parameters for the cluster commands. Here's how to change the brightness for example:
294298

295299
```python

0 commit comments

Comments
 (0)
Please sign in to comment.