Conditional Notifications is a custom integration for Home Assistant that lets you create notifications which wait for something to happen.
For example:
- notify me the next time the kitchen detects motion;
- tell me if the front door opens while I am away;
- alert me when the freezer becomes too warm;
- notify me if nothing happens before a deadline;
- keep notifying me when something happens, with an optional cooldown between alerts.
You create and manage these from a Conditional Notifications panel in the Home Assistant sidebar. No YAML configuration is required.
A normal reminder says “tell me at 10:00.”
A conditional notification says “tell me when this happens.”
A conditional notification can watch for:
- an entity changing state;
- a sensor entering a numeric range;
- a person or device entering or leaving a zone;
- a Home Assistant event;
- a named trigger fired by another automation, script, integration, or action.
You can also add:
- multiple triggers — notify when any happens, or require all of them within a chosen time window;
- conditions — only notify if all conditions are true;
- start and expiry times;
- recurring time windows;
- cooldowns and debounce;
- a minimum duration, such as “only if the door stays open for 5 minutes”;
- one-off, repeating, or limited-count notifications;
- an optional notification when the watch expires without anything happening;
- automatic resolution when the problem clears.
Notifications can be delivered as Home Assistant persistent notifications, through notify entities such as the Companion App, or both.
If you already use HACS:
-
Open HACS in Home Assistant.
-
Select the three-dot menu in the top-right corner.
-
Choose Custom repositories.
-
Add:
https://github.com/conorod1992/conditional_notifications -
Select Integration as the repository type.
-
Select Add.
-
Find Conditional Notifications in HACS and download it.
-
Restart Home Assistant.
-
Go to Settings → Devices & services.
-
Select Add integration, search for Conditional Notifications, and add it.
Home Assistant 2026.6.0 or newer is required.
New to custom HACS repositories? Adding a custom repository simply tells HACS where to find an integration which is not in its normal catalogue. HACS still handles downloading and updating it for you.
-
Download or clone this repository.
-
Copy the folder:
custom_components/conditional_notificationsinto the
custom_componentsfolder inside your Home Assistant configuration directory. -
Restart Home Assistant.
-
Go to Settings → Devices & services → Add integration.
-
Search for Conditional Notifications and add it.
No YAML configuration is required.
After adding the integration, a Conditional Notifications item appears in the Home Assistant sidebar.
The panel contains:
- Active — notifications currently waiting for something to happen;
- Paused — notifications you have temporarily stopped;
- History — previous activity and notification results;
- Expired — watches which reached their expiry time.
A simple state-based notification only needs a few things:
- Select Create in the Conditional Notifications panel.
- Give it a name.
- Choose an entity.
- Choose the state you want to watch for.
- Enter the notification title and message.
- Save it.
For example:
Name: Next kitchen motion
Entity: Kitchen motion sensor
State: On
Message: Motion was detected in the kitchen.
The panel shows a plain-English summary before you save, so you can check what the notification will watch for.
You do not need to configure the advanced options unless you need them.
name: Next kitchen motion
triggers:
- type: state
entity_id: binary_sensor.kitchen_motion
to: "on"
title: Kitchen motion
message: "{{ trigger.friendly_name }} detected motion at {{ trigger.timestamp }}."
repeat_policy: onceThis triggers once, then stops.
name: Upstairs motion this weekend
match: any
triggers:
- type: state
entity_id: binary_sensor.study_motion
to: "on"
- type: state
entity_id: binary_sensor.bedroom_motion
to: "on"
expires_at: "2026-08-30T18:00:00+01:00"
title: Upstairs motion
message: "{{ trigger.friendly_name }} detected motion."
repeat_policy: onceWith match: any, any one of the triggers can satisfy the notification.
name: Front door activity
match: all_within
match_window: 30
triggers:
- type: state
entity_id: binary_sensor.front_door
to: "on"
- type: state
entity_id: binary_sensor.hall_motion
to: "on"
title: Front door activity
message: The door and hall motion were both detected within 30 seconds.
repeat_policy: everyWith match: all_within, every configured trigger must occur within the chosen window. The order does not matter. If one signal becomes too old before the others occur, it is discarded from the current correlation window.
name: Front door while away
triggers:
- type: state
entity_id: binary_sensor.front_door
to: "on"
conditions:
- type: state
entity_id: person.conor
state: not_home
title: Front door opened
message: The front door opened while you were away.
repeat_policy: every
cooldown: 1200This can notify repeatedly, but the 1200-second cooldown prevents another accepted notification for 20 minutes.
name: Freezer too warm
triggers:
- type: numeric_state
entity_id: sensor.freezer_temperature
above: -10
resolve_when:
type: numeric_state
entity_id: sensor.freezer_temperature
below: -12
title: Freezer is too warm
message: "The freezer is {{ trigger.value }}°C."
repeat_policy: every
clear_on_resolve: trueThis also defines a resolution condition. When the temperature falls below -12, the active problem is considered resolved.
If the notification was delivered as a persistent Home Assistant notification, clear_on_resolve: true can dismiss that persistent notification automatically.
Create a normal trigger, set an expiry time, then enable Notify on expiry.
Equivalent definition:
notify_on_expiry: true
expiry_title: Kitchen check
expiry_message: No kitchen motion was detected before 10:00.A “no event” notification is sent only if no qualifying occurrence was accepted before the watch expired.
The panel embeds Home Assistant's trigger and condition editors. Existing type: definitions continue to work; editing a legacy fragment through the native editor converts only that fragment. Native definitions use trigger: and condition:. Native trigger groups count as one correlation slot and use OR semantics within that slot.
Administrators can use Home Assistant's available native trigger and condition types. Non-admin owners are limited to observers that can be checked against their entity/event read permissions. Native observer templates, including trigger variables and templated durations, require an administrator. Registry UUID references are resolved before checking permissions.
See Native automation configuration for stored shapes and the permission boundary. This remains a notification integration: it does not execute arbitrary action sequences, reminders, or deferred actions.
Watches an entity for a real state change.
Examples include:
- a binary sensor changing to
on; - a light changing to
off; - a person changing to
not_home; - an attribute changing to a particular value.
A normal state trigger waits for a transition. If the entity is already in the target state when you create the notification, it does not immediately count as a new occurrence.
If you specifically want the current state to be checked when creating a new notification, enable Match current state immediately.
unknown and unavailable do not count as matching states.
Watches a numeric sensor for entry into a range.
For example:
- temperature rises above 25;
- battery level falls below 20;
- humidity moves between two limits.
One or both of above and below can be used.
The notification triggers when the value enters the matching range, rather than repeatedly firing while it remains there.
Watches for an entity entering or leaving a Home Assistant zone.
For example:
- a person arrives home;
- a device leaves the home zone;
- a person enters a work zone.
Watches for a Home Assistant event.
You can optionally match selected fields from the event data. The fired event may contain additional fields without preventing a match.
This is mainly useful for more advanced Home Assistant setups or for events fired by another integration.
A named trigger is an integration-owned trigger ID which you can fire using:
conditional_notifications.fire_named_trigger
This is useful when another automation, script, or integration should signal a conditional notification without tying it directly to an entity state.
Conditions are optional extra checks.
A trigger must happen first, then all configured conditions must pass before the notification is accepted.
Supported conditions are:
- state;
- numeric state;
- zone;
- local time or time window.
For example:
Notify me when the front door opens only if I am away.
The front-door state change is the trigger. Your presence state is the condition.
Legacy definitions support the bounded conditions listed here. Native Home Assistant conditions follow the administrator and entity-permission rules described above. Neither format executes arbitrary action sequences.
You can choose how often a notification may be accepted.
Notify on the first qualifying occurrence, then stop.
Continue watching and allow future qualifying occurrences.
Allow a fixed number of accepted notifications, then stop.
The remaining count is saved and survives a Home Assistant restart. If template rendering fails or every delivery channel fails, that attempt does not consume the repeat count. A qualifying trigger still counts as having happened for no-event expiry handling, so a provider failure does not turn into a misleading “nothing happened” alert.
A cooldown sets the minimum time after an accepted notification before another one may be accepted.
Example:
Notify me every time the door opens, but no more than once every 20 minutes.
Debounce helps ignore or collapse rapid repeated changes which happen close together.
This can be useful for noisy sensors or events which may fire several times in quick succession.
A trigger can be required to remain true for a minimum time before it qualifies.
Example:
Notify me if the garage door stays open for 5 minutes.
If the state stops matching before the duration is reached, the pending occurrence is cancelled.
You can limit when a notification is active using:
available_from— do not accept occurrences before this time;expires_at— stop watching after this time;- recurring local-time windows.
Dates and times entered directly in definitions must include their timezone offset, for example:
2026-08-30T18:00:00+01:00
The panel handles normal user-facing date and time entry for you.
Recurring windows use the timezone configured in Home Assistant.
Overnight windows are supported. For example, a window from 22:00 to 07:00 continues through midnight into the following morning.
By default, Conditional Notifications can use a Home Assistant persistent notification.
You can change the integration-wide defaults under:
Settings → Devices & services → Conditional Notifications → Configure
You can configure:
- whether the sidebar panel is shown;
- whether persistent notifications are used by default;
- default
notifytargets; - history retention;
- whether rendered notification titles and messages are retained in history.
New notifications default to Use my notification defaults, so you do not need to choose the same delivery method every time.
Individual notifications can instead choose their own delivery targets.
Modern Home Assistant notify entities are supported using notify.send_message for title and message delivery. Administrator-owned watches can also select Companion App notify.mobile_app_* service targets in custom delivery or integration defaults. Existing legacy notify.* targets remain supported.
Assist satellite entities can be selected for voice announcements. They receive the message through assist_satellite.announce; the title is not spoken.
If more than one delivery channel is configured, failure of one channel does not prevent the others from being attempted.
For compatible Companion App service targets, an individual conditional notification can optionally add:
- a destination to open when the notification itself is tapped;
- up to three action buttons;
- buttons which either open a link or fire a named Companion App notification-action event that another Home Assistant automation can handle.
Home Assistant-relative destinations must begin with a single /, such as /lovelace/security. Full http:// and https:// URLs are also accepted.
These options are deliberately bounded. Conditional Notifications does not expose an arbitrary Companion App data object, arbitrary service calls, command URIs, or unrestricted notification payload fields.
Notify entities send title and message only, so they do not receive Companion tap links or buttons. The panel explains this distinction and lets administrators select compatible service targets. Configuring extras without a service target produces an explicit compatibility result instead of silently dropping them. Android and iOS tap destinations are populated together.
If a service target does not support Companion options, that channel may report a delivery failure; other configured channels are still attempted independently.
The Test option renders and sends the notification using the real configured delivery channels.
A test does not:
- increase the notification count;
- satisfy a trigger;
- add a normal occurrence to the watch history.
Some notifications represent a temporary problem rather than a single event.
For example:
Alert me when the freezer is above -10 °C, and consider the problem resolved when it falls below -12 °C.
Use resolve_when to define the resolution condition.
If clear_on_resolve is enabled, Conditional Notifications can dismiss the persistent Home Assistant notification that it created for that occurrence.
It cannot retract a phone push notification which has already been delivered by another provider.
Notification titles and messages can use Home Assistant templates.
For example:
message: "{{ trigger.friendly_name }} detected motion at {{ trigger.timestamp }}."Conditional Notifications provides a trigger object containing useful information about the occurrence.
Common fields include:
typetrigger_indextimestamp
entity_idfriendly_namefrom_stateto_stateattribute
valueprevious_valueabovebelowattribute
event_typeevent_data
entity_idzone_entity_idzoneevent
trigger_idevent_data
For a completed all_within correlation, the trigger object also contains matched_triggers with the individual trigger contexts and correlation with the configured window and first/last match times.
A notification object is also available with the notification's current structured status.
For non-admin owners, templates run in a sandbox containing trigger and notification, standard Jinja filters, safe now()/utcnow() time helpers, and no Home Assistant state/registry globals. For example, use {{ trigger.timestamp.strftime('%H:%M') }} for the occurrence time. Calls such as states() and state_attr() are available only to administrator-owned or internal system-owned watches. Rendering rechecks the current owner identity, including after permission changes.
Template syntax is checked when the notification is saved. If rendering later fails for a particular occurrence, the failure is recorded without stopping the rest of the integration.
Conditional Notifications provides Home Assistant actions under the conditional_notifications domain:
creategetlistupdatedeletepauseresumeenabledisableduplicatetesttrigger_nowfire_named_triggerclear_history
These are useful when another automation, script, integration, or advanced workflow needs to manage conditional notifications.
Create and update use the same definition format as the sidebar panel.
Existing notifications can be referenced by their ID, semantic key, or exact name. If a reference could mean more than one notification, the integration returns possible matches rather than guessing.
These are deliberately different:
testonly tests rendering and delivery;trigger_nowsubmits a manual occurrence through the normal timing, condition, debounce, cooldown, and repeat checks.
Conditional Notifications also registers a Home Assistant LLM API.
If you use a compatible Home Assistant conversation agent, you can select the Conditional Notifications LLM API in that agent's LLM API options.
It provides structured tools which can create, inspect, list, update, pause, resume, enable, disable, duplicate, test, and delete conditional notifications.
The LLM tools are deliberately limited to Conditional Notifications definitions. They cannot use this integration as a way to run arbitrary Home Assistant services or arbitrary action sequences.
If you do not use an LLM or voice assistant, you can ignore this section completely.
Your notification definitions and important progress are stored by the integration.
After Home Assistant restarts, Conditional Notifications recreates the listeners and timers it needs and continues watching.
Saved information includes items such as:
- whether a notification is enabled or paused;
- accepted-notification counts;
- limited-notification remaining counts;
- cooldown timing;
- active resolution state;
- expiry state;
- whether a qualifying occurrence has already happened for no-event handling;
- bounded history.
For minimum-duration checks, the integration takes a conservative approach after a restart: time which elapsed before the restart is not assumed to have been continuously proven. This prevents a restart from creating a false duration-based occurrence.
Partial all_within correlations are also deliberately cleared on restart or listener rebuild. A complete fresh set of matching triggers must occur after listeners are active again, so events on opposite sides of downtime are never joined together.
The detail view can show information such as:
- whether the notification is currently eligible to fire;
- whether it is active, paused, disabled, or expired;
- expiry time;
- next cooldown eligibility;
- notification count and remaining count;
- last trigger;
- most recent reason an occurrence was ignored;
- active resolution state;
- delivery results.
History may include events such as:
- creation and editing;
- trigger matches;
- condition rejection;
- notification delivery;
- template or delivery failures;
- resolution;
- pause and resume;
- expiry;
- no-event notification delivery.
History is automatically bounded by both age and a maximum record count. Age retention is also checked hourly while idle. The panel initially shows 200 matching records and offers Load more history to access the rest of the retained results.
The optional sensor.conditional_notifications_active entity contains only small summary information. Conditional notification definitions are not stored in that entity's attributes or written into Recorder rows.
Conditional Notifications uses Home Assistant's authenticated user identity.
Normal users can see and manage only their own conditional notifications. Home Assistant administrators may manage all records.
Observation permissions are checked again before accepting triggers, resolutions, and tests. If the owner loses access, the watch stops with an error before recording the new event. Restore the required permissions and re-enable the watch to resume observation.
Browser and LLM requests use the authenticated Home Assistant user; they cannot simply provide a different owner ID.
Actions called internally without a Home Assistant user context create shared/system-owned records.
Diagnostics contain only limited aggregate information and preferences. They do not include full conditional-notification definitions, notification content, tokens, or webhook IDs.
Open the notification's detail/status view and check:
- whether it is currently active;
- its availability or expiry;
- condition results;
- cooldown;
- the last ignored reason;
- delivery results.
Normal state triggers wait for a change into the target state.
If you want a newly created notification to check the entity's current state immediately, enable Match current state immediately.
Any transition which stops matching cancels the pending duration check.
A Home Assistant restart also conservatively resets unproven elapsed duration.
Check the selected notify entity or service in Developer Tools → Actions.
If desired, keep Home Assistant persistent notifications enabled as an additional delivery channel.
Go to:
Settings → Devices & services → Conditional Notifications → Configure
and make sure the panel is enabled.
Reload the integration if necessary.
The panel shows a notifications need repair notice for quarantined records visible to your account. Select Inspect and repair, correct the definition, and save. A successful repair preserves the watch ID and original owner and begins a fresh observation cycle. Validation failures leave the original quarantined record intact. Diagnostics include the quarantine count without including definitions or notification content.
Malformed trigger or condition entries remain visible as incomplete fields that require correction. They are not silently removed during repair. The editor holds its submitted values while a save is pending.
Dates in the editor use the browser timezone. Recurring hours use Home Assistant's configured timezone; the editor displays both timezone names.
Test the template in Developer Tools → Template and use the supported trigger fields documented above.
The following details are mainly relevant to developers, contributors, or anyone interested in how the integration avoids duplicate or unsafe behaviour.
Conditional Notifications stores its records in Home Assistant's versioned storage. Runtime listeners and timers are reconstructed when the config entry is loaded.
Each notification record has its own lock and revision number. Runtime cancellation also invalidates late attachment results and immediately removes late subscriptions. Editing or deleting a record invalidates its previous listeners and pending duration callback.
An occurrence reservation and its count are saved before notification providers are called. A completed all-channel or template failure rolls back the repeat count. There is no automatic provider retry loop; a crash after reservation retains conservative durable progress.
Concurrent callbacks re-check the current record revision and status before accepting an occurrence.
The integration deliberately supports a bounded set of trigger and condition definitions rather than arbitrary action execution.
python -m pip install -r requirements_test.txt
ruff format --check .
ruff check .
mypy custom_components/conditional_notifications
pytest
cd frontend
npm ci
npx playwright install chromium
npm run lint
npm test
npm run test:browser
npm run buildCI runs backend tests against Home Assistant 2026.6.0, 2026.7.3, and 2026.10.4, plus browser regressions, ESLint, HACS, and hassfest validation. Update the current-version matrix entry when adopting a newer HA release.
The browser fixture exercises the actual panel modules and DOM events with a small HA connection/selector contract fixture; it does not require a live Home Assistant instance. Backend native-runtime regressions use Home Assistant's real trigger, condition, entity registry, and template helpers.
Frontend features use explicit class inheritance; only the final composed panel registers the custom element. Loading, refresh, and live subscription each have one implementation. Stable data attributes identify editor sections instead of translated heading text.
The committed frontend panel is a dependency-free ES module and the build is expected to be idempotent; CI fails if rebuilding changes the committed output.
MIT