Skip to content

Commit

Permalink
fix: Remove all Bosch clusters (#1077)
Browse files Browse the repository at this point in the history
* Remove all Bosch extensions

* Remove Bosch from `ClusterName`

* Fix tests

* Add missing `}` to test

* Use other cluster in `utils.test.ts`

* fix tests

---------

Co-authored-by: Koen Kanters <koenkanters94@gmail.com>
  • Loading branch information
burmistrzak and Koenkk authored Jun 2, 2024
1 parent ad67f77 commit 64ac386
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 155 deletions.
141 changes: 0 additions & 141 deletions src/zspec/zcl/definition/cluster.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2113,11 +2113,6 @@ export const Clusters: Readonly<Record<ClusterName, Readonly<ClusterDefinition>>
parameters: [
],
},
boschCalibrateValve: {
ID: 0x41,
parameters: [
],
},
},
commandsResponse: {
getWeeklyScheduleRsp: {
Expand Down Expand Up @@ -2662,16 +2657,6 @@ export const Clusters: Readonly<Record<ClusterName, Readonly<ClusterDefinition>>
parameters: [
],
},
boschTestTamper: {
ID: 0xF3,
parameters: [
{name: 'data', type: DataType.UINT8},
],
},
boschSmokeDetectorSiren: {
ID: 0x80,
parameters: [{name: "data", type: DataType.UINT16}],
},
},
commandsResponse: {
statusChangeNotification: {
Expand Down Expand Up @@ -2870,12 +2855,6 @@ export const Clusters: Readonly<Record<ClusterName, Readonly<ClusterDefinition>>
{name: 'squawkinfo', type: DataType.UINT8},
],
},
boschOutdoorSiren: {
ID: 240,
parameters: [
{name: 'data', type: DataType.UINT8},
],
},
},
commandsResponse: {
},
Expand Down Expand Up @@ -5283,126 +5262,6 @@ export const Clusters: Readonly<Record<ClusterName, Readonly<ClusterDefinition>>
commandsResponse: {
},
},
manuSpecificBosch: {
ID: 0xe000,
manufacturerCode: ManufacturerCode.ROBERT_BOSCH_GMBH,
attributes: {
sensitivity: {ID: 0x4003, type: DataType.UINT16},
},
commands: {
initiateTestMode: {
ID: 0x00,
parameters: [],
},
},
commandsResponse: {},
},
manuSpecificBosch3: {
ID: 0xe002,
manufacturerCode: ManufacturerCode.ROBERT_BOSCH_GMBH,
attributes: {
humidity : {ID: 0x4000, type: DataType.UINT16},
unknown1 : {ID: 0x4001, type: DataType.UINT16},
unknown2 : {ID: 0x4002, type: DataType.UINT16},
airpurity : {ID: 0x4003, type: DataType.UINT16},
temperature : {ID: 0x4004, type: DataType.INT16},
illuminance_lux: {ID: 0x4005, type: DataType.UINT16},
battery : {ID: 0x4006, type: DataType.UINT16},
unknown3 : {ID: 0x4007, type: DataType.UINT16},
unknown4 : {ID: 0x4008, type: DataType.UINT16},
pressure : {ID: 0x4009, type: DataType.UINT16}, // Not yet confirmed
unknown6 : {ID: 0x400a, type: DataType.UINT16},
unknown7 : {ID: 0x400b, type: DataType.UINT16},
unknown8 : {ID: 0x400c, type: DataType.UINT16},
},
commands: {},
commandsResponse: {},
},
manuSpecificBosch5: {
ID: 0xe004,
manufacturerCode: ManufacturerCode.ROBERT_BOSCH_GMBH,
attributes: {
unknown_attribute: {ID: 0x4000, type: DataType.BITMAP8}, // 0,1 ??? read during pairing
pre_alarm: {ID: 0x4001, type: DataType.BITMAP8}, // 0,1 on/off
},
commands: {},
commandsResponse: {},
},
manuSpecificBosch7: {
ID: 0xe006,
manufacturerCode: ManufacturerCode.ROBERT_BOSCH_GMBH,
attributes: {
unknown1: {ID: 0x5003, type: DataType.INT8}, // perhaps signal strength? -7?
unknown2: {ID: 0x5004, type: DataType.UINT8}, // ????
heartbeat: {ID: 0x5005, type: DataType.BITMAP8}, // 0,1 on/off
},
commands: {
pairingCompleted: {
ID: 0x01,
parameters: [],
},
},
commandsResponse: {},
},
manuSpecificBosch8: {
ID: 0xe007,
manufacturerCode: ManufacturerCode.ROBERT_BOSCH_GMBH,
attributes: {
alarm_status: {ID: 0x5000, type: DataType.BITMAP32},
},
commands: { /////////// VALIDATED ////////////
burglarAlarm: {
ID: 0x01,
parameters: [
{name: 'data', type: DataType.UINT8}, // data:1 trips the siren data:0 should stop the siren
],
},
},
commandsResponse: {},
},
manuSpecificBosch9: {
ID: 0xfca1,
manufacturerCode: ManufacturerCode.ROBERT_BOSCH_GMBH,
attributes: {},
commands: {
confirmButtonPressed: {
ID: 0x0010,
parameters: [
{name: 'data', type: BuffaloZclDataType.BUFFER},
],
},
pairingCompleted: {
ID: 0x0012,
parameters: [
{name: 'data', type: BuffaloZclDataType.BUFFER},
],
},
},
commandsResponse: {},
},
manuSpecificBosch10: {
ID: 0xfca0,
manufacturerCode: ManufacturerCode.ROBERT_BOSCH_GMBH,
attributes: {
deviceMode: {ID: 0x0000, type: DataType.ENUM8},
switchType: {ID: 0x0001, type: DataType.ENUM8},
calibrationOpeningTime: {ID: 0x0002, type: DataType.UINT32},
calibrationClosingTime: {ID: 0x0003, type: DataType.UINT32},
childLock: {ID: 0x0008, type: DataType.BOOLEAN},
motorState: {ID: 0x0013, type: DataType.ENUM8},
},
commands: {},
commandsResponse: {},
},
manuSpecificBosch11: {
ID: 0xfcac,
manufacturerCode: ManufacturerCode.ROBERT_BOSCH_GMBH,
attributes: {
alarmOnMotion: {ID: 0x0003, type: DataType.BOOLEAN},
},
commands: {},
commandsResponse: {},
},
manuSpecificAssaDoorLock: {
ID: 0xFC00,
attributes: {
Expand Down
5 changes: 2 additions & 3 deletions src/zspec/zcl/definition/tstype.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,6 @@ export type ClusterName = (
'tradfriButton' | 'heimanSpecificInfraRedRemote' | 'develcoSpecificAirQuality' | 'schneiderSpecificPilotMode' |
'elkoOccupancySettingClusterServer' | 'elkoSwitchConfigurationClusterServer' | 'manuSpecificSchneiderLightSwitchConfiguration' |
'manuSpecificSchneiderFanSwitchConfiguration' | 'sprutDevice' | 'sprutVoc' | 'sprutNoise' | 'sprutIrBlaster' | 'manuSpecificSiglisZigfred' |
'manuSpecificInovelli' | 'owonClearMetering' | 'zosungIRTransmit' | 'zosungIRControl' | 'manuSpecificBosch' | 'manuSpecificBosch3' |
'manuSpecificBosch5' | 'manuSpecificBosch7' | 'manuSpecificBosch8' | 'manuSpecificBosch9' | 'manuSpecificBosch10' | 'manuSpecificBosch11' |
'manuSpecificInovelli' | 'owonClearMetering' | 'zosungIRTransmit' | 'zosungIRControl' |
'manuSpecificAssaDoorLock' | 'manuSpecificDoorman' | 'manuSpecificNodOnPilotWire' | 'manuSpecificProfalux1' | 'manuSpecificAmazonWWAH'
);
);
15 changes: 8 additions & 7 deletions test/controller.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1320,13 +1320,13 @@ describe('Controller', () => {
expect(write[0]).toBe('0x170');
expect(write[1]).toBe(170);
expect(write[2]).toBe(1);
expect(deepClone(write[3])).toStrictEqual({"header":{"frameControl":{"reservedBits":0,"frameType":0,"direction":0,"disableDefaultResponse":true,"manufacturerSpecific":false},"transactionSequenceNumber":12,"manufacturerCode":null,"commandIdentifier":2},"payload":[{"attrId":16,"attrData":"0x0000012300000000","dataType":240}],"cluster":{"ID":1280,"attributes":{"zoneState":{"ID":0,"type":48,"name":"zoneState"},"zoneType":{"ID":1,"type":49,"name":"zoneType"},"zoneStatus":{"ID":2,"type":25,"name":"zoneStatus"},"iasCieAddr":{"ID":16,"type":240,"name":"iasCieAddr"},"zoneId":{"ID":17,"type":32,"name":"zoneId"},"numZoneSensitivityLevelsSupported":{"ID":18,"type":32,"name":"numZoneSensitivityLevelsSupported"},"currentZoneSensitivityLevel":{"ID":19,"type":32,"name":"currentZoneSensitivityLevel"},"develcoAlarmOffDelay":{"ID":32769,"type":33,"manufacturerCode":4117,"name":"develcoAlarmOffDelay"}},"name":"ssIasZone","commands":{"enrollRsp":{"ID":0,"parameters":[{"name":"enrollrspcode","type":32},{"name":"zoneid","type":32}],"name":"enrollRsp"},"initNormalOpMode":{"ID":1,"parameters":[],"name":"initNormalOpMode"},"initTestMode":{"ID":2,"parameters":[],"name":"initTestMode"},"boschTestTamper":{"ID":243,"parameters":[{"name":"data","type":32}],"name":"boschTestTamper"},"boschSmokeDetectorSiren":{"ID":128,"parameters":[{"name":"data","type":33}],"name":"boschSmokeDetectorSiren"}},"commandsResponse":{"statusChangeNotification":{"ID":0,"parameters":[{"name":"zonestatus","type":33},{"name":"extendedstatus","type":32}],"name":"statusChangeNotification"},"enrollReq":{"ID":1,"parameters":[{"name":"zonetype","type":33},{"name":"manucode","type":33}],"name":"enrollReq"}}},"command":{"ID":2,"name":"write","parameters":[{"name":"attrId","type":33},{"name":"dataType","type":32},{"name":"attrData","type":1000}],"response":4}});
expect(deepClone(write[3])).toStrictEqual({"header":{"frameControl":{"reservedBits":0,"frameType":0,"direction":0,"disableDefaultResponse":true,"manufacturerSpecific":false},"transactionSequenceNumber":12,"manufacturerCode":null,"commandIdentifier":2},"payload":[{"attrId":16,"attrData":"0x0000012300000000","dataType":240}],"cluster":{"ID":1280,"attributes":{"zoneState":{"ID":0,"type":48,"name":"zoneState"},"zoneType":{"ID":1,"type":49,"name":"zoneType"},"zoneStatus":{"ID":2,"type":25,"name":"zoneStatus"},"iasCieAddr":{"ID":16,"type":240,"name":"iasCieAddr"},"zoneId":{"ID":17,"type":32,"name":"zoneId"},"numZoneSensitivityLevelsSupported":{"ID":18,"type":32,"name":"numZoneSensitivityLevelsSupported"},"currentZoneSensitivityLevel":{"ID":19,"type":32,"name":"currentZoneSensitivityLevel"},"develcoAlarmOffDelay":{"ID":32769,"type":33,"manufacturerCode":4117,"name":"develcoAlarmOffDelay"}},"name":"ssIasZone","commands":{"enrollRsp":{"ID":0,"parameters":[{"name":"enrollrspcode","type":32},{"name":"zoneid","type":32}],"name":"enrollRsp"},"initNormalOpMode":{"ID":1,"parameters":[],"name":"initNormalOpMode"},"initTestMode":{"ID":2,"parameters":[],"name":"initTestMode"}},"commandsResponse":{"statusChangeNotification":{"ID":0,"parameters":[{"name":"zonestatus","type":33},{"name":"extendedstatus","type":32}],"name":"statusChangeNotification"},"enrollReq":{"ID":1,"parameters":[{"name":"zonetype","type":33},{"name":"manucode","type":33}],"name":"enrollReq"}}},"command":{"ID":2,"name":"write","parameters":[{"name":"attrId","type":33},{"name":"dataType","type":32},{"name":"attrData","type":1000}],"response":4}});

const enrollRsp = mocksendZclFrameToEndpoint.mock.calls[11];
expect(enrollRsp[0]).toBe('0x170');
expect(enrollRsp[1]).toBe(170);
expect(enrollRsp[2]).toBe(1);
expect(deepClone(enrollRsp[3])).toStrictEqual({"header":{"frameControl":{"reservedBits":0,"frameType":1,"direction":0,"disableDefaultResponse":true,"manufacturerSpecific":false},"transactionSequenceNumber":13,"manufacturerCode":null,"commandIdentifier":0},"payload":{"enrollrspcode":0,"zoneid":23},"cluster":{"ID":1280,"attributes":{"zoneState":{"ID":0,"type":48,"name":"zoneState"},"zoneType":{"ID":1,"type":49,"name":"zoneType"},"zoneStatus":{"ID":2,"type":25,"name":"zoneStatus"},"iasCieAddr":{"ID":16,"type":240,"name":"iasCieAddr"},"zoneId":{"ID":17,"type":32,"name":"zoneId"},"numZoneSensitivityLevelsSupported":{"ID":18,"type":32,"name":"numZoneSensitivityLevelsSupported"},"currentZoneSensitivityLevel":{"ID":19,"type":32,"name":"currentZoneSensitivityLevel"},"develcoAlarmOffDelay":{"ID":32769,"type":33,"manufacturerCode":4117,"name":"develcoAlarmOffDelay"}},"name":"ssIasZone","commands":{"enrollRsp":{"ID":0,"parameters":[{"name":"enrollrspcode","type":32},{"name":"zoneid","type":32}],"name":"enrollRsp"},"initNormalOpMode":{"ID":1,"parameters":[],"name":"initNormalOpMode"},"initTestMode":{"ID":2,"parameters":[],"name":"initTestMode"},"boschTestTamper":{"ID":243,"parameters":[{"name":"data","type":32}],"name":"boschTestTamper"},"boschSmokeDetectorSiren":{"ID":128,"parameters":[{"name":"data","type":33}],"name":"boschSmokeDetectorSiren"}},"commandsResponse":{"statusChangeNotification":{"ID":0,"parameters":[{"name":"zonestatus","type":33},{"name":"extendedstatus","type":32}],"name":"statusChangeNotification"},"enrollReq":{"ID":1,"parameters":[{"name":"zonetype","type":33},{"name":"manucode","type":33}],"name":"enrollReq"}}},"command":{"ID":0,"parameters":[{"name":"enrollrspcode","type":32},{"name":"zoneid","type":32}],"name":"enrollRsp"}});
expect(deepClone(enrollRsp[3])).toStrictEqual({"header":{"frameControl":{"reservedBits":0,"frameType":1,"direction":0,"disableDefaultResponse":true,"manufacturerSpecific":false},"transactionSequenceNumber":13,"manufacturerCode":null,"commandIdentifier":0},"payload":{"enrollrspcode":0,"zoneid":23},"cluster":{"ID":1280,"attributes":{"zoneState":{"ID":0,"type":48,"name":"zoneState"},"zoneType":{"ID":1,"type":49,"name":"zoneType"},"zoneStatus":{"ID":2,"type":25,"name":"zoneStatus"},"iasCieAddr":{"ID":16,"type":240,"name":"iasCieAddr"},"zoneId":{"ID":17,"type":32,"name":"zoneId"},"numZoneSensitivityLevelsSupported":{"ID":18,"type":32,"name":"numZoneSensitivityLevelsSupported"},"currentZoneSensitivityLevel":{"ID":19,"type":32,"name":"currentZoneSensitivityLevel"},"develcoAlarmOffDelay":{"ID":32769,"type":33,"manufacturerCode":4117,"name":"develcoAlarmOffDelay"}},"name":"ssIasZone","commands":{"enrollRsp":{"ID":0,"parameters":[{"name":"enrollrspcode","type":32},{"name":"zoneid","type":32}],"name":"enrollRsp"},"initNormalOpMode":{"ID":1,"parameters":[],"name":"initNormalOpMode"},"initTestMode":{"ID":2,"parameters":[],"name":"initTestMode"}},"commandsResponse":{"statusChangeNotification":{"ID":0,"parameters":[{"name":"zonestatus","type":33},{"name":"extendedstatus","type":32}],"name":"statusChangeNotification"},"enrollReq":{"ID":1,"parameters":[{"name":"zonetype","type":33},{"name":"manucode","type":33}],"name":"enrollReq"}}},"command":{"ID":0,"parameters":[{"name":"enrollrspcode","type":32},{"name":"zoneid","type":32}],"name":"enrollRsp"}});
});

it('Device joins and interview iAs enrollment fails', async () => {
Expand Down Expand Up @@ -2502,17 +2502,17 @@ describe('Controller', () => {
await controller.start();
await mockAdapterEvents['deviceJoined']({networkAddress: 129, ieeeAddr: '0x129'});
const device = controller.getDeviceByIeeeAddr('0x129');
device.getEndpoint(1).zclCommandBroadcast(255, BroadcastAddress.SLEEPY, Zcl.Clusters.ssIasZone.ID, 'boschSmokeDetectorSiren', {data: 0x0000});
device.getEndpoint(1).zclCommandBroadcast(255, BroadcastAddress.SLEEPY, Zcl.Clusters.ssIasZone.ID, 'initTestMode', {});
const sentFrame = mockZclFrame.create(
Zcl.FrameType.SPECIFIC,
Zcl.Direction.CLIENT_TO_SERVER,
true,
null,
// @ts-expect-error private
ZclTransactionSequenceNumber.number,
'boschSmokeDetectorSiren',
'initTestMode',
Zcl.Clusters.ssIasZone.ID,
{data: 0x0000},
{},
device.customClusters
);
expect(mocksendZclFrameToAll.mock.calls[0][0]).toBe(255);
Expand All @@ -2526,16 +2526,17 @@ describe('Controller', () => {
await controller.start();
await mockAdapterEvents['deviceJoined']({networkAddress: 129, ieeeAddr: '0x129'});
const device = controller.getDeviceByIeeeAddr('0x129');
device.addCustomCluster('ssIasZone', {ID: Zcl.Clusters.ssIasZone.ID, commands: {boschSmokeAlarmSiren: {ID: 0x80, parameters: [{name: 'data', type: Zcl.DataType.UINT16}]}}, commandsResponse: {}, attributes: {}});
const options = {manufacturerCode: Zcl.ManufacturerCode.ROBERT_BOSCH_GMBH};
device.getEndpoint(1).zclCommandBroadcast(255, BroadcastAddress.SLEEPY, Zcl.Clusters.ssIasZone.ID, 'boschSmokeDetectorSiren', {data: 0x0000}, options);
device.getEndpoint(1).zclCommandBroadcast(255, BroadcastAddress.SLEEPY, Zcl.Clusters.ssIasZone.ID, 'boschSmokeAlarmSiren', {data: 0x0000}, options);
const sentFrame = mockZclFrame.create(
Zcl.FrameType.SPECIFIC,
Zcl.Direction.CLIENT_TO_SERVER,
true,
Zcl.ManufacturerCode.ROBERT_BOSCH_GMBH,
// @ts-expect-error private
ZclTransactionSequenceNumber.number,
'boschSmokeDetectorSiren',
'boschSmokeAlarmSiren',
Zcl.Clusters.ssIasZone.ID,
{data: 0x0000},
device.customClusters
Expand Down
8 changes: 4 additions & 4 deletions test/zspec/zcl/utils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const CUSTOM_CLUSTERS: CustomClusters = {
genBasic: {ID: Zcl.Clusters.genBasic.ID, commands: {}, commandsResponse: {}, attributes: {myCustomAttr: {ID: 65533, type: Zcl.DataType.UINT8}}},
myCustomCluster: {ID: 65534, commands: {}, commandsResponse: {}, attributes: {myCustomAttr: {ID: 65533, type: Zcl.DataType.UINT8}}},
myCustomClusterManuf: {ID: 65533, manufacturerCode: 65534, commands: {}, commandsResponse: {}, attributes: {myCustomAttr: {ID: 65533, type: Zcl.DataType.UINT8}}},
manuSpecificBosch10NoManuf: {ID: Zcl.Clusters.manuSpecificBosch10.ID, commands: {}, commandsResponse: {}, attributes: {myCustomAttr: {ID: 65533, type: Zcl.DataType.UINT8}}}
manuSpecificProfalux1NoManuf: {ID: Zcl.Clusters.manuSpecificProfalux1.ID, commands: {}, commandsResponse: {}, attributes: {myCustomAttr: {ID: 65533, type: Zcl.DataType.UINT8}}}
};

describe('ZCL Utils', () => {
Expand Down Expand Up @@ -85,12 +85,12 @@ describe('ZCL Utils', () => {
{cluster: CUSTOM_CLUSTERS.genBasic, name: 'genBasic'},
],
[
'by ID ignoring same custom ID if Zcl is better match with manufacture code',
'by ID ignoring same custom ID if Zcl is better match with manufacturer code',
{
key: CUSTOM_CLUSTERS.manuSpecificBosch10NoManuf.ID, manufacturerCode: Zcl.ManufacturerCode.ROBERT_BOSCH_GMBH,
key: CUSTOM_CLUSTERS.manuSpecificProfalux1NoManuf.ID, manufacturerCode: Zcl.ManufacturerCode.PROFALUX,
customClusters: CUSTOM_CLUSTERS
},
{cluster: Zcl.Clusters.manuSpecificBosch10, name: 'manuSpecificBosch10'},
{cluster: Zcl.Clusters.manuSpecificProfalux1, name: 'manuSpecificProfalux1'},
],
])('Gets cluster %s', (_name, payload, expected) => {
const cluster = Zcl.Utils.getCluster(payload.key, payload.manufacturerCode, payload.customClusters);
Expand Down

0 comments on commit 64ac386

Please sign in to comment.