What do you need before you start?
- A contact sensor for the flap: any magnetic door/window sensor that Home Assistant can see will do. Zigbee models are small, run on a coin cell and report instantly. Our best smart door sensor guide compares the options.
- A way to get it into Home Assistant: a Zigbee coordinator running ZHA or Zigbee2MQTT, or a Matter or Bluetooth sensor that is already paired. See the best Zigbee hub guide and the ZHA setup guide if you have not done this yet.
- The Companion app: for phone notifications. The Home Assistant notifications guide covers setup.
- Double-sided tape and five minutes: no drilling, and nothing that needs to go inside the door itself.
Where should the sensor go on a letterbox?
Put the magnet on the inside of the flap and the sensor body on the door beside the opening, so the two separate when the flap lifts. Home Assistant reports a contact sensor as a binary_sensor, and with the opening device class "on" means open and "off" means closed (Home Assistant binary sensor docs).
Two fixes make this far more reliable. First, mount the sensor on the inside face, out of the rain and away from anyone fiddling with it. Second, if the flap is spring-loaded and bounces, add the foam spacer from the sensor's box so it closes cleanly. A flap that rests slightly ajar will leave the sensor permanently "open" and no automation can fix that.
If your letterbox has a draught-excluding brush or an internal cage, a small vibration sensor taped inside the cage is a sensible alternative. It reacts to the thud of post landing rather than the flap itself, though it can also trigger when the door is slammed.
Step 1: Name the sensor entity
Open Settings → Devices & services, find the sensor and rename its entity to something obvious such as binary_sensor.letterbox_flap. Set the Show as option to "Opening" if it came through as a generic sensor. Open and close the flap a couple of times and watch the state flip on the entity page. If nothing changes, move the magnet closer before going any further.
Step 2: Create a "post waiting" helper
Go to Settings → Devices & services → Helpers → Create helper → Toggle and call it "Post waiting". This creates input_boolean.post_waiting, a simple on/off switch Home Assistant remembers (Home Assistant input boolean docs). It lets the automation know whether you have already been told about unread post, which stops repeat alerts and lets you build a reminder later.
Step 3: Build the notification automation
The trigger is the flap changing to "on". The state trigger's for option holds the trigger back until the new state has lasted for the time you set, and if the state changes before then it does not fire (Home Assistant state trigger docs). A short for value therefore filters out a flap that is only brushed or rattled by wind, while still alerting within seconds of a real delivery.
alias: Letterbox - post arrived
mode: single
triggers:
- trigger: state
entity_id: binary_sensor.letterbox_flap
to: "on"
for:
seconds: 2
conditions:
- condition: time
after: "06:00:00"
before: "21:30:00"
actions:
- action: input_boolean.turn_on
target:
entity_id: input_boolean.post_waiting
- action: notify.mobile_app_your_phone
data:
title: "Post has arrived"
message: "Something came through the letterbox."
data:
tag: letterbox-post
group: letterbox
- delay: "00:01:00"
Replace notify.mobile_app_your_phone with your own device's notify action. The tag value means any later notification with the same tag replaces the earlier one instead of stacking, and the same tag can be used to clear it (Home Assistant Companion notification docs).
The one-minute delay at the end is deliberate. With mode: single, extra triggers that arrive while the automation is still running are ignored, so a handful of leaflets pushed through one after another produces a single alert (Home Assistant automation modes). The time condition keeps it quiet overnight, which suits a flap that someone might push open at 2am.
Step 4: Clear the alert when you collect the post
A notification that never goes away is just noise. Add a second automation that turns the helper off and removes the phone alert when you open the front door, using whichever contact sensor or lock entity you already have on it. Our garage door left open guide shows a similar open/closed pattern you can borrow.
alias: Letterbox - post collected
triggers:
- trigger: state
entity_id: binary_sensor.front_door
to: "on"
conditions:
- condition: state
entity_id: input_boolean.post_waiting
state: "on"
actions:
- action: input_boolean.turn_off
target:
entity_id: input_boolean.post_waiting
- action: notify.mobile_app_your_phone
data:
message: clear_notification
data:
tag: letterbox-post
No door sensor? Add a button to your dashboard that turns the helper off, or use a notification action so you can tap "Collected" on the alert itself. One caveat: opening the front door to leave for work will also clear the alert, so if that matters to you, only run the clearing automation when you are at home.
Step 5: Test it properly
Open the flap and hold it for three seconds. You should receive one notification and see the helper turn on. Close it, open it again within the minute, and confirm nothing new arrives. Then open the front door and check the alert disappears and the helper switches off. Finally, open Settings → Automations, choose the automation and read its Traces tab, which shows exactly which condition stopped a run if it did not behave as expected.
Why am I not getting a notification?
The sensor never changes state: the magnet is too far away or on the wrong side. Reposition it so the two parts are almost touching when the flap is closed, and check the entity page rather than the automation first.
Alerts arrive overnight or not at all in the daytime: check the time condition. Times in the condition use your Home Assistant time zone, so confirm it under Settings → System → General.
Unavailable after a few weeks: usually a flat coin cell or a weak Zigbee link. Set up the low battery alerts so you hear about it before post goes unnoticed.
The flap stays "on": it is resting open. Fit the spacer, or move the sensor so the closed gap is fractionally tighter.
Can you remind yourself if post is left sitting there?
Yes. Because the helper stays on until you collect the post, a third automation can run at, say, 18:00 with a state condition on input_boolean.post_waiting and send a gentle reminder. This is the main reason to use a helper rather than a bare trigger. It also helps with households where someone else is home: one person collects the post and the alert disappears for everyone.







