Skip to content
Nerivec edited this page Jul 9, 2024 · 2 revisions

Use a coordinator firmware as a router and interact with the joined network. Menus will be enabled/disabled automatically based on the current state.

Warning

Work in progress

Tip

If you exit ember-zli after joining a network, the adapter will remain a router on the network as long as it has power. Use Rejoin network when starting ember-zli again to get access to other menus.

Important

Various handlers are no longer executed if you exit ember-zli after joining/rejoining a network. Because of this, Zigbee2MQTT will eventually report the device as "Offline", even though it is not.

Join network

Join an existing network as a router. You will be asked which channels to scan, then which node to join from (list is ordered by LQI) if any was found.

Important

Before starting the scan, make sure the network you wish to join is permitting join.

Caution

This action cannot be undone after confirming.

Rejoin network

Rejoin the previously joined network (if any).

Tip

Use this if you exited ember-zli and wish to simply rejoin the same network to get access to other menus.

Leave network

Leave the previously joined network (if any).

Caution

This action cannot be undone after confirming.

Backup NVM3 tokens

Backup the adapter's NVM3 Zigbee tokens to the selected location.

Important

This will write the adapter's EUI64 in the backup, to be restored.

Restore NVM3 tokens

Restore NVM3 Zigbee tokens in the adapter from the selected location.

Caution

This action cannot be undone.

Reset NVM3 tokens

Reset NVM3 Zigbee tokens in the adapter to factory defaults. Optionally exclude a few select tokens.

Caution

This action cannot be undone after confirming.

Get network info

Print the current network information, if any.

Example:

Node ID=0x3144/12612 EUI64=0xe0798dff12345678 type=ROUTER.
Network parameters:
  - PAN ID: 6754
  - Extended PAN ID: 221,221,221,221,221,221,221,221
  - Radio Channel: 11
  - Radio Power: 20 dBm
  - Preferred Channels: 11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26

Set manufacturer code

Set the manufacturer code reported by the adapter. You can pick a code from the ZCL list (quite long), or enter one manually.

Tip

You can see the full list of known codes here (same list used if you select From ZCL list).

Tip

This is used by joining devices and allows to bypass restrictions for some that are designed to be use only with specific manufacturer hubs (like Aqara/Lumi LUMI_UNITED_TECHOLOGY_LTD_SHENZHEN/4447).

Read counters

Read the NCP (adapter) counters, and optionally clear them after.

Tip

This is the same process used by Zigbee2MQTT when it logs NCP counters every hour.

Ping coordinator

Act as if Zigbee2MQTT had just requested a ping for availability.

Tip

This will update "last seen", same as if Zigbee2MQTT had just done a ping.

Reload custom event handlers

You can create custom handlers for various events that the router may register. You must use the proper filename and save it in the data folder, as described below. This menu allows you to reload these handlers at runtime if necessary.

onGreenpowerMessage.mjs

Invoked by the ZigBee Green Power stack when a GPDF is received.

/**
 * @param cmd Command The invoking oclif command object https://oclif.io/
 *        - The EZSP layer is available through `cmd.ezsp`
 * @param logger winston.Logger The winston logger https://github.com/winstonjs/winston
 * @param sequenceNumber number The sequence associated with the message
 * @param commandIdentifier number The Green Power cluster command ID for this message
 * @param sourceId number The ID of the source of the message (network address)
 * @param frameCounter number The frame counter associated with the packet
 * @param gpdCommandId number The Green Power command ID in the message
 * @param gpdCommandPayload Buffer The content of the message
 * @param gpdLink number The LQI value associated with the message
 */
function onGreenpowerMessage(cmd, logger, sequenceNumber, commandIdentifier, sourceId, frameCounter, gpdCommandId, gpdCommandPayload, gpdLink) {
    // do something here
}

export default onGreenpowerMessage;

onIncomingMessage.mjs

Invoked when a typical Zigbee message has been received.

/**
 * @param cmd Command The invoking oclif command object https://oclif.io/
 *        - The EZSP layer is available through `cmd.ezsp`
 * @param logger winston.Logger The winston logger https://github.com/winstonjs/winston
 * @param type EmberIncomingMessageType The type of the message
 * @param apsFrame EmberApsFrame The APS frame of the message
 * @param lastHopLqi number The LQI value associated with the message
 * @param sender NodeId The network address of the sender of the message
 * @param messageContents Buffer The content of the message
 */
function onIncomingMessage(cmd, logger, type, apsFrame, lastHopLqi, sender, messageContents) {
    // do something here
}

export default onIncomingMessage;

onMessageSent.mjs

Invoked when a message has been sent or failed to send.

/**
 * @param cmd Command The invoking oclif command object https://oclif.io/
 *        - The EZSP layer is available through `cmd.ezsp`
 * @param logger winston.Logger The winston logger https://github.com/winstonjs/winston
 * @param status SLStatus The status of the message. Can be `0` (`OK`) or `3074` (`ZIGBEE_DELIVERY_FAILED`)
 * @param type EmberOutgoingMessageType The type of the message
 * @param indexOrDestination number The destination of the message
 * @param apsFrame EmberApsFrame The APS frame of the message
 * @param messageTag number The tag the message was given when sent
 */
function onMessageSent(cmd, logger, status, type, indexOrDestination, apsFrame, messageTag) {
    // do something here
}

export default onMessageSent;

onStackStatus.mjs

Invoked when the status of the stack changes (network up, down, open, close, etc.).

/**
 * @param cmd Command The invoking oclif command object https://oclif.io/
 *        - The EZSP layer is available through `cmd.ezsp`
 * @param logger winston.Logger The winston logger https://github.com/winstonjs/winston
 * @param status SLStatus The new status of the stack
 */
function onStackStatus(cmd, logger, status: SLStatus) {
    // do something here
}

export default onStackStatus;

onTouchlinkMessage.mjs

Invoked when a raw MAC message matches the Touchlink / ZLL profile.

/**
 * @param cmd Command The invoking oclif command object https://oclif.io/
 *        - The EZSP layer is available through `cmd.ezsp`
 * @param logger winston.Logger The winston logger https://github.com/winstonjs/winston
 * @param sourcePanId PanId The PAN ID of the source.
 * @param sourceAddress EUI64 The EUI64 of the source.
 * @param groupId null|number The group ID, if any.
 * @param lastHopLqi number The LQI value associated with the message
 * @param messageContents Buffer The content of the message
 */
function onTouchlinkMessage(cmd, logger, sourcePanId, sourceAddress, groupId, lastHopLqi, messageContents) {
    // do something here
}

export default onTouchlinkMessage;

onZDOResponse.mjs

Invoked when a ZDO message has been received.

/**
 * @param cmd Command The invoking oclif command object https://oclif.io/
 *        - The EZSP layer is available through `cmd.ezsp`
 * @param logger winston.Logger The winston logger https://github.com/winstonjs/winston
 * @param apsFrame EmberApsFrame The APS frame of the message
 * @param sender NodeId The network address of the sender of the message
 * @param messageContents Buffer The content of the message
 */
function onZDOResponse(cmd, logger, apsFrame, sender, messageContents) {
    // do something here
}

export default onZDOResponse;

Run custom script

Execute the selected *.mjs script.

/**
 * @param cmd Command The invoking oclif command object https://oclif.io/
 *        - The EZSP layer is available through `cmd.ezsp`
 * @param logger winston.Logger The winston logger https://github.com/winstonjs/winston
 */
function custom(cmd, logger) {
    // do something here
}

export default custom;