From 62bc9ab668ffd23b01efee3b7bb614b3c0242c0b Mon Sep 17 00:00:00 2001 From: Kevin Date: Mon, 19 Nov 2018 16:20:27 -0600 Subject: [PATCH] Added example (#7469) Added an additional tested and working example of how to use a trigger variable in an automation. --- source/_docs/automation/templating.markdown | 25 +++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/source/_docs/automation/templating.markdown b/source/_docs/automation/templating.markdown index 9bba3c630c9..508e09d8642 100644 --- a/source/_docs/automation/templating.markdown +++ b/source/_docs/automation/templating.markdown @@ -37,6 +37,31 @@ automation 2: notify.{{ trigger.topic.split('/')[-1] }} data_template: message: '{{ trigger.payload }}' + +automation 3: + trigger: + # Multiple Entities for which you want to perform the same action. + - platform: state + entity_id: + - light.bedroom_closet + to: 'on' + # Trigger when someone leaves the closet light on for 10 minutes. + for: '00:10:00' + - platform: state + entity_id: + - light.kiddos_closet + to: 'on' + for: '00:10:00' + - platform: state + entity_id: + - light.linen_closet + to: 'on' + for: '00:10:00' + action: + - service: light.turn_off + data_template: + # Whichever entity triggers the automation we want to turn off THAT entity, not the others. + entity_id: "{{ trigger.entity_id }}" ``` {% endraw %}