Advanced automation documentation using templating.
2016-04-24 08:30 +0100
true
false
true
true
In Home Assistant 0.19 we introduced a new powerful feature: variables in scripts and automations. This makes it possible to adjust your condition and action based on the information of the trigger.
The trigger data made is available during template rendering as the trigger variable.
# Example configuration.yaml entriesautomation:trigger:platform:stateentity_id:device_tracker.paulusaction:service:notify.notifydata_template:message:>{% raw %}Paulus just changed from {{ trigger.from_state.state }}to {{ trigger.to_state.state }}{% endraw %}automation 2:trigger:platform:mqtttopic:/notify/+action:service_template:>{% raw %}notify.{{ trigger.topic.split('/')[-1] }}{% endraw %}data_template:message:{% raw %}{{ trigger.payload }}{% endraw %}
{% linkable_title Available Trigger Data %}
The following tables show the available trigger data per platform.