From 4690fe1a55b4d6a2a8ad39c21c157b67a41d5f62 Mon Sep 17 00:00:00 2001 From: Der Mundschenk & Compagnie Date: Sat, 30 Nov 2024 21:09:09 +0100 Subject: [PATCH] fix(ignore): Ignore `None` actions for HA events (#24972) --- 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 c6e0f8c75b..63c085aefe 100644 --- a/lib/extension/homeassistant.ts +++ b/lib/extension/homeassistant.ts @@ -2283,7 +2283,7 @@ export default class HomeAssistant extends Extension { ` {% set ns.r = ns.r|rejectattr(0, 'eq', 'action')|list + [('action', ns.r|selectattr(0, 'eq', 'actionPrefix')|map(attribute=1)|first + ns.r|selectattr(0, 'eq', 'action')|map(attribute=1)|first)] %}\n` + `{% endif %}\n` + `{% set ns.r = ns.r + [('event_type', ns.r|selectattr(0, 'eq', 'action')|map(attribute=1)|first)] %}\n` + - `{{dict.from_keys(ns.r|rejectattr(0, 'in', 'action, actionPrefix')|reject('eq', ('event_type', '')))|to_json}}`; + `{{dict.from_keys(ns.r|rejectattr(0, 'in', 'action, actionPrefix')|reject('eq', ('event_type', None))|reject('eq', ('event_type', '')))|to_json}}`; return value_template; } diff --git a/test/homeassistant.test.js b/test/homeassistant.test.js index 6c73857352..8475290db8 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