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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert Bosch BSD-2 to modernExtend #7548

Merged
merged 23 commits into from
May 23, 2024

Conversation

burmistrzak
Copy link
Contributor

Do I have to say more? 😇

@burmistrzak burmistrzak marked this pull request as ready for review May 22, 2024 19:48
@burmistrzak
Copy link
Contributor Author

@Koenkk I guess, we'll have to soon add a src/lib/bosch.ts to keep things nice & tidy? 😅

@Koenkk Koenkk merged commit c9a1c14 into Koenkk:master May 23, 2024
2 checks passed
@Koenkk
Copy link
Owner

Koenkk commented May 23, 2024

Thanks!

@Koenkk
Copy link
Owner

Koenkk commented May 23, 2024

@Koenkk I guess, we'll have to soon add a src/lib/bosch.ts to keep things nice & tidy? 😅

makes sense!

@burmistrzak
Copy link
Contributor Author

@Koenkk What should we do about the Bosch BMCT-SLZ?
It's a rather weird combo device. Not really sure, what besides the custom cluster incl. converter can actually be reworked for modernExtend? 🤔

{
zigbeeModel: ['RBSH-MMS-ZB-EU'],
model: 'BMCT-SLZ',
vendor: 'Bosch',
description: 'Light/shutter control unit II',
fromZigbee: [
fz.on_off,
fz.power_on_behavior,
fz.cover_position_tilt,
fzLocal.bmct,
],
toZigbee: [
tz.power_on_behavior,
tz.cover_position_tilt,
tzLocal.bmct,
],
meta: {
multiEndpoint: true,
},
endpoint: (device) => {
return {'left': 2, 'right': 3};
},
configure: async (device, coordinatorEndpoint) => {
const endpoint1 = device.getEndpoint(1);
await reporting.bind(endpoint1, coordinatorEndpoint, ['genIdentify', 'closuresWindowCovering', 'manuSpecificBosch10']);
await reporting.currentPositionLiftPercentage(endpoint1);
await endpoint1.read('manuSpecificBosch10', ['deviceMode', 'switchType',
'calibrationOpeningTime', 'calibrationClosingTime', 'childLock', 'motorState']).catch((e) => {});
const endpoint2 = device.getEndpoint(2);
await endpoint2.read('manuSpecificBosch10', ['childLock']);
await reporting.bind(endpoint2, coordinatorEndpoint, ['genIdentify', 'genOnOff']).catch((e) => {});
await reporting.onOff(endpoint2);
const endpoint3 = device.getEndpoint(3);
await endpoint3.read('manuSpecificBosch10', ['childLock']).catch((e) => {});
await reporting.bind(endpoint3, coordinatorEndpoint, ['genIdentify', 'genOnOff']);
await reporting.onOff(endpoint3);
},
exposes: (device, options) => {
const commonExposes = [
e.enum('switch_type', ea.ALL, Object.keys(stateSwitchType))
.withDescription('Module controlled by a rocker switch or a button'),
e.linkquality(),
];
const lightExposes = [
e.switch().withEndpoint('left'),
e.switch().withEndpoint('right'),
e.power_on_behavior().withEndpoint('right'),
e.power_on_behavior().withEndpoint('left'),
e.binary('child_lock', ea.ALL, 'ON', 'OFF').withEndpoint('left')
.withDescription('Enable/Disable child lock'),
e.binary('child_lock', ea.ALL, 'ON', 'OFF').withEndpoint('right')
.withDescription('Enable/Disable child lock'),
];
const coverExposes = [
e.cover_position(),
e.enum('motor_state', ea.STATE, Object.keys(stateMotor))
.withDescription('Shutter motor actual state '),
e.binary('child_lock', ea.ALL, 'ON', 'OFF').withDescription('Enable/Disable child lock'),
e.numeric('calibration', ea.ALL).withUnit('s').withEndpoint('closing_time')
.withDescription('Calibration closing time').withValueMin(1).withValueMax(90),
e.numeric('calibration', ea.ALL).withUnit('s').withEndpoint('opening_time')
.withDescription('Calibration opening time').withValueMin(1).withValueMax(90),
];
if (device) {
const deviceModeKey = device.getEndpoint(1).getClusterAttributeValue('manuSpecificBosch10', 'deviceMode');
const deviceMode = Object.keys(stateDeviceMode).find((key) => stateDeviceMode[key] === deviceModeKey);
if (deviceMode === 'light') {
return [...commonExposes, ...lightExposes];
} else if (deviceMode === 'shutter') {
return [...commonExposes, ...coverExposes];
}
}
return [e.enum('device_mode', ea.ALL, Object.keys(stateDeviceMode)).withDescription('Device mode'),
e.linkquality()];
},
},

@Koenkk
Copy link
Owner

Koenkk commented May 27, 2024

@burmistrzak It's a hard one indeed, I suggest to leave it as is.

@burmistrzak
Copy link
Contributor Author

@burmistrzak It's a hard one indeed, I suggest to leave it as is.

Yea... I'll just do the custom cluster so we can finally remove them from ZCL.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants