Skip to content

Commit

Permalink
fix: Fix configure of some IKEA remotes failing Koenkk/zigbee2mqtt#25613
Browse files Browse the repository at this point in the history
  • Loading branch information
Koenkk committed Jan 6, 2025
1 parent 4560ac5 commit 2e97241
Showing 1 changed file with 17 additions and 10 deletions.
27 changes: 17 additions & 10 deletions src/lib/ikea.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ import {
precisionRound,
replaceToZigbeeConvertersInArray,
} from '../lib/utils';
import {logger} from './logger';

const NS = 'zhc:ikea';

export const manufacturerOptions = {manufacturerCode: Zcl.ManufacturerCode.IKEA_OF_SWEDEN};

Expand Down Expand Up @@ -198,16 +201,20 @@ export function ikeaConfigureStyrbar(): ModernExtend {
export function ikeaConfigureRemote(): ModernExtend {
const configure: Configure[] = [
async (device, coordinatorEndpoint, definition) => {
// Firmware 2.3.075 >= only supports binding to endpoint, before only to group
// - https://github.com/Koenkk/zigbee2mqtt/issues/2772#issuecomment-577389281
// - https://github.com/Koenkk/zigbee2mqtt/issues/7716
const endpoint = device.getEndpoint(1);
const version = device.softwareBuildID.split('.').map((n) => Number(n));
const bindTarget =
version[0] > 2 || (version[0] == 2 && version[1] > 3) || (version[0] == 2 && version[1] == 3 && version[2] >= 75)
? coordinatorEndpoint
: constants.defaultBindGroup;
await endpoint.bind('genOnOff', bindTarget);
if (device.softwareBuildID) {
// Firmware 2.3.075 >= only supports binding to endpoint, before only to group
// - https://github.com/Koenkk/zigbee2mqtt/issues/2772#issuecomment-577389281
// - https://github.com/Koenkk/zigbee2mqtt/issues/7716
const endpoint = device.getEndpoint(1);
const version = device.softwareBuildID.split('.').map((n) => Number(n));
const bindTarget =
version[0] > 2 || (version[0] == 2 && version[1] > 3) || (version[0] == 2 && version[1] == 3 && version[2] >= 75)
? coordinatorEndpoint
: constants.defaultBindGroup;
await endpoint.bind('genOnOff', bindTarget);
} else {
logger.warning(`Could not correctly configure '${device.softwareBuildID}' since softwareBuildID is missing, try re-pairing it`, NS);
}
},
];

Expand Down

0 comments on commit 2e97241

Please sign in to comment.