Skip to content

Commit

Permalink
fix: Fix Lumi ZNCLBL01LM state and position reporting Koenkk/zigbee2m…
Browse files Browse the repository at this point in the history
  • Loading branch information
Koenkk committed Oct 10, 2024
1 parent 96b0cad commit 1c92165
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/lib/lumi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2948,7 +2948,8 @@ export const fromZigbee = {

let position = precisionRound(msg.data['presentValue'], 2);
position = options.invert_cover ? 100 - position : position;
return {position};
const closed = options.invert_cover ? position === 100 : position === 0;
return {position, state: closed ? 'CLOSE' : 'OPEN'};
},
} satisfies Fz.Converter,
lumi_curtain_position_tilt: {
Expand Down Expand Up @@ -4783,7 +4784,7 @@ export const toZigbee = {
await entity.command('closuresWindowCovering', 'stop', {}, getOptions(meta.mapped, entity));
}

if (!['ZNCLDJ11LM', 'ZNJLBL01LM', 'ZNCLBL01LM'].includes(meta.mapped.model)) {
if (!['ZNCLDJ11LM', 'ZNCLBL01LM'].includes(meta.mapped.model)) {
// The code below is originally added for ZNCLDJ11LM (Koenkk/zigbee2mqtt#4585).
// However, in Koenkk/zigbee-herdsman-converters#4039 it was replaced by reading
// directly from currentPositionLiftPercentage, so that device is excluded.
Expand All @@ -4796,8 +4797,6 @@ export const toZigbee = {
// Lumi curtain does not send position update on stop, request this.
await entity.read('genAnalogOutput', [0x0055]);
}

return {state: {state: 'STOP'}};
} else {
const lookup = {open: 100, close: 0, on: 100, off: 0};

Expand All @@ -4819,6 +4818,8 @@ export const toZigbee = {
const payload = {presentValue: value};
await entity.write('genAnalogOutput', payload);
}

return {state: {position: value}};
}
},
convertGet: async (entity, key, meta) => {
Expand Down

0 comments on commit 1c92165

Please sign in to comment.