I’m setting up automation for a home burglar alarm system, and want to send a different notification message depending on which motion sensor was triggered. I was wondering if anyone could tell me what’s wrong with the syntax below:
- alias: 'Alarm triggered'
trigger:
- platform: state
entity_id: alarm_control_panel.home_alarm
to: 'triggered'
action:
- service: notify.mobile_app_moto_g_5g_plus
data:
title: "House Alarm"
message: >
{% if is_state('binary_sensor.sonoff_pir_hall', 'on') %} "Motion Detected in Hall"
{% if is_state('binary_sensor.sonoff_pir_lounge', 'on') %} "Motion Detected in Lounge"
{% if is_state('binary_sensor.sonoff_pir_study', 'on') %} "Motion Detected in Lounge"
{% if is_state('binary_sensor.sonoff_pir_kitchen', 'on') %} "Motion Detected in Kitchen"
{% endif %}
- service: media_player.play_media
entity_id:
- media_player.study_speaker_3
- media_player.lounge_speaker
- media_player.kitchen_speaker_3
data:
media_content_id: 'http://www.mydomain.com/alarm-siren-60s.mp3'
media_content_type: 'audio/mp3'
The problem seems to be with the “service: notify.mobile_app_moto_g_5g_plus” section, as the automation loads fine if I comment out those lines.