Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more

Use the door or window’s Home Assistant binary-sensor entity as the automation trigger. For an instant warning, trigger when its state changes to on and send a Companion app notification to the intended phone. For a left-open reminder, create a second trigger for on with a for duration. Check the entity’s real states first, because unknown and unavailable are not the same as closed.

What a reliable door-sensor alert actually does

A dependable setup separates three situations that are often confused:

  • An opening event: the binary sensor changes from its normal closed state to on. This should produce an immediate notification.
  • A sustained open state: the sensor remains on for a chosen period. This needs a separate reminder trigger using for.
  • A sensor health problem: the entity becomes unknown or unavailable. This is neither open nor closed and should be handled as a diagnostic condition.

Home Assistant binary sensors store on and off. Their device class controls the labels shown in the interface, such as Open and Closed. The underlying state is what the automation evaluates. See the Home Assistant binary sensor documentation for the state and device-class model.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

An automation trigger reacts to a change at a point in time; it does not continuously fire while a condition remains true. Consequently, a door that stays open does not generate repeated “opened” alerts unless you add a timed reminder. The automation trigger documentation describes this state-change behavior.

#1 Best Overall
Elebase USB to USB C Adapter for iPhone 18 Pro Max,USBC Car Charger Adapter | 4Pack Type C Female to A Male Cable Converter for Apple Duo 17 16 15 14 Plus,iWatch Watch 12 11 10,iPad 9 8 Air,Airpods 5 4
  • Read Before You Buy — No Video Output: These adapters support charging and USB 2.0 data transfer, but cannot transmit video signals. Except for standard USB webcams (which use USB data only), they are not compatible with HDMI/DisplayPort cables, video-capable USB-C hubs, or docking stations with video output.
  • Convert USB-A Ports to USB-C: Designed to connect USB-C earphones, cables, flash drives, card readers, and other USB-C accessories to standard USB-A ports. Plug-and-play with no drivers or software required.
  • Aluminum Alloy Housing: Built with a sturdy aluminum alloy shell that aids in heat dissipation and protects against daily wear and scratches. Designed to maintain a stable and secure connection.
  • Compact & Travel-Friendly: The ultra-compact design allows the adapter to stay plugged into your device without blocking adjacent ports or adding bulk, reducing wear and tear on your original USB ports.
  • 12-Month Warranty: Backed by a 12-month manufacturer warranty for peace of mind. Designed to meet strict quality control standards for reliable everyday performance.

Before creating the automation

Confirm the exact entity

Open the sensor’s details in Home Assistant and record its entity ID. A device may expose more than one entity, and the name shown on a dashboard is not necessarily the ID used by an automation. Confirm which entity changes when you physically open and close the door or window.

Watch the state while testing. A normal contact sensor should move between on and off, with the device class making those values appear as Open and Closed. If it shows unknown or unavailable, do not configure an alert that interprets that reading as “closed.” Those values indicate that Home Assistant does not currently have a normal binary reading.

Prepare phone delivery

For a phone push, the Home Assistant Companion app must be installed and connected, notifications must be permitted by the phone’s operating system, and the device must expose a notify target. Companion targets use the pattern notify.mobile_app_<device_id>; the exact device ID is installation-specific. The Companion notification guide explains setup and permission requirements.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Decide which phone should receive the message before building the action. If several people need the alert, configure an action for each intended target rather than assuming one target broadcasts to every device.

Choose the right automation pattern

Pattern Trigger Use it for Important behavior
Immediate open alert State changes to on “Notify me when a door opens” Runs once for the transition; it does not repeat while the door remains open.
Left-open reminder State changes to on and remains there for a chosen for duration “Alert when a door is left open” Represents a sustained-open condition and is separate from the immediate alert.
Availability diagnostic State changes to unknown or unavailable Sensor connectivity or reporting problems Does not claim that the opening is physically closed or open.

Create an immediate “door opened” notification

1. Build a state trigger

Create an automation and choose a state trigger for the confirmed binary-sensor entity. Set the target state to on. A state trigger with no duration fires when the entity changes into that state, which is the appropriate pattern for an immediate opening warning.

In the visual editor, select the sensor entity and set its “to” state to on. If you use YAML, the structure is equivalent to this conceptual example. Replace both values with the IDs from your installation and verify the current syntax in your Home Assistant version:

