Package watch: porch event to a 40-second clip, no continuous recording
The porch camera records only when the mailbox or porch contact opens, producing a 40-second clip with a 10-second pre-roll, and pushes a still to the household. Between events the camera is in a low-power state with no stream and no cloud session.
# HearthNodes recipe 27 - package watch
alias: "Safety - porch event records 40 seconds"
id: hn_safety_package_watch
description: "Mailbox or porch event -> 40 s clip with 10 s pre-roll, still pushed"
mode: queued
max_exceeded: 3
trigger:
- platform: state
entity_id: binary_sensor.mailbox_contact
to: "on"
id: mailbox
- platform: state
entity_id: binary_sensor.porch_presence
to: "on"
for: "00:00:02"
id: porch_person
variables:
camera: camera.porch
clip_seconds: 40
pre_roll_seconds: 10
nvr: sensor.nvr_free_space_gb
condition:
- condition: numeric_state
entity_id: sensor.nvr_free_space_gb
above: 5
- condition: state
entity_id: binary_sensor.porch_recording
state: "off"
- condition: state
entity_id: input_boolean.delivery_mode
state: "off"
action:
- service: camera.record
target:
entity_id: "{{ camera }}"
data:
duration: "{{ clip_seconds }}"
lookback: "{{ pre_roll_seconds }}"
filename: "/media/porch/{{ now().strftime('%Y%m%d-%H%M%S') }}.mp4"
- service: camera.snapshot
target:
entity_id: "{{ camera }}"
data:
filename: "/media/porch/last_event.jpg"
- service: notify.mobile_app_primary
data:
title: "Porch event"
message: "{{ trigger.id }} - still attached, clip on the local recorder"
data:
image: "/media/local/porch/last_event.jpg"
- service: light.turn_on
target:
entity_id: light.porch
data:
brightness_pct: 60
- delay: "00:04:00"
- service: light.turn_off
target:
entity_id: light.porch
- service: input_boolean.turn_on
target:
entity_id: input_boolean.package_waiting
# The camera is event-recorded, never continuous, and the recorder has a 14 day
# retention with no outbound route. Disk full or recorder unreachable -> recording
# is skipped rather than silently becoming a cloud subscription.
Trigger · state
binary_sensor.mailbox_contact · binary_sensor.porch_presence
Mailbox contact opens, or porch presence detects a person for more than 2 seconds.
Step-by-step
- camera.porchRecord a 40-second clip with 10 seconds of pre-roll from the camera's ring buffer, so the clip starts before the event rather than after it.
record · 40 s · pre-roll 10 s - notify.mobile_appPush a single still frame rather than the clip; a still is enough to decide whether to open the full recording.
send · still image + 'porch event' - light.porchLight the porch for 4 minutes so the clip is usable and the delivery is visible from the window.
on 60 % for 4 min - input_boolean.package_waitingSet a 'package waiting' boolean that the household can see, and clear it automatically at the end of the day.
on · cleared by someone leaving and returning, or at 22:00
Insist on pre-roll
An event clip that starts at the trigger misses the person walking up the path and often the hand placing the parcel. Ten seconds of pre-roll from a ring buffer is the difference between a useful clip and a clip of an empty porch. Only PoE or mains cameras with a buffer can do this.
Record on events, not continuously
Continuous recording of a public pavement captures your neighbours' movements all day and stores them, which is both a privacy problem and a storage problem. Event recording with a mailbox contact as the primary trigger captures the parcel and almost nothing else.
Send a still, not the clip
A push notification with a 40-second video is awkward to view on a phone and often fails on mobile data. A still frame arrives reliably and answers the only question that matters at that moment: is there a parcel on the step? The clip is there if you want it.
Hardware
| Model | Protocol | Link | Role in this chain |
|---|---|---|---|
| PoE porch camera with a local ring buffer | wifi |
wired | PoE for power and data; a battery camera cannot provide a 10-second pre-roll. |
| Mailbox contact sensor | zigbee |
wireless | The most reliable delivery signal available; a mailbox lid opening is a much better trigger than motion alone. |
| Local NVR on an isolated VLAN | wifi |
wired | Stores clips with a 14-day retention; nothing is uploaded and the NVR has no outbound route. |
When it fails
If the local recorder is full or unreachable, recording is skipped rather than falling back to cloud storage — a full disk should not silently become a subscription. If the mailbox contact fails, the porch presence sensor still triggers recording with a slightly shorter pre-event window, and a maintenance notification names the failed contact.