Notify.Mobileapp stops working when trigger.entity_id is added

I am trying to write a single automation that will notify me via push notification on Android HA app.
It will notify me just fine with basic text in quotes but as soon as I try to add the trigger.entity_id into the message service data it breaks it.
Here is my YAML

- id: '1582292442297'
  alias: Notify me when Garage door Opens
  description: ''
  trigger:
  - entity_id: 
      - binary_sensor.little_garage_door
      - binary_sensor.big_garage_door
    from: closed
    platform: state
    to: open
  condition: []
  action:
  - data:
      message: '{{trigger.entity_id}} has been opened'
      title: Alert
    service: notify.mobile_app_pixel_3

“data” needs to be “data_template” when you are using a template.

Good call! I found the automation templating page, I looked for it before but I guess I didn’t know what to actually search for.
I tweaked the config a little bit but still not getting any form of notification on my phone.

#Notify me when something in the garage Opens
- id: 'Garage notification'
  alias: Notify me when something in the garage opens
  trigger:
  - platform: state
    entity_id:
     - binary_sensor.little_garage_door
     - binary_sensor.big_garage_door
     - binary_sensor.garage_front_window
     - binary_sensor.garage_rear_window
    to: 'ON'
  action:
    - service: notify.mobile_app_pixel_3
      data_template:
        title: 'Alert'
        message: > 
          '{{trigger.entity_id}} has been opened'

Most of it is just copy and pasted from the automation templating page and the entities changed to fit mine.

Pretty sure your trigger to needs to be lowercase. Also, your action message does not need quotes if you used a caret.

#Notify me when something in the garage Opens
- id: 'Garage notification'
  alias: Notify me when something in the garage opens
  trigger:
  - platform: state
    entity_id:
     - binary_sensor.little_garage_door
     - binary_sensor.big_garage_door
     - binary_sensor.garage_front_window
     - binary_sensor.garage_rear_window
    to: 'on'
  action:
    - service: notify.mobile_app_pixel_3
      data_template:
        title: 'Alert'
        message: > 
          {{trigger.entity_id}} has been opened

Make sure you are reloading your automations after you have saved changes.

Thanks, I don’t really know what it was. I lower cased the “on” which is weird because the MQTT message and every other config I use that for is upper case. Oh well. I also took the quotes off and its working great now. Thanks!

1 Like