From 56f912aab95957e37500d3a0263253266bbc33fe Mon Sep 17 00:00:00 2001 From: Amir Hanan Date: Thu, 4 Oct 2018 16:19:54 +0300 Subject: [PATCH] Tips for using calendar component in automation (#6501) * Tips for using calendar component in automation Following a recent automation I coded, trying to get more from my calendar integration. * Adding raw wrapping Hope that's what you meant! --- source/_components/calendar.google.markdown | 25 +++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/source/_components/calendar.google.markdown b/source/_components/calendar.google.markdown index 2c18ccd65a8..1c074f5ed81 100644 --- a/source/_components/calendar.google.markdown +++ b/source/_components/calendar.google.markdown @@ -163,3 +163,28 @@ Otherwise everything following the hash sign would be considered a YAML comment. - **location**: The event Location. - **start_time**: Start time of event. - **end_time**: End time of event. + +## {% linkable_title Using calendar in automations %} + +A calendar can be used as an external scheduler for special events or reoccurring events instead of hardcoding them in automations. + +Trigger as soon as an event starts: + +```yaml + trigger: + platform: state + entity_id: calendar.calendar_name + to: 'on' +``` + +By using specific text in the event title, you can set conditions to initiate particular automation flows on designated events while other events will be ignored. + +For example, the actions following this condition will only be executed for events named 'vacation': + +{% raw %} +```yaml + condition: + condition: template + value_template: "{{states.calendar.calendar_name.attributes.message == 'vacation' }}" +``` +{% endraw %}