From a3a19f3089ff1b5f0827f5098e5b6e5064196f46 Mon Sep 17 00:00:00 2001 From: Fabian Affolter Date: Tue, 28 Nov 2017 20:41:36 +0100 Subject: [PATCH] Move escaping --- source/_components/ifttt.markdown | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/source/_components/ifttt.markdown b/source/_components/ifttt.markdown index f61b64c1bc1..764138d2725 100644 --- a/source/_components/ifttt.markdown +++ b/source/_components/ifttt.markdown @@ -64,6 +64,7 @@ Choose "Webhooks" as service. You need to setup a unique trigger for each event you sent to IFTTT.

+{% raw %} ```yaml # Example configuration.yaml Automation entry automation: @@ -75,9 +76,11 @@ automation: service: ifttt.trigger data: {"event":"TestHA_Trigger", "value1":"Hello World!"} ``` +{% endraw %} IFTTT can also be used in scripts and with `data_template`. Here is the above automation broken into an automation and script using variables and data_templates. +{% raw %} ```yaml # Example configuration.yaml Automation entry automation: @@ -89,17 +92,20 @@ automation: service: script.ifttt_notify data_template: value1: 'HA Status:' - value2: {% raw %}"{{ trigger.event.data.entity_id.split('_')[1] }} is "{% endraw %} - value3: {% raw %}"{{ trigger.event.data.to_state.state }}"{% endraw %} + value2: "{{ trigger.event.data.entity_id.split('_')[1] }} is " + value3: "{{ trigger.event.data.to_state.state }}" ``` +{% endraw %} +{% raw %} ```yaml #Example Script to send TestHA_Trigger to IFTTT but with some other data (homeassistant UP). ifttt_notify: sequence: - service: ifttt.trigger - data_template: {"event":"TestHA_Trigger", "value1":"{% raw %}{{ value1 }}{% endraw %}", "value2":"{% raw %}{{ value2 }}{% endraw %}", "value3":"{% raw %}{{ value3 }}{% endraw %}"} + data_template: {"event":"TestHA_Trigger", "value1":"{{ value1 }}", "value2":"{{ value2 }}", "value3":"{{ value3 }}"} ``` +{% endraw %} ### {% linkable_title Sending events from IFTTT to Home Assistant %}