Thanks for all the feedback. I decided to try Rob’s solution, as it seems to be exactly what I was looking for, but I get this error:
Blueprint Send actionable notifications for Android generated invalid automation with inputs OrderedDict([('notify_device', '9297be7c81e31e24c55f8dc5de467174'), ('trigger_entity', 'input_boolean.alarm_triggered'), ('notification_title', 'Home Alarm Triggered'), ('action_1_uri', '/lovelace/cameras'), ('first_action', [OrderedDict([('service', 'input_boolean.turn_off'), ('target', OrderedDict([('entity_id', 'input_boolean.alarm_triggered')]))])]), ('action_1_title', 'View Cameras'), ('notification_message', '{% set sensors = [\'binary_sensor.sonoff_pir_hall\', \'binary_sensor.sonoff_pir_lounge\', \'binary_sensor.sonoff_pir_study\', \'binary_sensor.sonoff_pir_kitchen\'] %} Motion Detected in {{ states|selectattr("entity_id", "in", sensors)|selectattr("state", "==", "on")|map(attribute="name")|list|join(", ") }} # notification_message: \'{% if is_state(\'\'binary_sensor.sonoff_pir_hall\'\', \'\'on\'\') # %} "Motion Detected in Hall" {% elif is_state(\'\'binary_sensor.sonoff_pir_lounge\'\', # \'\'on\'\') %} "Motion Detected in Lounge" {% elif is_state(\'\'binary_sensor.sonoff_pir_study\'\', # \'\'on\'\') %} "Motion Detected in Study" {% elif is_state(\'\'binary_sensor.sonoff_pir_kitchen\'\', # \'\'on\'\') %} "Motion Detected in Kitchen" {% else %} "Motion Detected" {% endif # %}\'')]): invalid template (TemplateSyntaxError: expected token ',', got 'binary_sensor') for dictionary value @ data['variables']['notification_message']. Got None
This is the full automation definition:
- id: '1628632963539'
alias: Alarm triggered - Send actionable notifications for Android
description: ''
use_blueprint:
path: vorion/actionable-notifications-for-android.yaml
input:
notify_device: 9297be7c81e31e24c55f8dc5de467174
trigger_entity: input_boolean.alarm_triggered
notification_title: Home Alarm Triggered
action_1_uri: /lovelace/cameras
first_action:
- service: input_boolean.turn_off
target:
entity_id: input_boolean.alarm_triggered
action_1_title: View Cameras
notification_message: >-
{% set sensors = ['binary_sensor.sonoff_pir_hall', 'binary_sensor.sonoff_pir_lounge', 'binary_sensor.sonoff_pir_study', 'binary_sensor.sonoff_pir_kitchen'] %} Motion Detected in {{ states|selectattr("entity_id", "in", sensors)|selectattr("state", "==", "on")|map(attribute="name")|list|join(", ") }}
Any ideas?