Timer
The Timer integrationIntegrations connect and integrate Home Assistant with your devices, services, and more. [Learn more] lets you create and manage countdown timers in Home Assistant.
You can use timers in automations and scripts to keep a bathroom fan running for 20 minutes, remind yourself when laundry is nearly done, or turn lights off after motion has stopped.
Timers will be restored to their correct state and time on Home Assistant startup and restarts when configured with the restore option.
However, automations using the timer.finished event will not trigger on startup if the timer expires when Home Assistant is not running.
Configuration
The preferred way to create a timer is from the user interface. Go to Settings > Devices & services > Helpers, select Create helper, and then select Timer.
If you removed default_config: from your configuration.yamlThe configuration.yaml file is the main configuration file for Home Assistant. It lists the integrations to be loaded and their specific configurations. In some cases, the configuration needs to be edited manually directly in the configuration.yaml file. Most integrations can be configured in the UI. [Learn more], add timer: first before creating timers from the UI.
You can also define timers in YAML. To add a timer, add the following to your configuration.yamlThe configuration.yaml file is the main configuration file for Home Assistant. It lists the integrations to be loaded and their specific configurations. In some cases, the configuration needs to be edited manually directly in the configuration.yaml file. Most integrations can be configured in the UI. [Learn more] file:
# Example configuration.yaml entry
timer:
laundry:
duration: "00:01:00"
Configuration Variables
Alias for the timer. Multiple entries are allowed.
Initial duration in seconds or 00:00:00 when Home Assistant starts.
Set a custom icon for the state card.
Configuration options
When you create or edit a timer from the UI, the following options are available.
Pick an icon from Material Design Icons and prefix it with mdi:.
Supported functionality
The Timer integration provides timer entities that you can use in dashboards, scripts, and automations.
Use a timer when you want a countdown that can be started, paused, changed, canceled, finished, shown on a dashboard, or reused across multiple automations. Unlike an automation’s for option, a timer is its own entity, so you can see it, manage it, and use the same countdown in more than one place. If you only need to wait until another trigger or condition stays true for a while, using that automation’s for option is often simpler.
-
Timer entity
- Description: Represents a countdown that you can start, pause, change, cancel, or finish.
-
States:
idle,active, andpaused. -
Remarks: A timer returns to
idlewhen it finishes, is canceled, or has not been started yet.
List of triggers
The Timer integrationIntegrations connect and integrate Home Assistant with your devices, services, and more. [Learn more] provides the following triggers. Each link below opens a dedicated page with examples, fields, and a step-by-step UI walkthrough.
-
Timer cancelled (
timer.cancelled) Triggers when one or more timers are cancelled. -
Timer finished (
timer.finished) Triggers when one or more timers finish. -
Timer paused (
timer.paused) Triggers when one or more timers are paused. -
Timer restarted (
timer.restarted) Triggers when one or more timers are restarted. -
Timer started (
timer.started) Triggers when one or more timers are started. -
Timer time remaining (
timer.time_remaining) Triggers when one or more timers reach a specific remaining time.
For an overview of every trigger across all integrations, see the triggers reference.
List of conditions
The Timer integrationIntegrations connect and integrate Home Assistant with your devices, services, and more. [Learn more] provides the following conditions. Each link below opens a dedicated page with examples, fields, and a step-by-step UI walkthrough.
-
Timer is active (
timer.is_active) Tests if one or more timers are active. -
Timer is idle (
timer.is_idle) Tests if one or more timers are idle. -
Timer is paused (
timer.is_paused) Tests if one or more timers are paused.
For an overview of every condition across all integrations, see the conditions reference.
List of actions
The Timer integrationIntegrations connect and integrate Home Assistant with your devices, services, and more. [Learn more] provides the following actions. Each link below opens a dedicated page with examples, parameters, and a step-by-step UI walkthrough.
-
Cancel a timer (
timer.cancel) Cancels a running or paused timer without firing the finished event. -
Change a timer (
timer.change) Adds or subtracts time on a running timer. -
Finish a timer (
timer.finish) Finishes a running or paused timer earlier than scheduled. -
Pause a timer (
timer.pause) Pauses a running timer, keeping the remaining time. -
Reload timers (
timer.reload) Reloads timers from the YAML configuration. -
Start a timer (
timer.start) Starts a timer, or restarts it with a new duration.
For an overview of every action across all integrations, see the actions reference.
Timer automation examples
Requires the Purpose-specific triggers and conditions Labs preview feature. Enable it at Settings > System > Labs.
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 the bathroom fan when the timer finishes
Use a timer to keep the fan running for a fixed amount of time after a shower.
-
Trigger: Timer finished
- Target: Bathroom fan timer
- Trigger when: Each
- Action: Turn off fan
YAML example for a bathroom fan timer
alias: "Turn off bathroom fan when the timer finishes"
triggers:
- trigger: timer.finished
target:
entity_id: timer.bathroom_fan
actions:
- action: fan.turn_off
target:
entity_id: fan.bathroom
Automation: send a reminder when only five minutes remain
Get a reminder shortly before a timer finishes, like when laundry or cooking time is almost done.
-
Trigger: Timer time remaining
- Target: Laundry timer
- Time remaining: 00:05:00
-
Action: Send a notification message
-
Target: My Device (
notify.my_device)
-
Target: My Device (
YAML example for a laundry timer reminder
alias: "Notify when five minutes remain on the laundry timer"
triggers:
- trigger: timer.time_remaining
target:
entity_id: timer.laundry
options:
remaining: "00:05:00"
actions:
- action: notify.send_message
target:
entity_id: notify.my_device
data:
message: "The laundry timer has five minutes left."
Known limitations
- If a timer finishes while Home Assistant is not running, automations that use the Timer finished trigger do not run after startup.
Removing the integration
To remove a timer created from the UI, go to Settings > Devices & services > Helpers, select the timer, and delete it.
If you configured a timer in YAML, remove it from your configuration.yamlThe configuration.yaml file is the main configuration file for Home Assistant. It lists the integrations to be loaded and their specific configurations. In some cases, the configuration needs to be edited manually directly in the configuration.yaml file. Most integrations can be configured in the UI. [Learn more] file and reload or restart Home Assistant.