I think you just have a formatting error and missing a “>”.
Here’s an example from one of my automations:
action:
service: notify.pushbullet
data_template:
message: >
Robert, you left one of the entry doors open. Front Door is {{ states.binary_sensor.front_entry_opened.state }}. Side Door is {{ states.binary_sensor.side_entry_opened.state }}.
With one of my sensors. THIS WORKS. Its not referencing ‘trigger’ at all though… I really need access to the trigger stuff, so I can consolidate a dozen or so automations into a single one.
message: "{{trigger.entity_id}} left {{trigger.zone}}"
If I could get a list of vars available in the jinja, that would be awesome, but i couldn’t find a way (easily) to do that last night. I’ve tried all sorts of things to get it to work (making the trigger into a list of triggers, etc…), and it all comes back to the the ‘trigger’ var not being available in the jinja context.
When you force the trigger with the UI, none of the trigger elements actually caused the trigger, so you get the trigger undefined error. If that same automation is fired from a real trigger, it works fine.
So for example, this automation
- alias: autoTest
trigger:
- platform: state
entity_id: input_boolean.attic_fan
to: 'on'
action:
- service: notify.ios_tr7p
data_template:
message: '{{trigger.entity_id}}'
When I switch the input_boolean to “on” I get the message input_boolean.attic_fan.
But, when I force the trigger using the UI, i get the error “trigger is undefined”.
That make sense. Maybe I should open a ticket on this, so that we might get this documented/fixed. Fixing might be difficult when there’s multiple triggers I suppose.
Testing this will be fun, as most of my zone triggers are a long ways off. Road trip.