Active Deterrent Sound & Light Alarm API
Viewtron AI security cameras with active deterrent features include built-in sirens, red and blue strobe lights, and two-way audio speakers that can be controlled via the HTTP API. Unlike webhook-based detections where the camera pushes events to your server, active deterrent control uses outbound API calls — your application sends HTTP requests to the camera to trigger or configure audio and light alarms.
The real power of active deterrent API control comes from combining it with AI detection webhooks. You can build a fully automated deterrence system: receive a human detection or intrusion webhook, verify the event in your application logic, then immediately trigger the camera's siren and strobe lights via API call — all running on local hardware with no cloud dependency. All Viewtron IP cameras and NVRs are NDAA compliant.
What You Can Build
- Automated intruder deterrence — detect a person via intrusion detection webhook, then trigger siren and strobe lights on the same camera
- Scheduled siren tests — periodically test active deterrent hardware via API to confirm operation
- Multi-camera deterrence chain — detect intrusion on one camera, trigger alarms on multiple cameras in the area
- Alarm panel integration — connect camera deterrent features to existing alarm and building management systems
- Progressive response — start with white light, escalate to red/blue strobe, then activate siren based on dwell time
- Two-way audio warnings — combine with audio alarm configuration for speaker-based verbal warnings
How It Works
- Verify camera supports active deterrent — not all models have sirens and strobe lights (check product specs)
- Read current configuration — use
GetAudioAlarmOutConfigandGetWhiteLightAlarmOutConfigto see available settings - Receive a detection webhook — your server receives an intrusion, line crossing, or other AI detection event
- Evaluate the event — check target type, confidence, time of day, or other criteria in your application logic
- Trigger deterrent via API — send HTTP requests to the camera to activate siren, strobe, or both
- Reset after timeout — deactivate the deterrent after a configurable period
Active Deterrent Endpoints
| Endpoint | Purpose | Version |
|---|---|---|
GetAudioAlarmOutConfig | Read siren/audio alarm configuration | v2.0 only |
GetWhiteLightAlarmOutConfig | Read white light/strobe alarm configuration | v2.0 only |
These endpoints are read-only configuration commands documented in API v2.0. Direct triggering of siren and strobe outputs works through the alarm output relay system or by combining detection rules with alarm actions configured on the camera. The ManualAlarmOut endpoint can also be used to trigger the relay output which may be wired to external sirens or lights.
Combining Detection Webhooks with Deterrent API Calls
The most common use case is an event-driven pipeline:
Camera detects person → Webhook POST to your server → Your logic decides →
API call back to camera → Siren/strobe activates
This requires two types of API interaction:
- Inbound webhooks (camera pushes to your server) — detection events with images
- Outbound API calls (your server sends to camera) — trigger alarm outputs
Parsing Detection Events and Triggering Deterrents
- Python SDK
- Node.js SDK
- NVR XML (v2.0)
- IPC XML (v1.x)
The simplest way to receive detection events and trigger deterrents. The SDK's ViewtronServer handles incoming webhooks while ViewtronCamera sends outbound alarm commands:
pip install viewtron
from viewtron import ViewtronServer, ViewtronCamera
import os
import threading
IMG_DIR = "images"
os.makedirs(IMG_DIR, exist_ok=True)
# Camera credentials for outbound API calls
camera = ViewtronCamera("192.168.0.55", "admin", "password")
ALARM_DURATION = 10
def on_event(event, client_ip):
if event.category != "intrusion":
return
print(f"Intrusion detected from {client_ip} — triggering deterrent")
print(f" Type: {event.get_alarm_description()}")
overview = event.get_source_image_bytes()
if overview:
with open(f"{IMG_DIR}/{event.get_time_stamp()}-deterrent-overview.jpg", "wb") as f:
f.write(overview)
# Trigger alarm relay on camera
camera.set_alarm_out(True)
threading.Timer(ALARM_DURATION, lambda: camera.set_alarm_out(False)).start()
server = ViewtronServer(port=5002, on_event=on_event)
server.serve_forever()
See the Python SDK reference for the full list of methods and event classes.
npm install viewtron-sdk
const { ViewtronServer, ViewtronCamera } = require('viewtron-sdk');
const fs = require('fs');
fs.mkdirSync('images', { recursive: true });
const camera = new ViewtronCamera('192.168.0.55', 'admin', 'password');
const ALARM_DURATION = 10000; // ms
const server = new ViewtronServer({ port: 5002 });
server.on('event', (event, clientIP) => {
if (event.category !== 'intrusion') return;
console.log(`Intrusion detected from ${clientIP} — triggering deterrent`);
console.log(` Type: ${event.eventType} (${event.targetType})`);
if (event.sourceImageBytes) {
fs.writeFileSync(
`images/${Date.now()}-deterrent-overview.jpg`,
event.sourceImageBytes
);
}
// Trigger alarm relay on camera
camera.setAlarmOut(true);
setTimeout(() => camera.setAlarmOut(false), ALARM_DURATION);
});
server.start();
Active deterrent is typically triggered by intrusion events. The NVR v2.0 regionIntrusion format provides the detection data:
<?xml version="1.0" encoding="UTF-8"?>
<config version="2.0.0" xmlns="http://www.ipc.com/ver10">
<messageType>alarmData</messageType>
<deviceInfo>
<deviceName><![CDATA[Front Door]]></deviceName>
<ip><![CDATA[192.168.0.55]]></ip>
<mac><![CDATA[58:5B:69:40:F4:0D]]></mac>
<channelId>1</channelId>
</deviceInfo>
<smartType>regionIntrusion</smartType>
<currentTime>1772056914604000</currentTime>
<eventInfo>
<item>
<eventId>916</eventId>
<targetId>716</targetId>
<boundary>area</boundary>
<pointGroup>
<item><x>1590</x><y>3080</y></item>
<item><x>4715</x><y>3181</y></item>
<item><x>4772</x><y>9217</y></item>
<item><x>416</x><y>9141</y></item>
</pointGroup>
<rect><x1>3096</x1><y1>3715</y1><x2>4005</x2><y2>9861</y2></rect>
</item>
</eventInfo>
<sourceDataInfo>
<sourceBase64Length>400924</sourceBase64Length>
<sourceBase64Data>... (base64 JPEG) ...</sourceBase64Data>
</sourceDataInfo>
<targetListInfo>
<item>
<targetId>716</targetId>
<targetType>person</targetType>
<targetImageData>
<targetBase64Length>78796</targetBase64Length>
<targetBase64Data>... (base64 JPEG) ...</targetBase64Data>
</targetImageData>
</item>
</targetListInfo>
</config>
After parsing this event, your application sends a ManualAlarmOut request back to the camera to trigger the siren/strobe.
The IPC v1.x format uses PEA smartType. Your application parses this event and decides whether to trigger the deterrent:
<?xml version="1.0" encoding="UTF-8" ?>
<config version="1.7" xmlns="http://www.ipc.com/ver10">
<smartType type="openAlramObj">PEA</smartType>
<deviceName type="string"><![CDATA[FrontDoor]]></deviceName>
<currentTime type="tint64">1774792701902505</currentTime>
<perimeter>
<perInfo type="list" count="1">
<item>
<eventId type="uint32">2357</eventId>
<targetId type="uint32">2157</targetId>
<status type="perStatus">SMART_START</status>
<boundary type="list" count="4">
<item><point><x type="uint32">450</x><y type="uint32">466</y></point></item>
<!-- additional polygon points -->
</boundary>
<rect>
<x1 type="uint32">4403</x1><y1 type="uint32">694</y1>
<x2 type="uint32">5909</x2><y2 type="uint32">8125</y2>
</rect>
</item>
</perInfo>
</perimeter>
<!-- sourceDataInfo and listInfo with base64 images -->
</config>
On IPC cameras, the firmware forcibly resets the alarm output when a perimeter alarm cycle ends, even when alarm output mode is set to manual_alarm and triggerAlarmOut is unchecked. This makes ManualAlarmOut unreliable for automation while perimeter detection is active on the same camera. NVR alarm outputs are not affected by this bug.
Relevant API Endpoints
| Endpoint | Purpose | Reference |
|---|---|---|
| GetAudioAlarmOutConfig | Read audio/siren alarm configuration (v2.0) | Sound & Light Config |
| GetWhiteLightAlarmOutConfig | Read white light/strobe alarm configuration (v2.0) | Sound & Light Config |
| ManualAlarmOut | Trigger or release alarm relay output | Alarm Input/Output Config |
| GetAlarmOutConfig | Read alarm output relay configuration | Alarm Input/Output Config |
| SetHttpPostConfig | Configure webhook destination for detection events | Webhook Config |
Integrations
Viewtron active deterrent cameras also integrate with automation platforms via published packages:
| Platform | Package | What It Does |
|---|---|---|
| Home Assistant | viewtron-home-assistant | Detection events as native HA sensors — trigger deterrents via HA automations |
| Node-RED | node-red-contrib-viewtron | Detection events direct to Node-RED flows — build deterrent logic visually |
Related Applications
- Human Detection & Intrusion — intrusion detection events that trigger deterrence
- Perimeter Security & Line Crossing — line crossing events for boundary-based deterrence
- Relay Control & IoT Automation — relay output control for external siren and lighting systems
- Loitering Detection — escalated deterrence for prolonged presence
Related Products
- Viewtron AI Security Cameras — IP cameras with built-in active deterrent features (red/blue strobe, siren, two-way audio)
- Viewtron IP Camera NVRs — NVRs with alarm relay outputs and HTTP POST event forwarding
Questions & Development Inquiries
- Email: mike@viewtron.com
- Phone: 561-433-8488
- Forum: NVR Webhook Setup Guide
Mike Haldas is available for questions, consultation, and custom software development for Viewtron API related projects. Email details about your project to mike@viewtron.com.