Skip to content

Commit 7bcd9ee

Browse files
author
Jing T
authored
fix attribute / cluster generation issue in template (#887)
pass in correct deviceTypeRef and filter by matching cluster id
1 parent 9e7cabb commit 7bcd9ee

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src-electron/generator/helper-zcl.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -336,11 +336,11 @@ async function zcl_device_type_clusters(options) {
336336
* @returns blocks for commands
337337
*/
338338
async function zcl_device_type_cluster_commands(options) {
339-
let deviceTypeClusterId = this.id
340339
let commands = await queryDeviceType.selectDeviceTypeCommandsByDeviceTypeRef(
341340
this.global.db,
342-
deviceTypeClusterId
341+
this.deviceTypeRef
343342
)
343+
commands = commands.filter((x) => x.deviceTypeClusterRef == this.id)
344344
let promise = templateUtil.collectBlocks(commands, options, this)
345345
return templateUtil.templatePromise(this.global, promise)
346346
}
@@ -352,12 +352,12 @@ async function zcl_device_type_cluster_commands(options) {
352352
* @returns blocks for attributes
353353
*/
354354
async function zcl_device_type_cluster_attributes(options) {
355-
let deviceTypeClusterId = this.id
356355
let attributes =
357356
await queryDeviceType.selectDeviceTypeAttributesByDeviceTypeRef(
358357
this.global.db,
359-
deviceTypeClusterId
358+
this.deviceTypeRef
360359
)
360+
attributes = attributes.filter((x) => x.deviceTypeClusterRef == this.id)
361361
let promise = templateUtil.collectBlocks(attributes, options, this)
362362
return templateUtil.templatePromise(this.global, promise)
363363
}

0 commit comments

Comments
 (0)