-
Notifications
You must be signed in to change notification settings - Fork 303
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
Want better endpoint.writeStructured() #907
Comments
More confusing things while looking into this, I tried generated the payload in zhc to see if I could at least get the write to work without messing with herdsman yet. + const cluster = Zcl.Utils.getCluster('manuSpecificUbisysDeviceSetup');
+ const attributes = {'inputActions': {elementType: 'octetStr', elements: resultingInputActions}};
+ const payload: {attrId: number; dataType: number; attrData: number| string | boolean}[] = [];
+ for (const [nameOrID, value] of Object.entries(attributes)) {
+ if (cluster.hasAttribute(nameOrID)) {
+ const attribute = cluster.getAttribute(nameOrID);
+ payload.push({attrId: attribute.ID, attrData: value, dataType: attribute.type});
+ } else if (!isNaN(Number(nameOrID))){
+ // NOTE: tsc trisp here, but we take the prev branch
+ //payload.push({attrId: Number(nameOrID), attrData: value.value, dataType: value.type});
+ } else {
+ throw new Error(`Unknown attribute '${nameOrID}', specify either an existing attribute or a number`);
+ }
+ }
+
+ await devMgmtEp.writeStructured(
+ 'manuSpecificUbisysDeviceSetup',
+ payload,
+ manufacturerOptions.ubisysNull,
+ );
+ /*
await devMgmtEp.write(
'manuSpecificUbisysDeviceSetup',
{'inputActions': {elementType: 'octetStr', elements: resultingInputActions}},
manufacturerOptions.ubisysNull,
);
+ */ TSC is very much not happy with this:
Which leaves me very confused as the original write passes Edit 1: zigbee-herdsman/src/zcl/buffaloZcl.ts Lines 160 to 167 in 487996a
Which would make sense given this attribute is an array (ZCL data type 0x48) of raw binary data (ZCL data type 0x41). Edit 2:
Seems to work |
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 |
Unstale |
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 |
Ubisys changed to this for their switch configuration, so we would need this to fix Koenkk/zigbee2mqtt#15875
My initial attempt simple swapped the current
write()
call's towriteStructure()
call's but that does not work.https://github.com/Koenkk/zigbee-herdsman-converters/blob/b9f29f55d3f0531c9235e38a6848908c9a493042/src/devices/ubisys.ts#L509-L512
It seems our current
endpoint.write()
does some handling for the attribute data to generate a payload to pass toZcl.ZclFrame.create()
.zigbee-herdsman/src/controller/model/endpoint.ts
Lines 358 to 399 in 487996a
This is missing in
endpoint.writeStructured()
zigbee-herdsman/src/controller/model/endpoint.ts
Lines 700 to 724 in 487996a
Which seems to expect a raw payload that is passed to
Zcl.ZclFrame.create()
.We should probably update this one and also add the missing writeStructuredResponse and readStructure* variants as we probably also want to be able to read the data we write. Perhaps this can be done when we do #902.
So far there is only one usage of
endpoint.writeStructured()
here https://github.com/Koenkk/zigbee-herdsman-converters/blob/b9f29f55d3f0531c9235e38a6848908c9a493042/src/converters/toZigbee.ts#L2082The text was updated successfully, but these errors were encountered: