Trying to use MQTT Payload in Automation Action fails

Hi all,
I’d like to do the following:
I get a MQTT message on a topic I listen on. Whenever a message is received I create a push notification that contains the message payload and send it to the App.
What works so far: I get the MQTT message, check the payload (This won’t be needed later but it works), send a notification with dummy message and title to the App.
What doesn’t work? Setting the push message content to the MQTT message payload.

What I tried:

automation:
  trigger:
    platform: mqtt
    topic: "alarm/+/command/alarm"
    payload: "ON"
  action:
    service: notify.mobile_app_htc_u11_life
    data:
      message: '{{trigger.payload}}'
      title: "Alarm Raised"

The error I get:
2020-01-21 15:37:22 ERROR (MainThread) [homeassistant.components.automation] Error while executing automation automation.automation_0. Error rendering template for call_service at pos 1: UndefinedError: 'trigger' is undefined

I googled a bit and found that in theory this should be working. Does anyone have an idea why it isn’t?

Change data to data_template in your action.

1 Like

That solved my issue, thanks a lot. One more question, is it correct that for Mobile App Notifications it is currently not possible to broadcast to all registered mobiles? I know there are groups but if someone new installs the App he’d need to be added to the group manually, right?