Skip to content

Commit 9d33ebf

Browse files
committed
fix: merge cleanup
1 parent a4fcd45 commit 9d33ebf

1 file changed

Lines changed: 11 additions & 14 deletions

File tree

src/controller/model/device.ts

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,7 @@ export class Device extends Entity<ControllerEventMap> {
365365
return;
366366
}
367367

368-
const {header, command, cluster, payload} = frame;
368+
const {header, command, cluster} = frame;
369369
let sendDefaultResponse = !header.frameControl.disableDefaultResponse && !dataPayload.wasBroadcast && command.response === undefined;
370370
let defaultResponseStatus = defaultResponse ?? Zcl.Status.SUCCESS;
371371

@@ -379,25 +379,22 @@ export class Device extends Entity<ControllerEventMap> {
379379
break;
380380
}
381381

382-
const attributes: {[s: string]: KeyValue} = {
383-
...endpoint.clusters,
384-
};
385-
386-
if (dataPayload.clusterID === GEN_TIME_CLUSTER_ID) {
387-
attributes.genTime = {
388-
attributes: timeService.getTimeClusterAttributes(),
389-
};
390-
}
382+
const endpointCache: Clusters[string] =
383+
dataPayload.clusterID === GEN_TIME_CLUSTER_ID
384+
? {
385+
attributes: timeService.getTimeClusterAttributes(),
386+
}
387+
: endpoint.clusters[frame.cluster.name];
391388

392-
if (cluster.name in attributes) {
389+
if (endpointCache) {
393390
const response: KeyValue = {};
394391

395-
for (const entry of payload) {
392+
for (const entry of frame.payload) {
396393
// TODO: this.manufacturerID or frame.header.manufacturerCode
397394
const name = Zcl.Utils.getClusterAttribute(cluster, entry.attrId, this.manufacturerID)?.name;
398395

399-
if (name && name in attributes[cluster.name].attributes) {
400-
response[name] = attributes[cluster.name].attributes[name];
396+
if (name && name in endpointCache.attributes) {
397+
response[name] = endpointCache.attributes[name];
401398
}
402399
}
403400

0 commit comments

Comments
 (0)