Rank #2
Sale
Anker USB-C Hub, 5-in-1 USB Hub for Laptops, 4K HDMI Multiport Adapter | USB C Dongle with 90W Max Power Delivery, 3×5Gbps USB A Data Ports, for MacBook, Dell, and More (Charger Not Included)
  • 5-in-1 USB-C Hub: Experience comprehensive connectivity featuring a Power Delivery input, two USB-A 2.0 ports, a USB-A 3.0 port, and an HDMI port. (Note: The USB-C power delivery input port is only for connecting an external wall charger to power your laptop and cannot power peripheral devices.)
  • 90W Pass-Through Charging: Achieve optimal charging with 90W pass-through power to your laptop, supported by a total input of 100W, with the hub reserving 10W for operational efficiency. (Note: Wall charger not included.)
  • Quick Data Transfers: Accelerate your productivity with rapid data transfers using a high-speed 5Gbps USB 3.0 port and two 480Mbps USB 2.0 ports.
  • 4K HDMI Display: Enhance your visual experience with a hub capable of delivering 4K resolution at 30Hz in both mirror and extend modes. Please note that this hub is compatible with MacBook (macOS 12 and newer), Windows 10 and 11, ChromeOS, and laptops equipped with DP Alt Mode and Power Delivery. Note: This device is not compatible with Linux.
  • What You Get: Anker USB-C Hub (5-in-1, 4K HDMI), welcome guide, 18-month warranty, and our friendly customer service.
trigger:
  - platform: state
    entity_id: <your_binary_sensor_entity_id>
    to: "on"
action:
  - service: notify.mobile_app_<your_device_id>
    data:
      title: "Home Assistant"
      message: "<Named door or window> opened"

The angle-bracket values are placeholders, not literal entity or service names. A useful message names the opening (“kitchen window,” “back door,” or another label you use) so alerts remain distinguishable when multiple sensors are installed.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

2. Select the Companion notify action

Add a notify action that targets the configured Companion app device. Choose the exact mobile-app notify service exposed by your Home Assistant instance. Do not substitute notify.persistent_notification when your requirement is a phone push; that service creates a notice inside Home Assistant’s frontend instead.

3. Save and test the transition

With the automation enabled, close the door, wait for the entity to show its normal closed state, then open it. Confirm all three points:

  • The entity changes to on in Home Assistant.
  • The automation records a run.
  • The intended phone receives a message identifying the correct opening.

If the door was already open when you saved or enabled the automation, no opening transition occurred at that moment, so no immediate notification should be expected. Close it and open it again to create the transition.

Add a reminder for a door left open

Use a separate sustained-state trigger

For a reminder, create another automation (or another trigger/action branch) that targets the same entity, goes to on, and includes a for duration. Home Assistant’s notification documentation demonstrates a 10-minute garage-door example, while a Core integration example uses five minutes for a back door. These are examples, not universal settings: choose a period that fits the location and normal use.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
trigger:
  - platform: state
    entity_id: <your_binary_sensor_entity_id>
    to: "on"
    for: "00:10:00"
action:
  - service: notify.mobile_app_<your_device_id>
    data:
      title: "Door still open"
      message: "<Named door or window> has remained open for 10 minutes"

Replace 00:10:00 with your chosen interval. A five-minute reminder may suit a frequently used back door; a longer interval may be less intrusive for a garage or workshop. The timer starts when the state enters on and is satisfied only if the entity remains in that state for the full duration.

Rank #3
Sale
Anker USB C Hub, 7in1 Multi-Port USB Adapter, 4K@60Hz USBC to HDMI Splitter | 85W Max PD, 2 USB 3.0 & 1 USBC Data Ports, SD/TF Card Reader, for Laptops/Mac and Other Type C Devices (Charger Not Included)
  • Sleek 7-in-1 USB-C Hub: Features an HDMI port, two USB-A 3.0 ports, and a USB-C data port, each providing 5Gbps transfer speeds. It also includes a USB-C PD input port for charging up to 100W and dual SD and TF card slots, all in a compact design.
  • Flawless 4K@60Hz Video with HDMI: Delivers exceptional clarity and smoothness with its 4K@60Hz HDMI port, making it ideal for high-definition presentations and entertainment. (Note: Only the HDMI port supports video projection; the USB-C port is for data transfer only.)
  • Double Up on Efficiency: The two USB-A 3.0 ports and a USB-C port support a fast 5Gbps data rate, significantly boosting your transfer speeds and improving productivity.
  • Fast and Reliable 85W Charging: Offers high-capacity, speedy charging for laptops up to 85W, so you spend less time tethered to an outlet and more time being productive.
  • What You Get: Anker USB-C Hub (7-in-1), welcome guide, 18-month warranty, and our friendly customer service.

