nRF5 SDK for Thread and Zigbee v1.0.0
Choose documentation:
Zigbee CLI Reference

The Zigbee CLI supports the following commands:

Every command prints Done when it is finished, or Error: <reason> in case of errors.

Note
The command argument description uses the following convention:
  • command [arg]: square brackets mean that an argument is optional.
  • command <d:arg1> <h:arg2>: a single letter before an argument name defines the format of the argument:
    • h: hexadecimal strings (arg2),
    • d: decimal values (arg1).
  • command <arg> ...: the ellipsis after an argument means that the preceding argument can be repeated several times.

state - Set or get Zigbee role of the device.

state [<role>]
Precondition
Setting only before starting zigbee. Reading only after starting zigbee.

If the optional argument is not provided, get the state of the device.
Returns:

  • zc if it is a coordinator,
  • zr it it is a router,
  • zed if it is an end device.

If the optional argument is provided, set the device role to role. Can be either zc or zr.

Note
Zigbee End Device is not currently supported on the CLI Agent.

eui64 - Get the EUI64 address of the Zigbee device.

uart_cli:~$ eui64
0b010eaafd745dfa
Done

short - Get the short 16-bit address of the Zigbee device.

uart_cli:~$ short
0000
Done

extpanid - Set or get the Zigbee Extended Pan ID value.

extpanid [<h:id>]
Precondition
Setting only before starting zigbee. Reading only after starting zigbee.

If the optional argument is not provided, gets the extended PAN ID of the joined network.

If the optional argument is provided, gets the extended PAN ID to id.


zigbee - Start the commissioning process.

uart_cli:~$ zigbee start
Started coordinator
Done

channel - Set or get 802.15.4 channel

channel <n>
Precondition
Setting only before starting zigbee.

If the optional argument is not provided, get the current number and bitmask of the channel.

If the optional argument is provided:

  • If n is in [11:26] range, set to that channel.
  • Otherwise, treat n as bitmask (logical or of a single bit shifted by channel number).

Example:

uart_cli:~$ channel 0x110000
Setting channel bitmask to 110000
Done

fem - Activate or deactivate FEM

fem <enable|disable>

The configuration of the FEM is the default one (defined at compile time, see the define NRF_802154_FEM_DEFAULT_SETTINGS).

For more information, see the description of the FEM on the 802.15.4 radio driver Wiki.


match_desc - Send match descriptor request.

match_desc <h:16-bit destination address>
<h:requested address/type> <h:profile ID>
<d:number of input clusters> [<h:input cluster IDs> ...]
<d:number of output clusters> [<h:output cluster IDs> ...]

Send Match Descriptor Request to the dst_addr node that is a query about the req_addr node of the prof_id profile ID, which must have at least one of n_input_clusters(whose IDs are listed in {...}) or n_output_clusters (whose IDs are listed in {...}). The IDs can be either a decimal value or a hexadecimal string.

Example:

match_desc 0xfffd 0xfffd 0x0104 1 6 0

In this example, the command sends a Match Descriptor Request to all non-sleeping nodes regarding all non-sleeping nodes that have 1 input cluster ON/OFF (ID 6) and 0 output clusters.


bind - Create a binding between two endpoints on two nodes.

bind <h:source eui64> <d:source ep> <h:destination eui64>
<d:destination ep> <h:source cluster id> <h:request dst addr>`

Create bound connection between a device identified by source eui64 and endpoint source ep, and a device identified by destination eui64 and endpoint destination ep. The connection is created for ZCL commands and attributes assigned to the ZCL cluster source cluster id on the request dst addr node (usually the same address as for the source eui64 device).

Example:

bind 0B010E0405060708 1 0B010E4050607080 2 8

unbind - Remove a binding between two endpoints on two nodes.

unbind <h:source eui64> <d:source ep> <h:destination eui64>
<d:destination ep> <h:source cluster id> <h:request dst addr>`

Remove bound connection between a devices identified by source eui64 and endpoint source ep, and a device identified by destination eui64 and endpoint destination ep. The connection is removed for ZCL commands and attributes assigned to the ZCL cluster source cluster id on the request dst addr node (usually the same address as for the source eui64 device).


