Skip to content

Commit ed26385

Browse files
committed
feat: Extend support for custom zigbee frames with zcl_command endpoint.
The existing implementation is almost a generic "send zigbee frame" function, but falls short. Notably, it: - Does not allow specifying a Zcl.FrameType value - Does not allow suppressing normal ACK reporting - Does not allow disabling log output in z2m When working on implementing support for complicated Zigbee devices (Philips Hue, for instance), these limitations hit hard. This reasonably simple change makes the `zcl_command` significantly more powerful.
1 parent 54de561 commit ed26385

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

src/converters/toZigbee.ts

+12-2
Original file line numberDiff line numberDiff line change
@@ -243,8 +243,18 @@ const converters2 = {
243243
utils.assertObject(value, key);
244244
const payload = value.payload !== undefined ? value.payload : {};
245245
utils.assertEndpoint(entity);
246-
await entity.zclCommand(value.cluster, value.command, payload, value.options !== undefined ? value.options : {});
247-
logger.info(`Invoked ZCL command ${value.cluster}.${value.command} with payload '${JSON.stringify(payload)}'`, NS);
246+
await entity.zclCommand(
247+
value.cluster,
248+
value.command,
249+
payload,
250+
value.options !== undefined ? value.options : {},
251+
value.log_payload ?? {},
252+
value.check_status ?? false,
253+
value.frametype ?? Zcl.FrameType.SPECIFIC,
254+
);
255+
if (value.logging ?? false) {
256+
logger.info(`Invoked ZCL command ${value.cluster}.${value.command} with payload '${JSON.stringify(payload)}'`, NS);
257+
}
248258
},
249259
} satisfies Tz.Converter,
250260
arm_mode: {

0 commit comments

Comments
 (0)