Skip to content

Commit

Permalink
fix: Fix hasAlreadyProcessedMessage when device has multiple endpoints (
Browse files Browse the repository at this point in the history
#8301)

Take into account source endpoint when skipping duplicate transactions.
  • Loading branch information
martyn-vesternet authored Nov 11, 2024
1 parent 3a1640f commit ba97340
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/lib/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ const transactionStore: {[s: string]: number[]} = {};
export function hasAlreadyProcessedMessage(msg: Fz.Message, model: Definition, ID: number = null, key: string = null) {
if (model.meta && model.meta.publishDuplicateTransaction) return false;
const currentID = ID !== null ? ID : msg.meta.zclTransactionSequenceNumber;
key = key || msg.device.ieeeAddr;
key = key || msg.device.ieeeAddr + '-' + msg.endpoint.ID;
if (transactionStore[key]?.includes(currentID)) return true;
// Keep last 5, as they might come in different order: https://github.com/Koenkk/zigbee2mqtt/issues/20024
transactionStore[key] = [currentID, ...(transactionStore[key] ?? [])].slice(0, 5);
Expand Down

0 comments on commit ba97340

Please sign in to comment.