Skip to content

Commit

Permalink
add read/write zcl attribute documentation.
Browse files Browse the repository at this point in the history
  • Loading branch information
tim-vk committed Nov 28, 2024
1 parent 44d0791 commit c447044
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions docs/guide/usage/mqtt_topics_and_messages.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,42 @@ Publishing messages depends on the MQTT client you use. For example to publish a
mosquitto_pub -t 'zigbee2mqtt/0x0fffffffffffffff/set' -m '{ "state": "ON" }'
```

#### Directly reading/writing ZCL attributes
For development/debug purposes it's possible to directly send read/write attribute requests to a device through this endpoint.

##### Read requests:

```js
{
"read": {
"cluster": genBasic, // Either name (if defined in standard) or ID of cluster can be used
"attributes": [1] // Either name (if defined in standard) or ID of attribute can be used
}
}
```
##### Write requests:

Writing one or multiple attributes can be done in multiple ways:

```js
{
"write": {
"cluster": "genBasic" // Either the name or ID can be used.
"payload" {
// If the attribute ID is one of the predefined types you can directly write using key:value
"manufacturerName": "Best Manufacturer"
// If the attribute ID is not a predefined one (out of the ZCL specifications)
// it still can be written with the following syntax.
"0": // ID
{
"value": "Best Manufacturer",
"type": 66 // type enum as defined in ZCL specifications. Can be found using a `read` command or from specifications.
}
}
}
}
```

## zigbee2mqtt/FRIENDLY_NAME/get

This is the counterpart of the `set` command. It allows you to read a value from a device. To read e.g. the state of a device send the payload `{"state": ""}`. What you can `/get` is specified on the device page under the _Exposes_ section.
Expand Down

0 comments on commit c447044

Please sign in to comment.