Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor improvements for Bosch BWA-1, BSD-2, BSEN-C2 & BSEN-CV #7386

Merged
merged 23 commits into from
Apr 11, 2024
Merged
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
c735445
fix: Minor corrections
burmistrzak Apr 6, 2024
9e4ee3c
fix: Restore basic functionality for BWA-1
burmistrzak Apr 6, 2024
1945dbb
fix: Format converters
burmistrzak Apr 6, 2024
1ba0ea2
fix: Lint, be happy
burmistrzak Apr 6, 2024
c5b6024
fix: Lint, remove currently unused code
burmistrzak Apr 6, 2024
4997242
fix: Minor changes to exposes & bindings
burmistrzak Apr 6, 2024
f6043c8
fix: Reintroduce `alarm_on_motion`
burmistrzak Apr 6, 2024
7d84d2a
fix: Use tzLocal & fzLocal
burmistrzak Apr 6, 2024
eea8868
fix: Minor typo
burmistrzak Apr 6, 2024
2b0f349
Merge branch 'Koenkk:master' into fix-bosch-converters
burmistrzak Apr 7, 2024
c4e36d8
fix: Improve `configure` for BSD-2 & BWA-1
burmistrzak Apr 7, 2024
803fbb2
fix: Update required bindings & `configure`
burmistrzak Apr 7, 2024
9f39395
fix: Lint, it's fine
burmistrzak Apr 7, 2024
c2fcec4
Merge branch 'Koenkk:master' into fix-bosch-converters
burmistrzak Apr 7, 2024
3e04342
hotfix: Always bind `ssIasZone` to BWA-1
burmistrzak Apr 7, 2024
18b8217
Merge branch 'Koenkk:master' into fix-bosch-converters
burmistrzak Apr 8, 2024
ba3b3e5
hotfix: Remove `manufacturerOptions` from BSD-2
burmistrzak Apr 8, 2024
990bb4f
fix: Tweak `configure` step for BWA-1
burmistrzak Apr 9, 2024
def4748
Merge branch 'Koenkk:master' into fix-bosch-converters
burmistrzak Apr 9, 2024
1ebd24b
hotfix: Use correct `write` payload format
burmistrzak Apr 9, 2024
665cf5a
fix: Use cluster/attribute names instead of IDs
burmistrzak Apr 10, 2024
37d723e
Merge branch 'Koenkk:master' into update-bosch-cluster-cmds
burmistrzak Apr 11, 2024
a2d2756
fix: Simplify bindings & add missing converters
burmistrzak Apr 11, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
58 changes: 18 additions & 40 deletions src/devices/bosch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -552,18 +552,18 @@ const tzLocal = {
convertSet: async (entity, key, value, meta) => {
if (key === 'sensitivity') {
const index = utils.getFromLookup(value, smokeSensitivity);
await entity.write('manuSpecificBosch', {0x4003: {value: index, type: 0x21}}, manufacturerOptions);
await entity.write('manuSpecificBosch', {sensitivity: index}, manufacturerOptions);
return {state: {sensitivity: value}};
}
if (key === 'pre_alarm') {
const index = utils.getFromLookup(value, stateOffOn);
await entity.write('manuSpecificBosch5', {0x4001: {value: index, type: 0x18}}, manufacturerOptions);
await entity.write('manuSpecificBosch5', {pre_alarm: index}, manufacturerOptions);
return {state: {pre_alarm: value}};
}
if (key === 'heartbeat') {
const endpoint = meta.device.getEndpoint(12);
const index = utils.getFromLookup(value, stateOffOn);
await endpoint.write('manuSpecificBosch7', {0x5005: {value: index, type: 0x18}}, manufacturerOptions);
await endpoint.write('manuSpecificBosch7', {heartbeat: index}, manufacturerOptions);
return {state: {heartbeat: value}};
}
if (key === 'self_test') {
Expand Down Expand Up @@ -593,17 +593,17 @@ const tzLocal = {
convertGet: async (entity, key, meta) => {
switch (key) {
case 'sensitivity':
await entity.read('manuSpecificBosch', [0x4003], manufacturerOptions);
await entity.read('manuSpecificBosch', ['sensitivity'], manufacturerOptions);
break;
case 'pre_alarm':
await entity.read('manuSpecificBosch5', [0x4001], manufacturerOptions);
await entity.read('manuSpecificBosch5', ['pre_alarm'], manufacturerOptions);
break;
case 'heartbeat':
await meta.device.getEndpoint(12).read('manuSpecificBosch7', [0x5005], manufacturerOptions);
await meta.device.getEndpoint(12).read('manuSpecificBosch7', ['heartbeat'], manufacturerOptions);
break;
case 'alarm':
case 'self_test':
await meta.device.getEndpoint(12).read('manuSpecificBosch8', [0x5000], manufacturerOptions);
await meta.device.getEndpoint(12).read('manuSpecificBosch8', ['alarm_status'], manufacturerOptions);
break;
default: // Unknown key
throw new Error(`Unhandled key toZigbee.bosch_twinguard.convertGet ${key}`);
Expand Down Expand Up @@ -700,9 +700,8 @@ const fzLocal = {
type: ['attributeReport', 'readResponse'],
convert: (model, msg, publish, options, meta) => {
const result: KeyValue = {};
const data = msg.data;
if (data.hasOwnProperty('alarmOnMotion')) {
result.alarm_on_motion = (Object.keys(stateOffOn)[data['alarmOnMotion']]);
if (msg.data.hasOwnProperty('alarmOnMotion')) {
result.alarm_on_motion = (Object.keys(stateOffOn)[msg.data['alarmOnMotion']]);
}
return result;
},
Expand Down Expand Up @@ -806,8 +805,8 @@ const fzLocal = {
type: ['attributeReport', 'readResponse'],
convert: (model, msg, publish, options, meta) => {
const result: KeyValue = {};
if (msg.data.hasOwnProperty(0x4003)) {
result.sensitivity = (Object.keys(smokeSensitivity)[msg.data[0x4003]]);
if (msg.data.hasOwnProperty('sensitivity')) {
result.sensitivity = (Object.keys(smokeSensitivity)[msg.data['sensitivity']]);
}
return result;
},
Expand Down Expand Up @@ -888,7 +887,6 @@ const fzLocal = {
0x00200081: 'fire',
0x00200040: 'silenced',
};

if (msg.data.hasOwnProperty('alarm_status')) {
result.self_test = (msg.data['alarm_status'] & 1<<24) > 0;
result.smoke = (msg.data['alarm_status'] & 1<<7) > 0;
Expand Down Expand Up @@ -1032,17 +1030,8 @@ const definitions: Definition[] = [
await reporting.bind(endpoint, coordinatorEndpoint, [
'genPowerCfg',
'genPollCtrl',
'ssIasZone',
'manuSpecificBosch11',
]);
await reporting.batteryPercentageRemaining(endpoint);
await endpoint.configureReporting('ssIasZone', [{
attribute: 'zoneStatus',
minimumReportInterval: 0,
maximumReportInterval: constants.repInterval.MAX,
reportableChange: 0,
}]);
await endpoint.read('ssIasZone', ['zoneStatus']);
await endpoint.read('manuSpecificBosch11', ['alarmOnMotion'], manufacturerOptions);
},
exposes: [
Expand Down Expand Up @@ -1071,15 +1060,8 @@ const definitions: Definition[] = [
await reporting.bind(endpoint, coordinatorEndpoint, [
'genPowerCfg',
'genPollCtrl',
'ssIasZone',
]);
await reporting.batteryPercentageRemaining(endpoint);
await endpoint.configureReporting('ssIasZone', [{
attribute: 'zoneStatus',
minimumReportInterval: 0,
maximumReportInterval: constants.repInterval.MAX,
reportableChange: 0,
}]);
await endpoint.read('ssIasZone', ['zoneStatus']);
},
exposes: [
Expand Down Expand Up @@ -1404,15 +1386,9 @@ const definitions: Definition[] = [
await reporting.bind(device.getEndpoint(12), coordinatorEndpointB, ['manuSpecificBosch8']);
await device.getEndpoint(1).read('manuSpecificBosch5', ['unknown_attribute'], manufacturerOptions); // Needed for pairing
await device.getEndpoint(12).command('manuSpecificBosch7', 'pairingCompleted', manufacturerOptions); // Needed for pairing
await device.getEndpoint(1).write('manuSpecificBosch', {
sensitivity: {value: 0x0002, type: Zcl.DataType.uint16},
}, manufacturerOptions); // Setting defaults
await device.getEndpoint(1).write('manuSpecificBosch5', {
pre_alarm: {value: 0x01, type: Zcl.DataType.bitmap8},
}, manufacturerOptions); // Setting defaults
await device.getEndpoint(12).write('manuSpecificBosch7', {
heartbeat: {value: 0x01, type: Zcl.DataType.bitmap8},
}, manufacturerOptions); // Setting defaults
await device.getEndpoint(1).write('manuSpecificBosch', {sensitivity: 0x0002}, manufacturerOptions); // Setting defaults
await device.getEndpoint(1).write('manuSpecificBosch5', {pre_alarm: 0x01}, manufacturerOptions); // Setting defaults
await device.getEndpoint(12).write('manuSpecificBosch7', {heartbeat: 0x01}, manufacturerOptions); // Setting defaults
await device.getEndpoint(1).read('manuSpecificBosch', ['sensitivity'], manufacturerOptions);
await device.getEndpoint(1).read('manuSpecificBosch5', ['pre_alarm'], manufacturerOptions);
await device.getEndpoint(12).read('manuSpecificBosch7', ['heartbeat'], manufacturerOptions);
Expand All @@ -1430,8 +1406,8 @@ const definitions: Definition[] = [
e.text('siren_state', ea.STATE).withDescription('Siren state'),
e.binary('self_test', ea.ALL, true, false).withDescription('Initiate self-test'),
e.enum('sensitivity', ea.ALL, Object.keys(smokeSensitivity)).withDescription('Sensitivity of the smoke alarm'),
e.enum('pre_alarm', ea.ALL, Object.keys(stateOffOn)).withDescription('Enable/disable pre-alarm'),
e.enum('heartbeat', ea.ALL, Object.keys(stateOffOn)).withDescription('Enable/disable heartbeat'),
e.binary('pre_alarm', ea.ALL, 'ON', 'OFF').withDescription('Enable/disable pre-alarm'),
e.binary('heartbeat', ea.ALL, 'ON', 'OFF').withDescription('Enable/disable heartbeat'),
],
},
{
Expand Down Expand Up @@ -1481,6 +1457,7 @@ const definitions: Definition[] = [
vendor: 'Bosch',
description: 'Door/window contact II',
fromZigbee: [
fz.battery,
fzLocal.bosch_contact,
],
toZigbee: [],
Expand All @@ -1505,6 +1482,7 @@ const definitions: Definition[] = [
vendor: 'Bosch',
description: 'Door/window contact II plus',
fromZigbee: [
fz.battery,
fzLocal.bosch_contact,
],
toZigbee: [],
Expand Down