Create mqtt json string for MultiChannel #4202
-
Hi everyone with the help of the community I managed to create a json string to use MultiChannelCommandEncapsulation.
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Docs for the topic are here: https://zwave-js.github.io/zwave-js-ui/#/guide/mqtt?id=driverfunction It's a little tricky because the payload is in JSON, so the quotes need to be escaped, and either the newlines need to be escaped, or the code joined into a single line. Here's the single line version: {"args": ["const { logger, zwaveClient, require } = this; const { BinarySwitchCCSet, MultiChannelCCCommandEncapsulation } = require(\"zwave-js\"); const nodeId = 3; let cc = new BinarySwitchCCSet({ nodeId, targetValue: true }); cc = new MultiChannelCCCommandEncapsulation({ nodeId, destination: [1,2,3,4,5,6], encapsulated: cc, }); await driver.sendCommand(cc);"]} |
Beta Was this translation helpful? Give feedback.
Docs for the topic are here: https://zwave-js.github.io/zwave-js-ui/#/guide/mqtt?id=driverfunction
It's a little tricky because the payload is in JSON, so the quotes need to be escaped, and either the newlines need to be escaped, or the code joined into a single line. Here's the single line version: