Skip to content

Commit

Permalink
zigbee-herdsman 0.55.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Nerivec committed Jul 23, 2024
1 parent bba1b05 commit 878e762
Show file tree
Hide file tree
Showing 6 changed files with 61 additions and 55 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ $ npm install -g ember-zli
$ ember-zli COMMAND
running command...
$ ember-zli (--version)
ember-zli/2.1.5 win32-x64 node-v20.15.0
ember-zli/2.1.6 win32-x64 node-v20.15.0
$ ember-zli --help [COMMAND]
USAGE
$ ember-zli COMMAND
Expand Down Expand Up @@ -111,7 +111,7 @@ EXAMPLES
$ ember-zli bootloader
```

_See code: [src/commands/bootloader/index.ts](https://github.com/Nerivec/ember-zli/blob/v2.1.5/src/commands/bootloader/index.ts)_
_See code: [src/commands/bootloader/index.ts](https://github.com/Nerivec/ember-zli/blob/v2.1.6/src/commands/bootloader/index.ts)_

## `ember-zli help [COMMAND]`

Expand Down Expand Up @@ -148,7 +148,7 @@ EXAMPLES
$ ember-zli router
```

_See code: [src/commands/router/index.ts](https://github.com/Nerivec/ember-zli/blob/v2.1.5/src/commands/router/index.ts)_
_See code: [src/commands/router/index.ts](https://github.com/Nerivec/ember-zli/blob/v2.1.6/src/commands/router/index.ts)_

## `ember-zli sniff`

Expand All @@ -165,7 +165,7 @@ EXAMPLES
$ ember-zli sniff
```

_See code: [src/commands/sniff/index.ts](https://github.com/Nerivec/ember-zli/blob/v2.1.5/src/commands/sniff/index.ts)_
_See code: [src/commands/sniff/index.ts](https://github.com/Nerivec/ember-zli/blob/v2.1.6/src/commands/sniff/index.ts)_

## `ember-zli stack`

Expand All @@ -182,7 +182,7 @@ EXAMPLES
$ ember-zli stack
```

_See code: [src/commands/stack/index.ts](https://github.com/Nerivec/ember-zli/blob/v2.1.5/src/commands/stack/index.ts)_
_See code: [src/commands/stack/index.ts](https://github.com/Nerivec/ember-zli/blob/v2.1.6/src/commands/stack/index.ts)_

## `ember-zli utils`

Expand All @@ -199,7 +199,7 @@ EXAMPLES
$ ember-zli utils
```

_See code: [src/commands/utils/index.ts](https://github.com/Nerivec/ember-zli/blob/v2.1.5/src/commands/utils/index.ts)_
_See code: [src/commands/utils/index.ts](https://github.com/Nerivec/ember-zli/blob/v2.1.6/src/commands/utils/index.ts)_

## `ember-zli version`

Expand Down
12 changes: 6 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "ember-zli",
"description": "Interact with EmberZNet-based adapters using zigbee-herdsman 'ember' driver",
"version": "2.1.5",
"version": "2.1.6",
"author": "Nerivec",
"bin": {
"ember-zli": "bin/run.js"
Expand All @@ -17,7 +17,7 @@
"cli-progress": "^3.12.0",
"crc-32": "^1.2.2",
"winston": "^3.13.0",
"zigbee-herdsman": "0.54.1"
"zigbee-herdsman": "0.55.1"
},
"devDependencies": {
"@oclif/prettier-config": "^0.2.1",
Expand Down
80 changes: 43 additions & 37 deletions src/commands/router/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import {
EzspStatus,
SLStatus,
} from 'zigbee-herdsman/dist/adapter/ember/enums.js'
import { EZSP_MAX_FRAME_LENGTH } from 'zigbee-herdsman/dist/adapter/ember/ezsp/consts.js'
import { Ezsp, EzspEvents } from 'zigbee-herdsman/dist/adapter/ember/ezsp/ezsp.js'
import {
EmberApsFrame,
Expand Down Expand Up @@ -198,9 +197,9 @@ export default class Router extends Command {

this.customEventHandlers[handler as keyof CustomEventHandlers] = importedScript.default

logger.info(`Loaded custom handler for ${handler}.`)
logger.info(`Loaded custom handler for '${handler}'.`)
} catch (error) {
logger.error(`Failed to load custom handler for ${handler}. ${error}`)
logger.error(`Failed to load custom handler for '${handler}'. ${error}`)
}
}
}
Expand Down Expand Up @@ -288,7 +287,7 @@ export default class Router extends Command {
status = await this.ezsp.ezspSetRadioPower(radioTxPower)

if (status !== SLStatus.OK) {
logger.error(`Failed to set transmit power to ${radioTxPower} status=${SLStatus[status]}.`)
logger.error(`Failed to set transmit power to '${radioTxPower}' status=${SLStatus[status]}.`)
return true
}

Expand Down Expand Up @@ -996,40 +995,51 @@ export default class Router extends Command {
apsFrame: EmberApsFrame,
messageTag: number,
): Promise<void> {
if (status === SLStatus.ZIGBEE_DELIVERY_FAILED) {
// no ACK was received from the destination
logger.error(
`Delivery of ${EmberOutgoingMessageType[type]} failed for "${indexOrDestination}" [apsFrame=${JSON.stringify(apsFrame)} messageTag=${messageTag}]`,
)
} else if (
status === SLStatus.OK &&
type === EmberOutgoingMessageType.MULTICAST &&
apsFrame.destinationEndpoint === 0xff &&
apsFrame.groupId < EMBER_MIN_BROADCAST_ADDRESS &&
!this.multicastTable.includes(apsFrame.groupId)
) {
// workaround for devices using multicast for state update (coordinator passthrough)
const tableIdx = this.multicastTable.length
const multicastEntry: EmberMulticastTableEntry = {
multicastId: apsFrame.groupId,
endpoint: ROUTER_FIXED_ENDPOINTS[0].endpoint,
networkIndex: ROUTER_FIXED_ENDPOINTS[0].networkIndex,
switch (status) {
case SLStatus.ZIGBEE_DELIVERY_FAILED: {
// no ACK was received from the destination
logger.error(
`Delivery of ${EmberOutgoingMessageType[type]} failed for '${indexOrDestination}' [apsFrame=${JSON.stringify(apsFrame)} messageTag=${messageTag}]`,
)

break
}
// set immediately to avoid potential race
this.multicastTable.push(multicastEntry.multicastId)

try {
const status = await this.ezsp!.ezspSetMulticastTableEntry(tableIdx, multicastEntry)
case SLStatus.OK: {
if (
type === EmberOutgoingMessageType.MULTICAST &&
apsFrame.destinationEndpoint === 0xff &&
apsFrame.groupId < EMBER_MIN_BROADCAST_ADDRESS &&
!this.multicastTable.includes(apsFrame.groupId)
) {
// workaround for devices using multicast for state update (coordinator passthrough)
const tableIdx = this.multicastTable.length
const multicastEntry: EmberMulticastTableEntry = {
multicastId: apsFrame.groupId,
endpoint: ROUTER_FIXED_ENDPOINTS[0].endpoint,
networkIndex: ROUTER_FIXED_ENDPOINTS[0].networkIndex,
}
// set immediately to avoid potential race
this.multicastTable.push(multicastEntry.multicastId)

try {
const status = await this.ezsp!.ezspSetMulticastTableEntry(tableIdx, multicastEntry)

if (status !== SLStatus.OK) {
throw new Error(
`Failed to register group '${multicastEntry.multicastId}' in multicast table with status=${SLStatus[status]}.`,
)
}

if (status !== SLStatus.OK) {
throw new Error(`Failed to register group "${multicastEntry.multicastId}" in multicast table with status=${SLStatus[status]}.`)
logger.debug(`Registered multicast table entry (${tableIdx}): ${JSON.stringify(multicastEntry)}.`)
} catch (error) {
// remove to allow retry on next occurrence
this.multicastTable.splice(tableIdx, 1)
logger.error(`${error}`)
}
}

logger.debug(`Registered multicast table entry (${tableIdx}): ${JSON.stringify(multicastEntry)}.`)
} catch (error) {
// remove to allow retry on next occurrence
this.multicastTable.splice(tableIdx, 1)
throw error
break
}
}
// shouldn't be any other status
Expand Down Expand Up @@ -1107,10 +1117,6 @@ export default class Router extends Command {
return this.exit(1)
}

if (messageContents.length > EZSP_MAX_FRAME_LENGTH) {
return [SLStatus.MESSAGE_TOO_LONG, undefined, undefined]
}

this.zdoRequestSequence = ++this.zdoRequestSequence & APPLICATION_ZDO_SEQUENCE_MASK
const messageTag = this.zdoRequestSequence
messageContents[0] = messageTag
Expand Down
6 changes: 3 additions & 3 deletions src/utils/ember.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ export const emberRegisterFixedEndpoints = async (ezsp: Ezsp, multicastTable: Em

// endpoint already registered
if (epStatus === SLStatus.OK) {
logger.debug(`Endpoint "${ep.endpoint}" already registered.`, NS)
logger.debug(`Endpoint '${ep.endpoint}' already registered.`, NS)
} else {
// check to see if ezspAddEndpoint needs to be called
// if ezspInit is called without NCP reset, ezspAddEndpoint is not necessary and will return an error
Expand All @@ -194,7 +194,7 @@ export const emberRegisterFixedEndpoints = async (ezsp: Ezsp, multicastTable: Em
if (status === SLStatus.OK) {
logger.debug(`Registered endpoint '${ep.endpoint}'.`, NS)
} else {
throw new Error(`Failed to register endpoint "${ep.endpoint}" with status=${SLStatus[status]}.`)
throw new Error(`Failed to register endpoint '${ep.endpoint}' with status=${SLStatus[status]}.`)
}
}

Expand All @@ -208,7 +208,7 @@ export const emberRegisterFixedEndpoints = async (ezsp: Ezsp, multicastTable: Em
const status = await ezsp.ezspSetMulticastTableEntry(multicastTable.length, multicastEntry)

if (status !== SLStatus.OK) {
throw new Error(`Failed to register group "${multicastId}" in multicast table with status=${SLStatus[status]}.`)
throw new Error(`Failed to register group '${multicastId}' in multicast table with status=${SLStatus[status]}.`)
}

logger.debug(`Registered multicast table entry (${multicastTable.length}): ${JSON.stringify(multicastEntry)}.`, NS)
Expand Down
2 changes: 1 addition & 1 deletion src/utils/port.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ export const getPortConf = async (): Promise<PortConf> => {

case 'tcp': {
path = await input({
message: 'TCP path ("tcp://<host>:<port>")',
message: `TCP path ('tcp://<host>:<port>')`,
validate: (s) => TCP_REGEX.test(s),
})

Expand Down

0 comments on commit 878e762

Please sign in to comment.