diff --git a/src/controller/helpers/zclFrameConverter.ts b/src/controller/helpers/zclFrameConverter.ts index 54c1af97b5..6f6fa2a4f2 100644 --- a/src/controller/helpers/zclFrameConverter.ts +++ b/src/controller/helpers/zclFrameConverter.ts @@ -1,17 +1,17 @@ import {ZclFrame, Utils as ZclUtils} from '../../zcl'; import {Cluster} from '../../zcl/tstype'; +import ManufacturerCode from '../../zcl/definition/manufacturerCode'; interface KeyValue {[s: string]: number | string} -// Certain devices (e.g. Legrand/4129) fail to set the manufacturerSpecific flag and +// Legrand devices (e.g. 4129) fail to set the manufacturerSpecific flag and // manufacturerCode in the frame header, despite using specific attributes. // This leads to incorrect reported attribute names. // Remap the attributes using the target device's manufacturer ID // if the header is lacking the information. function getCluster(frame: ZclFrame, deviceManufacturerID: number): Cluster { let cluster = frame.Cluster; - - if (!frame?.Header?.manufacturerCode && frame?.Cluster && Number.isInteger(deviceManufacturerID)) { + if (!frame?.Header?.manufacturerCode && frame?.Cluster && deviceManufacturerID == ManufacturerCode.LegrandNetatmo) { cluster = ZclUtils.getCluster(frame.Cluster.ID, deviceManufacturerID); } return cluster; @@ -50,4 +50,4 @@ function attributeList(frame: ZclFrame, deviceManufacturerID: number): Array { expect(events.message[0].data).not.toMatchObject({calibrationMode:4}); }); - // ZCLFrame without manufacturer specific flag set or manufacturer code set, to specific device - it('Should resolve manufacturer specific cluster attribute names on generic ZCL frames: specific target device', async () => { + // ZCLFrame without manufacturer specific flag set or manufacturer code set, to specific device (Legrand only) + it('Should resolve manufacturer specific cluster attribute names on generic ZCL frames: Legrand target device', async () => { await controller.start(); await mockAdapterEvents['deviceJoined']({networkAddress: 177, ieeeAddr: '0x177'}); await mockAdapterEvents['zclData']({