Calendar event ended
The Calendar event ended trigger fires when a calendar event ends. You can also set up the trigger to fire before or after the end of the event.
Use it to automate actions based on the end of a calendar event.
Requires the Purpose-specific triggers and conditions Labs preview feature. Enable it at Settings > System > Labs.
Using this trigger from the user interface
If you prefer building automations visually, Home Assistant walks you through this trigger step by step. You pick what to watch, tweak a few options, and save. No YAML knowledge required.
To use this trigger in an automation:
- Go to Settings > Automations & scenes.
- Open an existing automation, or select Create automation > Create new automation.
- In the When section, select Add trigger.
- From the search box, search for and select Calendar event ended.
- Under Targets (see Targets), select Add target and pick what to watch. Select the calendar entity with the event that you want to watch. You can also select a device or a label, for example.
- Under Offset, you can enter the time from the end of the event when the trigger will fire. If you want the trigger to fire at the ending time of the event, skip this step and the next one.
- If you entered an offset, under Offset type, select one of the following:
- Before if you want the trigger to fire before the end of the event.
- After if you want the trigger to fire after the end of the event.
- Select Save.
Options in the UI
Using this trigger in YAML
If you work directly in YAML, or you want to know exactly what Home Assistant does under the hood, this section has the technical reference. It lists the field names you use in YAML, their types, and which ones are required.
In YAML, refer to this trigger as calendar.event_ended. A basic example looks like this:
trigger: calendar.event_ended
target:
entity_id: calendar.personal
options:
offset:
minutes: 30
offset_type: after
This fires 30 minutes after the end of an event in calendar.personal.
Options in YAML
Targets of the trigger
This trigger requires a target. The target is the object that Home Assistant will watch. You can select a single entityAn entity represents a sensor, actor, or function in Home Assistant. Entities are used to monitor physical properties or to control other entities. An entity is usually part of a device or a service. [Learn more], a device, an area, a floor, or a label as a target, and Home Assistant will watch every matching calendar entity behind that target.
-
Entity: one specific calendar entity, such as
calendar.living_room. - Device: every calendar entity that belongs to a device.
- Area: every calendar entity in a room or area.
- Floor: every calendar entity on a floor.
- Label: every calendar entity that shares a label.
You can also select different target types in one trigger. For example, you can add a specific entity and an area as targets in the same trigger to monitor both of them at once.
Good to know
- Note that calendars are read once every 15 minutes. When testing, make sure you do not plan events less than 15 minutes away from the current time, or your triggerA trigger is a set of values or conditions of a platform that are defined to cause an automation to run. [Learn more] might not fire.
- You can also create an automation based on the state of a calendar entityAn entity represents a sensor, actor, or function in Home Assistant. Entities are used to monitor physical properties or to control other entities. An entity is usually part of a device or a service. [Learn more].
- A calendar trigger should not generally use automation mode
singleto ensure the trigger can fire when multiple events end at the same time. For example, usequeuedorparallelinstead. - In YAML, you can also set up other variables for calendar triggers. See Automation Trigger Variables: Calendar to check the available trigger data.
Try it yourself
Ready to test this? Go to Settings > Automations & scenes, create a new automation, and add this trigger. Save the automation, then change the state of the targeted entity to watch the trigger fire on your actual entitiesAn entity represents a sensor, actor, or function in Home Assistant. Entities are used to monitor physical properties or to control other entities. An entity is usually part of a device or a service. [Learn more].
More examples
Real scenarios where this trigger fires in automations and scripts. Copy any example and adapt it to your setup.
You don’t need to edit YAML to use these examples. Copy a YAML snippet from this page, open the automation editor in Home Assistant, and press Ctrl+V (or Cmd+V on Mac). Home Assistant automatically converts the pasted YAML into the visual editor format, whether it’s a full automation, a single trigger, a condition, or an action.
Automation: turn off lights after a family gathering
After a scheduled family gathering takes place at home, this automation turns off specific lights in the living room.
- Trigger: Calendar event ended
- Action: Turn off light
YAML example for turning off specific lights after a family gathering
alias: "Turn off lights after a family gathering"
triggers:
- trigger: calendar.event_ended
target:
entity_id: calendar.my_family_events
actions:
- action: light.turn_off
target:
label_id: cozy_lights_living_room
Still stuck?
The Home Assistant community is quick to help: join Discord for real-time chat, post on the community forum with the trigger you’re using and what you expected to happen, or share on our subreddit /r/homeassistant.
AI assistants like ChatGPT or Claude can also explain triggers or suggest the right one when you describe what you want in plain language.
Related triggers
These triggers work well alongside this one:
- Calendar event started: Triggers when a calendar event starts.