LPR Camera API for Software Development Integration and Apps
Viewtron LPR cameras have an API interface for software developers to create custom home automations, access control system integrations, and 3rd party applications development. The LPR camera API posts an XML document to a server’s webhook endpoint that you specify in the camera’s firmware settings, which are accessed via a web browser interface. Watch the above video to learn how to setup the LPR camera and see how it interacts with the API server when a license plate recognition event occurs. You can see a typical network diagram when the LPR is installed with a Viewtron NVR here.
Open Source Viewtron IP Camera API Server
You can download the Python API server from Github on this page. There are also step instructions on that page on how to install the server on your Linux box.
https://github.com/mikehaldas/IP-Camera-API
Viewtron LPR Camera
This is the Viewtron LPR-IP4 camera that I used in my demo. It has been thoroughly tested with the IP camera API server.
Network Setup with Viewtron NVR
If you are using a Viewtron NVR with your LPR camera, you can not connect the LPR camera to one of the PoE ports on the NVR *if you plan on accessing the LPR camera’s API from remotely over the Internet*. If you will access the LPR camera’s API on the local area network, then you may connect the LPR to one of the PoE ports on the back of the NVR.
The above diagram shows a the network setup when the LPR is not connected to the Viewtron NVR PoE port. The camera is connected to a PoE switch that is located on the same network as the computer where the Python API server is installed. Please note that you can send the API posts remotely over the Internet with this network setup if you also setup port forwarding to your API server.
If you are not using a Viewtron NVR for your application, simple remove the NVR from the above network diagram.
Locate your IP camera on your Network
If you need to locate the camera on your network, you can download the Viewtron network IP installer tool here. We have a Windows and Mac IP camera network finder / IP installer tool available for Viewtron IP cameras.
License Plate Detection Configuration
Once your camera is booted up and you know where it is on your network, follow these steps to configure the LPR software. You will configure a license plate detection zone and size range of plates.
Log into the camera by going to it’s IP address in a web browser.
Click on the Config tab in the upper right, then click on the License Plate Detection link.
On the License Plate Detection screen, do the following.
- Check Enable.
- Click on the Draw Area Button
- Draw the license plate detection zone.
- Click on the Draw Target Size button in area (2) then enter the min and max sizes for plates. These do not need to be exact. The min sizes should be slightly smaller than the realistic size of a license plate. The max sizes should be slightly larger. DO NOT try make the sizes exact. Give an adequate buffer. Ideally have someone hold up a license plate or park a car in the detection zone to assist you.
Click Save when done.
License Plate Database Setup (optional)
This section is optional. If you want to use the LPR cameras built-in database to manage a list of “Authorized Plates”, this is how you set that up. if you do not setup a list of authorized license plates in the database, the camera still sends all of the other data in the XML post except the authorization info.
To add plates to the license plate database, click on the License Plate Detection link on the left. Then, click on the Add button. Please note that you can also click on the Bulk Entry button if you want to upload a large list of license plates using a CSV file.
On the vehicle Information screen, enter the License plate number and select “Allow list” from the list type dropdown if you want this to be an authorized plate. The rest of the information is optional. Click Save when done. Repeat this process for each license plate that you want to add to the database or use the Bulk Entry to upload a CSV list of plates.
Configure the HTTP Post webhook server
Next, click on the Network link on the left. Then, click on the HTTP POST link.
On the HTTP Post screen, click on the Edit button.
Next, click on the Add button. Then fill in the API server’s IP address, port, and path. You can also check off the type of alarms and data that you want the server to send. In my testing, I only wanted to send LPR events, so I only checked License Plate Detection in the Smart Alarm Type section. In the Smart Alarm Data, I checked all pictures and options.
When done, click the Save button.
Installing the API Server
The open source API server is written in Python. It consists of two main files.
- server.py – the main web server program
- viewtron.py – a library class that handles all of the XML parsing from the IP camera. Basically, a data abstraction layer.
I developed the server on a Ubuntu computer and have also tested it on a Raspberry Pi. It should work well on any Linux based operating system. I documented the setup instructions here on Github.
API Server Output
Here is a screenshot of what the typical output looks like when the API server is running and receiving HTTP Posts from an LPR camera.
On the above screenshot, you can see the following print outputs from the server.
- Server startup command / initial output from the startup.
- License Plate Detection event notes whether the plate is authorized or not, then saves the images of the plate and logs the event to the CSV file.
- “Keep-alive” posts are periodically sent by the camera to make sure the server is still ready to receive posts.
License Plate Image Snapshots Sent by API
Here overview snapshot image that the camera sends in the XML payload when a license plate detection event occurs..

Here is the cropped target image that the camera sends in the XML payload when a license plate detection event occurs.
Home Assistant LPR Camera Integration
We recently used the Viewtron IP camera API to integrate the LPR camera with Home Assistant via MQTT.
Here is screenshot of the MQTT sensor device screen.
Here is a screenshot of the LPR camera card added to the Home Assistant Dashboard.
Node-RED LPR Camera Integration
We recently used the Viewtron IP camera API to integrate the LPR camera with Node-RED for industrial applications and automations.
Here is a screenshot of the Viewtron AI Camera node with a Viewtron LPR camera sending events data to Node-RED.
Here is a screenshot of the overview image snapshot and cropped license plate image snapshot displayed in a Dashboard node in Node-RED.
Complete License Plate Recognition Camera Systems
Most of our customers use Viewtron LPR cameras with a Viewtron NVR and one or more overview cameras. This provides a complete LPR solution for home, business, and government installations. The team at CCTV Camera Pros has designed thousands of custom systems for customers all of the world. However, some of our customers have the need to integrate the license plate recognition functionality of just the Viewtron LPR camera with a 3rd party application. That is why we provide the API that was documented in this article.
Viewtron License Plate Recognition Video Demos
You can watch additional Viewtron license plate recognition video demos here.
Have Questions / Need Help?
If you have any questions about LPR camera applications or general questions about security camera system, please email me anytime at mike@cctvcamerapros.net.






















