@@ -411,6 +411,14 @@ function sortEndpoints(endpoints) {
411411 */
412412async function importClusters ( db , allZclPackageIds , endpointTypeId , clusters ) {
413413 let relevantZclPackageIds = allZclPackageIds
414+ // Get all custom xml packages since they will be relevant packages as well.
415+ let packageInfo = await queryPackage . getPackagesByPackageIds (
416+ db ,
417+ allZclPackageIds
418+ )
419+ let customPackageInfo = packageInfo . filter (
420+ ( pkg ) => pkg . type === dbEnum . packageType . zclXmlStandalone
421+ )
414422 let endpointTypeDeviceTypesInfo =
415423 await queryDeviceType . selectDeviceTypesByEndpointTypeId ( db , endpointTypeId )
416424 let deviceTypeRefs = endpointTypeDeviceTypesInfo . map (
@@ -421,7 +429,13 @@ async function importClusters(db, allZclPackageIds, endpointTypeId, clusters) {
421429 db ,
422430 deviceTypeRefs [ 0 ]
423431 )
424- relevantZclPackageIds = deviceTypeInfo . packageRef
432+ relevantZclPackageIds = [ deviceTypeInfo . packageRef ]
433+
434+ // If custom packages exist then account for them during import.
435+ if ( customPackageInfo && customPackageInfo . length > 0 ) {
436+ let customPackageInfoIds = customPackageInfo . map ( ( cp ) => cp . id )
437+ relevantZclPackageIds = relevantZclPackageIds . concat ( customPackageInfoIds )
438+ }
425439 }
426440 if ( clusters ) {
427441 for ( let k = 0 ; k < clusters . length ; k ++ ) {
@@ -1762,7 +1776,7 @@ async function jsonDataLoader(
17621776
17631777 if ( 'endpointTypes' in state ) {
17641778 const allZclPackageIds = [ ]
1765- allZclPackageIds . push ( mainPackageData . zclPackageIds )
1779+ allZclPackageIds . push ( ... mainPackageData . zclPackageIds )
17661780 allZclPackageIds . push ( ...existingCustomXmlPackageIds )
17671781 allZclPackageIds . push ( ...newlyLoadedCustomPackageIds )
17681782 promisesStage1 . push (
0 commit comments