-
Thank you for this wonderful tool. It's a pleasure to work with. Using the instructions from Wiki I was able to run sniffer without any troubles. I'm now wondering if there is a way to send ZigBee commands using ember-cli. For example I've captured a simple On/Off command, which I've sent from Home Assistant app to a switch:
I guess I want to send That's probably possible using custom script in router mode but I have no clue what to put into that script. Could you please provide an example? Thank you. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 1 reply
-
Thanks! Sending high level payloads is not quite easy, ember-zli was not designed for this. Although the whole ember-zli/src/commands/router/index.ts Lines 545 to 574 in a89959a As you can see, the payload to the Note: Running custom script was meant as a debugging tool for specific cases, you may need to customize ember-zli itself to get it to do what you want in the way you want it. Also, sending improper payloads can disrupt a network, so, be careful if you try this on anything but a test network. |
Beta Was this translation helpful? Give feedback.
-
Thank you very much! With you help I've managed to write a working script 😉 This example script sends toggle command to network address 3646: /**
* @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
*/
async function custom(cmd, logger) {
logger.info('Sending our ZigBee command')
const [status] = await cmd.ezsp.send(
0, // EmberOutgoingMessageType.DIRECT,
3646, // Destination
{
profileId: 0x0104, // Profile: Home Automation (0x0104)
clusterId: 0x0006, // Cluster: On/Off (0x0006)
sourceEndpoint: 1, // Source Endpoint: 1
destinationEndpoint: 1, // Destination Endpoint: 1
options: 0,
groupId: 0,
sequence: 0,
},
// ZigBee Cluster Library Frame:
// Frame Control Field: Cluster-specific (0x01)
// Sequence Number: 0
// Command: Toggle (0x02)
Buffer.from('010002', 'hex'),
0,
0,
)
}
export default custom; |
Beta Was this translation helpful? Give feedback.
-
During my testing I've stumbled upon a minor issue. When using command "Run external script" the script is loaded only once. If I change the file and use the command again the previously loaded version of the script is executed. I needed to stop ember-zli and run it again each time I made a change to the script. I wonder if this can be improved or maybe there is a workaround for this? |
Beta Was this translation helpful? Give feedback.
Thanks!
Sending high level payloads is not quite easy, ember-zli was not designed for this. Although the whole
EZSP
protocol is exposed through theezsp
reference, it requires sending "raw" payloads. You can see an example here:ember-zli/src/commands/router/index.ts
Lines 545 to 574 in a89959a