From ee87edc6bf1fb014532a99e520878e1c629ad6d3 Mon Sep 17 00:00:00 2001 From: Daniel Stone Date: Fri, 5 May 2017 05:56:40 +0100 Subject: [PATCH] Telegram: example to show the use of event_data (#2550) * Telegram: example to show the use of event_data ... in the action. (took a while to figure out myself) * Updated pr to avoid render of the template --- source/_components/telegram_bot.markdown | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/source/_components/telegram_bot.markdown b/source/_components/telegram_bot.markdown index 1450a7ed5ef..e969170558a 100644 --- a/source/_components/telegram_bot.markdown +++ b/source/_components/telegram_bot.markdown @@ -79,3 +79,19 @@ action: - service: homeassistant.turn_off entity_id: switch.vision_zm1601eu5_battery_operated_siren_switch_9_0 ``` + +An example to show the use of event_data in the action: + +``` +- alias: 'Kitchen Telegram Speak' + trigger: + platform: event + event_type: telegram_command + event_data: + command: '/speak' + action: + - service: notify.kitchen_echo + data_template: + message: > + Message from {% raw %}{{ trigger.event.data["from_first"] }}. {% for state in trigger.event.data["args"] %} {{ state }} {% endfor %}{% endraw %} +```