Home Assistant
The Home Assistant trigger is useful when you want an automation to run when Home Assistant starts or begins shutting down. Use it to restore part of your setup after a restart, send a status message, or save state before maintenance.
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.
- Select the type of trigger to add.
- Select Home Assistant.
- Under Event:, select Start or Shutdown.
- 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, use trigger: homeassistant with event: start or event: shutdown. A basic example looks like this:
trigger: homeassistant
event: start
This runs when Home Assistant starts.
Options in YAML
Good to know
- Use
startto run an automation after Home Assistant finishes starting. - Use
shutdownto run an automation before Home Assistant stops. Shutdown automations have 20 seconds to run. - This trigger does not use a target because it applies to the Home Assistant instance itself.
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].
For this trigger, there is no target entity to change. To test it, restart Home Assistant from Settings > System > Restart.
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: send a notification when Home Assistant starts
If you restart Home Assistant for an update or maintenance, this automation lets you know when it is ready again.
-
Trigger: Home Assistant
- Event: Start
-
Action: Send a notification message
-
Target: My Device (
notify.my_device)
-
Target: My Device (
YAML example for notifying when Home Assistant starts
alias: "Notify when Home Assistant starts"
triggers:
- trigger: homeassistant
event: start
actions:
- action: notify.send_message
target:
entity_id: notify.my_device
data:
message: "Home Assistant has started."
Automation: save persistent states before Home Assistant shuts down
If you are about to restart or stop Home Assistant, this automation tells Home Assistant to save persistent states right away.
-
Trigger: Home Assistant
- Event: Shutdown
- Action: Save persistent states
YAML example for saving persistent states before shutdown
alias: "Save persistent states before shutdown"
triggers:
- trigger: homeassistant
event: shutdown
actions:
- action: homeassistant.save_persistent_states
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:
-
Manual event received: Triggers when an event is received.
-
Time: Triggers at a specific time, or from a date/time helper or timestamp-style sensor.