Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changes to payload when sending zclData to a device breaks iobroker.zigbee function #998

Closed
asgothian opened this issue Mar 31, 2024 · 1 comment
Labels

Comments

@asgothian
Copy link
Contributor

With the latest version of the iobroker zigbee adapter I found that code which used to work now raises an error:

as it is a rarely used function, I do not know for how long this has been the case. It can be up to 9 months.

the code is:

        this.debug(`Zigbee publish to '${deviceID}', ${cid} - cmd ${cmd} - payload ${JSON.stringify(zclData)} - cfg ${JSON.stringify(cfg)} - endpoint ${ep}`);

        if (cfg == null) {
            cfg = {};
        }

        if (type === 'foundation') {
            cfg.disableDefaultResponse = true;
            if (cmd === 'read' && !Array.isArray(zclData)) {
                // needs to be iterable (string[] | number [])
                zclData[Symbol.iterator] = function* () {
                    let k;
                    for (k in this) {
                        yield k;
                    }
                };
            }
            let result;
            if (cmd === 'configReport') {
                result = await endpoint.configureReporting(cid, zclData, cfg);
            } else {
                result = await endpoint[cmd](cid, zclData, cfg);
            }
            callback && callback(undefined, result);

The object endpoint is queried from the herdsman with endpoint ID and DeviceID.
The log shows the following result. The error is caught via a try/catch construct which encapsulates this function.

2024-03-31 19:45:58.737 - debug: zigbee.0 (4066) Ready to send (ep: 1, cid: genBasic, cmd read, zcl: {"manufacturerName":{}})
--
2024-03-31 19:45:58.739 - debug: zigbee.0 (4066) Zigbee publish to '0x00158d0006371a7b', genBasic - cmd read - payload {"manufacturerName":{}} - cfg null - endpoint 1
2024-03-31 19:45:58.740 - error: zigbee.0 (4066) SendToZigbee failed! (TypeError: attributes.map is not a function)

the code on the zigbee adapter side (iobroker) for this section has not been changed significantly since 2020. The last change is from October 2023, but only contains code reformatting.

I am aware that this is no bug in the herdsman, but I need help to construct a valid payload as this function is used for checking device capabilities on new devices.

A.

@asgothian asgothian changed the title Changes to Changes to payload when sending zclData to a device breaks iobroker.zigbee function Apr 1, 2024
Copy link
Contributor

This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 30 days

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant