Skip to main content

Trigger Sensors

The security camera supports modular trigger sensors that automatically start recording when activated. The system is designed so you can swap hardware - a magnetic reed switch, vibration sensor, light gate, or any of the supported modules - without changing any code. Configuration is done entirely through the web dashboard or the REST API.

How it works

The recording trigger flow is:

  1. Sensor fires (door opens, motion detected, vibration felt, etc.)
  2. Presence check - are any tracked Bluetooth or WiFi devices nearby?
  3. If nobody is home - recording starts automatically
  4. If someone is home - the trigger is ignored (you're home, no need to record)
  5. Sensor releases - after a configurable hold timeout, recording stops
note

Manual recording from the dashboard is always allowed, regardless of sensor state or presence detection. The presence gate only applies to automatic sensor-triggered recording.

Sensor states

The dashboard shows the current sensor state with a colour-coded indicator:

StateColourMeaning
Armed● GreenSensor is active and monitoring. No trigger event right now.
Triggered● RedSensor fired and recording has started (nobody home).
Suppressed● YellowSensor fired, but a tracked device is present - trigger ignored.
Idle● GreySensor is configured but auto-recording is toggled off.
Disabled● GreyNo sensor configured or sensor stopped.

The Suppressed state is the key distinction: it tells you the sensor is working (it detected something) but the system decided not to record because someone is home. This prevents false alarms when you walk past your own camera.

Supported sensors

All sensors below use the digital output (DO) pin and work with 3.3V logic. GPIO pins are configurable from the dashboard - the defaults listed here are suggestions to avoid conflicts. See the wiring guides for detailed pin connections and tips for each sensor.

TypeModuleDefault GPIOUse Case
Reed SwitchKY-025GPIO 22Door / window open detection
Mini Reed SwitchKY-021GPIO 20Same as above, smaller form factor
Hall MagneticKY-003GPIO 13Door / window detection (no moving parts)
Hall Magnetic (Linear)KY-024GPIO 12Door / window detection (adjustable threshold)
PIR MotionHC-SR501GPIO 17Motion detection in a room
Vibration / ShockKY-002GPIO 5Impact, door slam, forced entry
Knock / TapKY-031GPIO 19Knocking on door, tapping on window
Light GateKY-010GPIO 6Alarm when pin/bolt is pulled from slot
IR ProximityKY-032GPIO 24Detect someone approaching (~2-40 cm)
Tilt SwitchKY-017GPIO 26Camera tamper detection
Tilt Switch (Ball)KY-020GPIO 25Camera tamper detection (ball variant)
Touch SensorKY-036GPIO 16Touching camera housing or door handle
Sound (Big)KY-037GPIO 23Glass breaking, loud noise detection
Sound (Small)KY-038GPIO 8Nearby sound detection (less sensitive)
ButtonKY-004GPIO 27Manual hardware trigger / testing
MockSoftware only-Development and testing without hardware

Sensor modules

Reed Switch

Reed Switch
KY-025

Mini Reed

Mini Reed
KY-021

Hall Magnetic

Hall Magnetic
KY-003

Hall Linear

Hall Linear
KY-024

PIR Motion

PIR Motion
HC-SR501

Vibration

Vibration
KY-002

Knock / Tap

Knock / Tap
KY-031

Light Gate

Light Gate
KY-010

IR Proximity

IR Proximity
KY-032

Tilt Switch

Tilt Switch
KY-017

Tilt (Ball)

Tilt (Ball)
KY-020

Touch Sensor

Touch Sensor
KY-036

Sound (Big)

Sound (Big)
KY-037

Sound (Small)

Sound (Small)
KY-038

Button

Button
KY-004

Configuration

Via the dashboard

  1. Go to Settings in the web dashboard
  2. Scroll to the Trigger Sensors section
  3. Select your sensor type - each card shows the module name, use case, and an expandable wiring guide
  4. Set the GPIO pin (if applicable)
  5. Set the hold timeout (seconds to keep recording after release)
  6. Adjust calibration if the sensor supports it (PIR sensitivity, vibration thresholds, etc.)
  7. Click Save Configuration
  8. Toggle Auto-recording on

You can also configure sensors via the REST API or by editing client/settings/settings.json directly.

Hold timeout

The hold_seconds setting controls how long recording continues after the sensor releases. This prevents recording gaps from:

  • A door bouncing open and closed
  • Brief gaps between motion events
  • Repeated vibration or knock pulses

Set to 0 to stop recording immediately on release. The default is 10 seconds.

tip

For pulse-based sensors (KY-002 vibration, KY-031 knock), set a longer hold timeout (15-30 seconds) since each event is a brief pulse rather than a sustained state change.

Invert trigger logic

The Invert trigger toggle swaps what GPIO state means "triggered". Use this when your sensor's wiring results in the opposite logic from what you expect - e.g. if the reed switch reads LOW when the door is closed instead of when it's open.

Next steps