diff --git a/src-electron/generator/helper-endpointconfig.js b/src-electron/generator/helper-endpointconfig.js index 0dfe5bebc1..24a009ce5e 100644 --- a/src-electron/generator/helper-endpointconfig.js +++ b/src-electron/generator/helper-endpointconfig.js @@ -828,6 +828,7 @@ async function collectAttributes(db, sessionId, endpointTypes, options) { longDefaults.push(a) let def + let defArray = [] if ( types.isString(a.type) && attributeDefaultValue === null && @@ -836,26 +837,34 @@ async function collectAttributes(db, sessionId, endpointTypes, options) { // We don't want to make longTypeDefaultValue know about our null // string representation. if (types.isOneBytePrefixedString(a.type)) { - def = ['0xFF'] + defArray = ['0xFF'] } else if (types.isTwoBytePrefixedString(a.type)) { - def = ['0xFF', '0xFF'] + defArray = ['0xFF', '0xFF'] } else { throw new Error(`Unknown string type: ${type}`) } + longDef = { + value: defArray, + size: defaultSize, + index: longDefaultsIndex, + name: a.name, + comment: cluster.comment, + type: a.type, + } } else { def = types.longTypeDefaultValue( defaultSize, a.type, attributeDefaultValue ) - } - let longDef = { - value: def, - size: defaultSize, - index: longDefaultsIndex, - name: a.name, - comment: cluster.comment, - type: a.type, + longDef = { + value: def, + size: defaultSize, + index: longDefaultsIndex, + name: a.name, + comment: cluster.comment, + type: a.type, + } } attributeDefaultValue = `ZAP_LONG_DEFAULTS_INDEX(${longDefaultsIndex})` defaultValueIsMacro = true