From 703bd6abb47f7888ebc8fde5a7ca754f5c0d8b93 Mon Sep 17 00:00:00 2001 From: Jukka Pirinen <9322054+jukkapirinen@users.noreply.github.com> Date: Fri, 15 Nov 2024 20:15:31 +0200 Subject: [PATCH 1/3] Allow underscore in device_name --- blueprints/event_summary.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/blueprints/event_summary.yaml b/blueprints/event_summary.yaml index 0521c82..6279cd2 100644 --- a/blueprints/event_summary.yaml +++ b/blueprints/event_summary.yaml @@ -170,7 +170,7 @@ variables: {% set ns = namespace(device_names=[]) %} {% for device_id in notify_devices %} {% set device_name = device_attr(device_id, "name") %} - {% set sanitized_name = "mobile_app_" + device_name | lower | regex_replace("[^a-z0-9 ]", "") | replace(" ", "_") %} + {% set sanitized_name = "mobile_app_" + device_name | lower | regex_replace("[^a-z0-9_ ]", "") | replace(" ", "_") %} {% set ns.device_names = ns.device_names + [sanitized_name] %} {% endfor %} {{ ns.device_names }} @@ -388,4 +388,4 @@ action: clickAction: !input tap_navigate #Android tag: "{{tag}}" group: "{{group}}" - interruption-level: passive \ No newline at end of file + interruption-level: passive From fad0750dcae1777fde08ffe92db5c89e5baa88fe Mon Sep 17 00:00:00 2001 From: Jukka Pirinen <9322054+jukkapirinen@users.noreply.github.com> Date: Fri, 15 Nov 2024 20:26:53 +0200 Subject: [PATCH 2/3] Allow hyphen in device_name and convert to underscore --- blueprints/event_summary.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/blueprints/event_summary.yaml b/blueprints/event_summary.yaml index 6279cd2..8a28143 100644 --- a/blueprints/event_summary.yaml +++ b/blueprints/event_summary.yaml @@ -170,7 +170,7 @@ variables: {% set ns = namespace(device_names=[]) %} {% for device_id in notify_devices %} {% set device_name = device_attr(device_id, "name") %} - {% set sanitized_name = "mobile_app_" + device_name | lower | regex_replace("[^a-z0-9_ ]", "") | replace(" ", "_") %} + {% set sanitized_name = "mobile_app_" + device_name | lower | regex_replace("[^a-z0-9_- ]", "") | replace(" ", "_") | replace("-", "_") %} {% set ns.device_names = ns.device_names + [sanitized_name] %} {% endfor %} {{ ns.device_names }} From 9d7d4eb33bebb97d7c65255d3a649190666101dc Mon Sep 17 00:00:00 2001 From: Jukka Pirinen <9322054+jukkapirinen@users.noreply.github.com> Date: Fri, 15 Nov 2024 20:34:20 +0200 Subject: [PATCH 3/3] Escape hyphen in device_name regexp --- blueprints/event_summary.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/blueprints/event_summary.yaml b/blueprints/event_summary.yaml index 8a28143..d204a21 100644 --- a/blueprints/event_summary.yaml +++ b/blueprints/event_summary.yaml @@ -170,7 +170,7 @@ variables: {% set ns = namespace(device_names=[]) %} {% for device_id in notify_devices %} {% set device_name = device_attr(device_id, "name") %} - {% set sanitized_name = "mobile_app_" + device_name | lower | regex_replace("[^a-z0-9_- ]", "") | replace(" ", "_") | replace("-", "_") %} + {% set sanitized_name = "mobile_app_" + device_name | lower | regex_replace("[^a-z0-9_\- ]", "") | replace(" ", "_") | replace("-", "_") %} {% set ns.device_names = ns.device_names + [sanitized_name] %} {% endfor %} {{ ns.device_names }}