This reminder does not replace the immediate alert. If you combine both behaviors, the opening automation warns at once and the sustained-state automation warns later only when the opening has not been corrected.

Understand timer resets

If the contact returns to its closed state before the duration expires, the sustained-open condition is no longer true and the timed trigger does not complete. Opening it again starts a new interval. The reminder therefore describes the current continuous opening, not accumulated open time across several separate openings.

Monitor unknown and unavailable separately

A contact entity that becomes unknown or unavailable is not reporting a normal binary value. Treating either state as closed can create a dangerous false sense of security: Home Assistant may simply have lost a usable reading.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

If sensor availability matters, add a diagnostic automation for those states. Its message should say that the sensor is unavailable or unknown and identify the affected door or window. A separate diagnostic path keeps a connectivity warning distinct from a physical-open warning and lets you decide whether to notify immediately or only after a period of unavailability.

The binary-sensor integration documentation covers these non-normal states and why they differ from on and off: Binary sensor states and device classes.

Phone push versus a persistent Home Assistant notice

Channel Where it appears What it requires Best use
Companion mobile notification The selected phone Companion app setup, a valid notify.mobile_app_<device_id> target, and notification permission Immediate attention when someone is away from the Home Assistant interface
Persistent frontend notification Home Assistant’s frontend A persistent-notification action; the notice remains until dismissed or updated A visible reminder for people currently using the Home Assistant dashboard

A persistent notice is supplementary. It remains in Home Assistant until dismissed or updated, but it is not a phone push. The official action reference is Send a persistent notification.

Rank #4
Sale
UGREEN USB to USB C Adapter Combo 4-Pack, 10Gbps USB C Converter Space Gray | Data transfer & Fast charging for MacBook, iPhone 17/16/15, iPad, Samsung Galaxy, Apple Watch
  • Dual Converters, Infinite Potential:Includes 2× USB C male to USB A female adapters and 2× USB A male to USB C female adapters. Perfect for a wide range of uses—tablets with Bluetooth keyboards, expand USB ports on macbook, and more. Two different converters for all your daily needs
  • Next-Level 10Gbps & 3A Charging: No more slow 480Mbps, this usb to usb c adapter has a transfer speed of up to 10Gbps, allowing you to do more transferring in less time. This usb adapter fits both USB A and USB C charger, supporting up to 3A fast charging
  • Upgraded Exquisite Craftsmanship: With an aluminum alloy housing and metal connector, the usbc to usb adapter is extremely durable and sturdy. Rigorously tested to withstand more than 10,000 times of plugging and unplugging, ensuring long-lasting performance
  • Broad Compatible: The usb c to usb adapter widely supports all USB C/ USB A devices like laptops, tablets, cellphones, car chargers, and phone chargers. Such as compatible with MacBook Pro/Air 2023/2022, Thunderbolt 4/3 Devices,Apple MagSafe Watch 9/8/7/SE/Ultra, iPad Pro 2022/2021, Samsung Galaxy S23/S20/S10, and iPhone 17/16/15 Pro. Plug and play
  • Please Note: To reach 10Gbps speed, keep the cable under 3.3 ft. For USB A Male to USB C adapters, try flipping the USB C connector. USB C Male to USB A adapters support bidirectional 10Gbps transfer within 3.3 ft

Add action buttons only when you handle the response safely

Companion notifications can include action buttons. Pressing a button sends an event back to Home Assistant, allowing an automation to react to choices such as acknowledging an alert or starting another workflow. The return path is useful, but it is not guaranteed to produce a response: the Companion app may crash or close before emitting the event.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

If an automation waits for a button response, include a timeout and a fallback branch. After the timeout, send a second notice, perform a safe default action, or record that no response arrived. Never make a safety-critical workflow depend indefinitely on a phone response. See Companion actionable notifications for the event model and its failure caveat.

Test the complete alert path

Test a fresh opening

  1. Confirm the sensor currently reports its normal closed value.
  2. Open the door or window and watch the entity change to on.
  3. Check the automation trace or run history to confirm the trigger fired.
  4. Verify that the intended phone received the notification and that the message identifies the correct opening.

