Viewtron Security Camera Alarm API for Systems Integration
The virtual alarm and webhook API integration capability of Viewtron IP camera NVRs provide a simple and powerful way to integrate IoT (Internet of things) with your security camera system. The Viewtron API uses HTTP Posts to communicate with the NVR. Watch the above video to see a how I created wireless alarm button using an Arduino board to demonstrate this.
This is how it works.
Viewtron NVR Virtual Alarm Function
Viewtron NVRs now support a feature called “virtual alarm”. It’s functionality is similar to the physical alarm inputs on the back of Viewtron NVRs, except virtual alarms can be triggered from IoT devices over an IP network. The devices that trigger virtual alarms are not hard wired to the alarm panel on the back in the NVR. They send an HTTP Post to a webhook endpoint on the Viewtron NVR. A webhook endpoint is simple a URL that gets sent some data to let the NVR know the alarm was virtually triggered.
This is how it is setup on the NVR.
Enable API Server on NVR
Click on the Start button in the lower left, then click on Settings.
Click on the Port link in the Network settings section of the main settings menu.
On the Network Port settings screen, check the Enable checkbox in the API Server section. You can leave the Authentication type as Basic. Click Apply on the bottom of the screen.
Configure Virtual Alarm on NVR
To configure the Virtual Alarm on the Viewtron NVR, do the following.
- Click on the AI / Event link on the top menu.
- Click on the Sensor link on the side menu.
- Locate the virtual alarm that you want to configure. The virtual alarms are below the local physical alarms on this screen. If this is the first virtual alarm that you are configuring, use Virtual-1.
You can configure the following fields and alarm actions.
- Alarm Name: The NVR will use this name to report alarm activations to you. For example, when you receive a mobile push notification. I names my virtual alarm “Panic Button” for my Arduino project.
- Schedule: You can select a time schedule that you want the virtual alarm to be active.
- Type: This field is not applicable. Virtual alarms are always NO (normally open).
- Enable: Set to On.
- Duration: The length of time that you want the alarm to be active when it is triggered.
- Record: You can select one or more security cameras to begin recording when the virtual alarm is triggered. All of the events will be bookmarked even if you also record video surveillance footage continuously.
- Snapshot: You can configure one or more security cameras to capture a snapshot image and save it to it’s local SD card (if you have one installed).
- Audio: This is for future use with IP speakers.
To see the rest of the virtual alarm settings can be accessed by sliding the screen using the bottom scroll bar.
- Push: Sets mobile app push notifications On / Off.
- Alarm-Out: Trigger one or more physical alarm devices that are connected to the alarm relay output ports on the Viewtron NVR. You can also trigger an alarm output on any other IP camera that is connected to the NVR (if it has an alarm relay output port).
- Preset: If you are using any PTZ cameras on your system, can may configure the PTZ camera to pan tilt zoom to a preset location when the virtual alarm is activated.
- Buzzer: This is the audio buzzer alarm built into the NVR.
- Pop-up Video: Set a certain security camera to pop-up on the live view of the NVR.
- Pop-up Message Box: Setup a custom message to appear on the NVR.
- E-mail: Send an email. Note: I do not recommend using email alerts because you need access to an SMTP mail server. Mobile app push notifications are a much better solution for real time alarm alerts.
When you are done configuring the virtual alarm, click on the Apply button in the lower right of the screen. You can then close the NVRs settings by clicking on the X in the upper right.
Trigger Alarm via Viewtron Security Camera API
Viewtron DVRs, NVRs, and IP cameras have a software development API available to integrate Viewtron security camera systems with third party alarm devices, IoTs, and computers. It is a HTTP Post API, also known as webhooks. The webhook endpoint to trigger the virtual alarms is as follows.
http://your_nvr_ip_address/TriggerVirtualAlarm/17
In the above example, “your_nvr_ip_address” would be replaced with the actual IP address of your NVR and the #17 on the end of the URL would be replaces with the virtual alarm number that you are accessing. On a 16 channel Viewtron NVR, there are 16 physical alarm ports. So, virtual alarm #1 is designated as alarm #17.
The HTTP Post also must send an XML document. It looks like this.
<config version=”2.0.0″ xmlns=”http://www.Sample.ipc.com/ver10″><action><status>true</status></action></config>
You must also send in the userid and password for basic authentication in the HTTP Header. You can see code examples below.
Simple Python App to Trigger Virtual Alarm
I wrote a very simple Python application that developers can use as an example on how to integrate with the virtual alarm on the NVR. I uploaded the Python script to Github here.
https://github.com/mikehaldas/Arduino-Alarm-Button/blob/main/viewtron_alarm_sample.py
Arduino Alarm Button Project
Here is the source code for the Arduino project that I created to demonstrate the Viewtron security camera alarm API.
https://github.com/mikehaldas/Arduino-Alarm-Button
Viewtron IP Camera NVRs
The Viewtron software development API and virtual alarm webhook is available on all Viewtron NVRs.
AI Security Cameras
I highly recommend using our Viewtron AI security cameras with Viewtron NVRs.
You can watch all of our Viewtron AI camera video demos here.
Have Questions / Need Help?
If you have any questions or need help designing a security camera system for home, business, or government, please email me anytime at mike@viewtron.com.












