#zwave_js: custom CommandClass driverFunction has stopped working.

1 messages · Page 1 of 1 (latest)

night shuttle
#

Hi. A while back, with some help from this discord, I built a custom driverFunction class (with an associated script) to built a custom CommandClass to set the button labels on a device I have. It worked great for a long time, but at some point (not clear when) it stopped working. Looking at that zjs logs, I see this:

2024-12-29 15:28:29.029 INFO Z-WAVE: Calling api driverFunction with args: [ 'const { logger, zwaveClient, require } = this; const { CommandClass } = require("@zwave-js/cc"); const cc = new CommandClass(driver, {nodeId: 139, ccId: 0x92, ccCommand: 2, payload: Buffer.concat([Buffer.from([ 0x39, 0, 0x00, 9 ]), Buffer.from("Lights On") ]) }); await driver.sendCommand(cc);', [length]: 1 ] 2024-12-29 15:28:29.030 INFO Z-WAVE: No command class defined for CommandClass! (ZW0300) driverFunction undefined 2024-12-29 15:28:29.030 INFO MQTT: Message received on zwave/_CLIENTS/ZWAVE_GATEWAY-Mosquitto/api/driverFunction: '{"success":false,"message":"No command class defined for CommandClass! (ZW0300)","args":["const { logger, zwaveClient, require } = this; const { CommandClass } = require(\\"@zwave-js/cc\\"); const cc = new CommandClass(driver, {nodeId: 139, ccId: 0x92, ccCommand: 2, payload: Buffer.concat([Buffer.from([ 0x39, 0, 0x00, 9 ]), Buffer.from(\\"utside On\\") ]) }); await driver.sendCommand(cc);"],"origin":{"args":["const { logger, zwaveClient, require } = this; const { CommandClass } = require(\\"@zwave-js/cc\\"); const cc = new CommandClass(driver, {nodeId: 139, ccId: 0x92, ccCommand: 2, payload: Buffer.concat([Buffer.from([ 0x39, 0, 0x00, 9 ]), Buffer.from(\\"Lights On\\") ]) }); await driver.sendCommand(cc);"]}}'

Unfortunately, it's been quite a while since I worked this all out and I didn't document it well (of course), but is it clear to anyone what's changed/what went wrong?

In case it helps, very similar code used to fail a different way and the devs kindly fixed the bug: https://github.com/zwave-js/node-zwave-js/issues/5586

placid mist
#

The Z-Wave JS discord would be a more appropriate place to ask.

night shuttle
placid mist
night shuttle
#

Ty. Been trying to find my original conversation with AlCalzone (suspect it's relevant). I did save a copy of it, but can't figure out what server we were even on.

placid mist
#

Maybe your imports need adjusting.

#

Although that one uses an existing CC.

night shuttle
#

Ty! Been searching through there...

#

Hm.. That looks like the same call, but a different problem (different error).

#

I've tried adjusting my imports to be the same, but no change.

placid mist
#

I think the driver code has changed so you'll probably need to submit an issue to node-zwave-js

#

Do you know which version it was working last?

night shuttle
night shuttle
night shuttle
#

Solved by Alcazone; thanks all! Short answer: remove the driver parameter from the "new CommandClass" call.