Test the sustained reminder

  1. Close the opening so the entity is not already in the timed state.
  2. Open it again and leave it open longer than the configured for duration.
  3. Confirm that one reminder arrives after the duration.
  4. Close the opening and verify that a later reopening starts a new timing period.

Test the non-normal states

Review the entity while the sensor is unavailable or unknown if your installation can produce those states safely. Confirm that any diagnostic automation uses a message describing a reporting problem rather than claiming the door is closed. Do not infer radio range, battery life, delivery latency, or outage resilience from these automation tests; those properties depend on the sensor, network, phone, and installation and are not established by the Home Assistant documentation cited here.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Troubleshoot the common failure modes

No alert when the automation was first saved

Check whether the door was already open. A state trigger responds to a transition, so saving an automation while the entity is already on does not create a new trigger event. Close and reopen the door to test the immediate alert.

The automation runs but no phone message arrives

Verify that the action targets the correct Companion notify service, that the app is connected to this Home Assistant instance, and that the phone has granted notification permission. A persistent frontend action will not solve a missing phone permission because it uses a different delivery channel.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The reminder never arrives

Confirm that the entity entered on and stayed there for the entire duration. Any return to the closed state resets the timed condition. Also check that the automation is enabled and that the notify action works independently with a short, immediate test.

Best Value
Sale
Anker USB C Hub, 5-in-1 USBC to HDMI Splitter with 4K Display | 85W Max PD, 1 Powered USB-C 5Gbps & 2 Powered USB-A 3.0 5Gbps Data Ports, for MacBook Pro, MacBook Air, Dell and More (Black)
  • 5-in-1 Connectivity: Equipped with a 4K HDMI port, a 5 Gbps USB-C data port, two 5 Gbps USB-A ports, and a USB C 100W PD-IN port. Note: The USB C 100W PD-IN port supports only charging and does not support data transfer devices such as headphones or speakers.
  • Powerful Pass-Through Charging: Supports up to 85W pass-through charging so you can power up your laptop while you use the hub. Note: Pass-through charging requires a charger (not included). Note: To achieve full power for iPad, we recommend using a 45W wall charger.
  • Transfer Files in Seconds: Move files to and from your laptop at speeds of up to 5 Gbps via the USB-C and USB-A data ports. Note: The USB C 5Gbps Data port does not support video output.
  • HD Display: Connect to the HDMI port to stream or mirror content to an external monitor in resolutions of up to 4K@30Hz. Note: The USB-C ports do not support video output.
  • What You Get: Anker 332 USB-C Hub (5-in-1), welcome guide, our worry-free 18-month warranty, and friendly customer service.

Alerts identify the wrong opening

Inspect the entity ID used by the trigger and the text in the message. Rename entities or messages so each opening has a distinct human-readable name. The notification target controls where the message goes; it does not determine which sensor caused the automation.

A sensor appears closed during a communication problem

Review the raw entity state rather than relying only on a dashboard label. If the state is unknown or unavailable, handle it with a diagnostic alert. Do not map either value to off in a condition intended to represent a physically closed opening.

A practical design for several doors and windows

Repeat the same two-purpose pattern for each opening: one immediate state-change alert and, where useful, one sustained-open reminder. Keep the sensor entity in the trigger and the opening’s name in the message. This makes traces readable and prevents a generic “sensor on” notification from forcing you to identify the location manually.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use different reminder intervals when normal behavior differs. A frequently used entry may need a longer grace period to avoid nuisance alerts, while a rarely opened basement window may justify a shorter reminder. The duration is a policy choice; the documented five- and ten-minute examples are starting points, not requirements.

If several people must receive the warning, add each configured Companion target explicitly and test each phone. For people who are already watching a Home Assistant dashboard, a persistent notice can supplement the push message, but it should not be described as mobile delivery.

What this setup can and cannot guarantee

These automations define how Home Assistant interprets a sensor state and how it requests a notification. They do not, by themselves, establish a guaranteed delivery time or operation during every router, internet, Home Assistant, phone, or sensor failure. The documentation supports the trigger semantics, binary-sensor states, Companion permissions, persistent-notification behavior, and actionable-notification caveat; it does not provide claims about radio range, battery life, latency, or outage resilience.

The reliable baseline is therefore explicit: verify the real entity, trigger the immediate transition to on, add a separate for-based reminder when needed, monitor unknown/unavailable independently, and test the actual phone and sensor path.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.