-
Notifications
You must be signed in to change notification settings - Fork 325
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
Description of additional discover commands. #978
Conversation
Allow general commands to be sent through the endpoint.
src/controller/model/endpoint.ts
Outdated
@@ -897,6 +897,33 @@ class Endpoint extends Entity { | |||
} | |||
} | |||
} | |||
|
|||
public async generalCommand( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we call this zclCommand
and refactor the other zcl calls to use this method? E.g. readResponse
and writeStructured
can be easily refactored to this, probably also the others.
# Conflicts: # test/controller.test.ts
src/controller/model/endpoint.ts
Outdated
Zcl.FrameType.GLOBAL, options.direction, options.disableDefaultResponse, | ||
options.manufacturerCode, transactionSequenceNumber, 'defaultRsp', clusterID, payload, options.reservedBits | ||
); | ||
|
||
const log = `DefaultResponse ${this.deviceIeeeAddress}/${this.ID} ` + | ||
`${clusterID}(${commandID}, ${JSON.stringify(options)})`; | ||
debug.info(log); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This log statement should go into zclCommand()
which should fix https://github.com/Koenkk/zigbee-herdsman/pull/978/files#r1530963264
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So these statement can be removed and the type should be added in https://github.com/Koenkk/zigbee-herdsman/pull/978/files#diff-be0e9f494ec1a1e1e2c5d8c33866b7ad6b8e2f080c85133eced5c95a249e41bfR858
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done, but we lost some readability of the debug logs.
was:
Write 0x129/1 genOnOff({"onOff":1}, ...
became:
ZCL command 0x129/1 genOnOff.write([{"attrId":0,"attrData":1,"dataType":16}], ...
because at the zclCommand level the data has already been converted
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
True, could we add the error log text as an optional argument to zclCommand
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, can. I try it later
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
was:
Write 0x129/1 genOnOff({"onOff":1}, ...
became:
ZCL command 0x129/1 genOnOff.write({"onOff":1}, ...
src/controller/model/endpoint.ts
Outdated
try { | ||
return await this.sendRequest(frame, options); | ||
} catch (error) { | ||
if (logError) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's always log the error here, then we can remove the try/catch
+ error logging from every function calling zclCommand()
Nice refactor, thanks! |
Allow general commands to be sent through the endpoint.
Later add general device converters and send these commands to the device from the developer console or via MQTT.
This is for developers of new converters so that they can find out the attributes of the clusters.
Unfortunately, devices do not report all of their attributes and commands. Some don't report anything.
For example: