mirror of
https://github.com/home-assistant/home-assistant.io.git
synced 2025-07-19 15:26:59 +00:00
Update calendar automation recipes (#22846)
This commit is contained in:
parent
29b8de6042
commit
3eb6e62e04
@ -34,11 +34,22 @@ automation:
|
|||||||
entity_id: calendar.personal
|
entity_id: calendar.personal
|
||||||
```
|
```
|
||||||
|
|
||||||
### Example Automation
|
Calendar triggers should should generally not use automation mode `single` to ensure the trigger
|
||||||
|
can fire when multiple events start at the same time (e.g. use `queued` or `parallel` instead)
|
||||||
|
|
||||||
This is an example of an automation that sends a notification with details about the event that
|
See [Automation Trigger Variables: Calendar](/docs/automation/templating/#calendar) for additional trigger data available for conditions or actions.
|
||||||
triggered the automation. See [Automation Trigger Variables: Calendar](/docs/automation/templating/#calendar) for additional trigger data available for conditions or actions.
|
|
||||||
|
|
||||||
|
### Automation Recipes
|
||||||
|
|
||||||
|
Below are a few example ways you can use Calendar triggers.
|
||||||
|
|
||||||
|
{% details "Example: Calendar Event Notification " %}
|
||||||
|
|
||||||
|
This example automation consists of:
|
||||||
|
- For the calendar entity `calendar.personal`
|
||||||
|
- At the start of any calendar event
|
||||||
|
- Send a notification with the title and start time of the event
|
||||||
|
- Allowing multiple events starting at the same time
|
||||||
|
|
||||||
{% raw %}
|
{% raw %}
|
||||||
```yaml
|
```yaml
|
||||||
@ -54,6 +65,42 @@ automation:
|
|||||||
message: >-
|
message: >-
|
||||||
Event {{ trigger.calendar_event.summary }} @
|
Event {{ trigger.calendar_event.summary }} @
|
||||||
{{ trigger.calendar_event.start }}
|
{{ trigger.calendar_event.start }}
|
||||||
mode: single
|
mode: queued
|
||||||
```
|
```
|
||||||
{% endraw %}
|
{% endraw %}
|
||||||
|
|
||||||
|
{% enddetails %}
|
||||||
|
|
||||||
|
{% details "Example: Calendar Event Light Schedule " %}
|
||||||
|
|
||||||
|
This example consists of:
|
||||||
|
- For the calendar entity ` calendar.device_automation`
|
||||||
|
- When event summary contains `Front Lights`
|
||||||
|
- Turn on and off light named `light.front` when the event starts and ends
|
||||||
|
|
||||||
|
{% raw %}
|
||||||
|
```yaml
|
||||||
|
automation:
|
||||||
|
alias: Front Light Schedule
|
||||||
|
trigger:
|
||||||
|
- platform: calendar
|
||||||
|
event: start
|
||||||
|
entity_id: calendar.device_automation
|
||||||
|
- platform: calendar
|
||||||
|
event: end
|
||||||
|
entity_id: calendar.device_automation
|
||||||
|
condition:
|
||||||
|
- condition: template
|
||||||
|
value_template: "{{ 'Front Lights' in trigger.calendar_event.summary }}"
|
||||||
|
action:
|
||||||
|
- if:
|
||||||
|
- "{{ trigger.event == 'start' }}"
|
||||||
|
then:
|
||||||
|
- service: light.turn_on
|
||||||
|
else:
|
||||||
|
- service: light.turn_off
|
||||||
|
mode: queued
|
||||||
|
```
|
||||||
|
{% endraw %}
|
||||||
|
|
||||||
|
{% enddetails %}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user