nwk_addr - Resolve eui64 address to a short network address.

nwk_addr <h:eui64>

Example:

nwk_addr 0B010E0405060708

ieee_addr - Resolve EUI64 by sending IEEE address request.

ieee_addr <h:short_addr>

readattr - Retrieve the attribute value of the remote node.

readattr <h:dst_addr> <d:ep> <h:cluster> <h:profile> <h:attr_id>

Read the value of the attribute attr_id in the cluster cluster. The cluster belongs to the profile profile, which resides on the endpoint ep of the remote node dst_addr.


writeattr - Write the attribute value to the remote node.

writeattr <h:dst_addr> <d:ep> <h:cluster> <h:profile> <h:attr_id> <h:attr_type> <h:attr_value>

Write the attr_value value of the attribute attr_id of the type attr_type in the cluster cluster. The cluster belongs to the profile profile, which resides on the endpoint ep of the remote node dst_addr.

Note
The attr_value value must be in hexadecimal format, unless it is a string (attr_type == 42), then it must be a string.

subscribe - Subscribe to the attribute changes on the remote node.

subscribe <h:eui64> <d:ep> <h:cluster> <h:profile>
<h:attr ID> <d:attr type>
[<d:min interval (s)>] [<d:max interval (s)>]

Enable reporting on the node identified by eui64, with the endpoint ep that uses the profile profile of the attribute attr ID with the type attr type in the cluster cluster.

Reports must be generated in intervals not shorter than min interval (1 second by default) and not longer than max interval (60 seconds by default).


unsubscribe - Unsubscribe from attribute reports.

unsubscribe <h:eui64> <d:ep> <h:cluster> <h:profile> <h:attr ID> <d:attr type>

Disable reporting on the node identified by eui64, with the endpoint ep that uses the profile profile of the attribute attr ID with the type attr type in the cluster cluster.


ping - ping over ZCL

ping [--no-echo] [--aps-ack] <h:eui64> <d:payload size>

Example:

ping 0b010eaafd745dfa 32
Precondition
Only after starting zigbee.

Issue a ping-style command to another CLI device of the address dst_addr by using payload_size bytes of payload.

Optionally, the device can request an APS acknowledgement (--aps-ack) or ask destination not to sent ping reply (--no-echo).

To implement the ping-like functionality, a new custom cluster has been defined with ID 64. There are four custom commands defined inside it, each with its own ID.

See the following flow graphs for details.

  • Case 1: Ping with echo, without the APS acknowledgement (default mode):

    App 1 Node 1 Node 2
    | -- ping -> | -- ping request -> | (command ID: 0x02 - ping request without the APS acknowledgement)
    | | <- MAC ACK -- |
    | | <- ping reply -- | (command ID: 0x01 - ping reply)
    | | -- MAC ACK -> |
    | <- Done -- | |

    In this default mode, the ping command measures the time needed for a Zigbee frame to travel between two nodes in the network (there and back again). The command uses a custom "overloaded" ZCL frame, which is constructed as a ZCL frame of the new custom ping ZCL cluster (ID 64).

  • Case 2: Ping with echo, with the APS acknowledgement:
    App 1 Node 1 Node 2
    | -- ping -> | -- ping request -> | (command ID: 0x00 - ping request with the APS acknowledgement)
    | | <- MAC ACK -- |
    | | <- APS ACK -- |
    | | -- MAC ACK -> |
    | | <- ping reply -- | (command ID: 0x01 - ping reply)
    | | -- MAC ACK -> |
    | | -- APS ACK -> |
    | | <- MAC ACK -- |
    | <- Done -- | |
  • Case 3: Ping without echo, with the APS acknowledgement:
    App 1 Node 1 Node 2
    | -- ping -> | -- ping request -> | (command ID: 0x03 - ping request without echo)
    | | <- MAC ACK -- |
    | | <- APS ACK -- |
    | | -- MAC ACK -> |
    | <- Done -- | |
  • Case 4: Ping without echo, without the APS acknowledgement:
    App 1 Node 1 Node 2
    | -- ping -> | -- ping request -> | (command ID: 0x03 - ping request without echo)
    | <- Done -- | |
    | | <- MAC ACK -- |