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

Generic zclCommand handler allowing it to be sent from mqtt #7251

Merged
merged 11 commits into from Mar 25, 2024

Conversation

kirovilya
Copy link
Contributor

For example:

zigbee2mqtt/0xa4c138b8c414612e/1/set
 {"zclcommand":{"command": "discover", "cluster": 6, "payload": {"startAttrId": 1, "maxAttrIds": 255}, "options":{}}}

src/converters/toZigbee.ts Outdated Show resolved Hide resolved
kirovilya and others added 3 commits March 23, 2024 06:07
Co-authored-by: Koen Kanters <koenkanters94@gmail.com>
@Koenkk
Copy link
Owner

Koenkk commented Mar 24, 2024

@kirovilya could you take a look at the failing tests? After that this can be merged.

@Koenkk Koenkk merged commit 6559f89 into Koenkk:master Mar 25, 2024
2 checks passed
@Koenkk
Copy link
Owner

Koenkk commented Mar 25, 2024

Thanks!

@klebom
Copy link

klebom commented Apr 5, 2024

Nice addition, but the command result isn't propagated back to the caller
The same goes for the normal /set {"command":...} and /set {"read":...}.
I've patched /set { "command":...} handling with this additional logging for my personal use.


const result = await entity.command(value.cluster, value.command, (value.hasOwnProperty('payload') ? value.payload : {}), options);

meta.logger.info(`Invoked command '${value.cluster}.${value.command}' on '${meta.options.friendly_name}' with payload '${JSON.stringify(value.payload)}'`);

meta.logger.info(`Command result of '${value.cluster}.${value.command}': ${JSON.stringify(result)}`);

Note I've included ${meta.options.friendly_name} when logging the command

However I don't think using the log for these results is optimal. A separate topic could be used for results like zigbee2mqtt/bridge/commandresults, or a topic for the result could be included with the command.

@kirovilya
Copy link
Contributor Author

Yes, here you need to expect an response command from the device and it is different for different commands.
we still need to improve it or make our own converters

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

Successfully merging this pull request may close these issues.

None yet

3 participants