From d82d782bac0deda328e7025f9a2bcbd50fecf857 Mon Sep 17 00:00:00 2001 From: Der Mundschenk & Compagnie Date: Fri, 29 Nov 2024 20:26:33 +0100 Subject: [PATCH] fix(ignore): Prevent incorrect `event_type` due to duplicate keys (#24954) --- lib/extension/homeassistant.ts | 2 +- test/homeassistant.test.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/extension/homeassistant.ts b/lib/extension/homeassistant.ts index 8937d871ca..f5bfe1e234 100644 --- a/lib/extension/homeassistant.ts +++ b/lib/extension/homeassistant.ts @@ -2276,7 +2276,7 @@ export default class HomeAssistant extends Extension { ` {% set m = action_value|regex_findall(p.pattern) %}\n` + ` {% if m[0] is undefined %}{% continue %}{% endif %}\n` + ` {% for key, value in zip(p.groups, m[0]) %}\n` + - ` {% set ns.r = ns.r + [(key, value)] %}\n` + + ` {% set ns.r = ns.r|rejectattr(0, 'eq', key)|list + [(key, value)] %}\n` + ` {% endfor %}\n` + `{% endfor %}\n` + `{% if ns.r|selectattr(0, 'eq', 'actionPrefix')|first is defined %}\n` + diff --git a/test/homeassistant.test.js b/test/homeassistant.test.js index ce72125d89..bee5fb819e 100644 --- a/test/homeassistant.test.js +++ b/test/homeassistant.test.js @@ -428,7 +428,7 @@ describe('HomeAssistant extension', () => { unique_id: '0x0017880104e45520_action_zigbee2mqtt', // Needs to be updated whenever one of the ACTION_*_PATTERN constants changes. value_template: - '{% set patterns = [\n{"pattern": \'^(?P