Alarm Sensor Nofity when Triggered Not Wokring

Hi, I am trying to learn more complex automations, i have have looked at example on the forum, but cant seem to get it to work, here is my config, please let me know what I have done wrong…

- alias: 'Notify What Sensor Triggered Alarm'
  initial_state: 'on'
  trigger:
    platform: state
    entity_id:
      - binary_sensor.door_window_sensor_158d0001a98401  
      - binary_sensor.door_window_sensor_158d0001d5c426
      - binary_sensor.door_window_sensor_158d0001d86d4a
      - binary_sensor.motion_sensor_158d00015dbf8b
      - binary_sensor.motion_sensor_158d00015dc0c3
      - binary_sensor.door_window_sensor_158d0001ab635f
      - binary_sensor.door_window_sensor_158d0001bf273e
      - binary_sensor.door_window_sensor_158d0001a2f80d
      - binary_sensor.door_window_sensor_158d0001c034d7
      - binary_sensor.door_window_sensor_158d00019f8f40
      - binary_sensor.door_window_sensor_158d0001bf26b6
      - binary_sensor.door_window_sensor_158d0001c0351d
      - binary_sensor.door_window_sensor_158d0001a1e67f
      - binary_sensor.door_window_sensor_158d0001a2f598
      - binary_sensor.door_window_sensor_158d000155f033
      - binary_sensor.door_window_sensor_158d000149abb1
      - binary_sensor.door_window_sensor_158d0001bf276c 
      - binary_sensor.door_window_sensor_158d0001bf277a
      - binary_sensor.door_window_sensor_158d0001a98550
    from: 'off'
    to: 'on'
  condition:
    condition: state
    entity_id: alarm_control_panel.house
    state: 'disarmed'
  action:
  - service: notify.ios_iosiphone
    data:
      message: "The {{ trigger.to_state.name }} was changed to {{ trigger.to_state.state }}"

PS. I have used Disarmed for Testing…

I haven’t used templates yet so don’t have a full grasp on how they are done but it looks like you are trying to use a template with your notification but haven’t called the ‘template’ service.

Thanks the error I am getting is jinja2.exceptions.UndefinedError: ‘trigger’ is undefined

something simple you could try to test would be to comment out (#) the notify section and use something basic as the action, like turn on a light. see if that works. I personally cant see the issue with your trigger which is making me think the error is referring to the ‘trigger’ text in your notification message… but I am a Hass noob so maybe I’m totally wrong!

You need to use data_template and not data for the last service call…

Thanks for the help that worked a treat :slight_smile:

Thanks mate you were on the right lines :slight_smile: