Python SDK for Viewtron IP camera API — parse inbound alarm events and control cameras
Project description
Viewtron Python SDK
Python SDK for Viewtron IP camera API. Parse inbound alarm events and control cameras programmatically.
Viewtron IP cameras run AI detection on-camera (license plate recognition, face detection, human/vehicle detection) and send HTTP POST events to your server. This SDK parses those events and provides an API client for camera control.
Install
pip install viewtron
Inbound Events — Parse Camera Alarm Data
Viewtron cameras and NVRs send XML alarm events via HTTP POST. This SDK parses them into Python objects.
from viewtron import LPR, FaceDetection, IntrusionDetection
# In your HTTP server's POST handler:
lpr_event = LPR(request_body)
print(lpr_event.get_plate_number()) # "ABC1234"
print(lpr_event.is_plate_authorized()) # True (plate is on camera whitelist)
# Images are included as base64
if lpr_event.source_image_exists():
overview = lpr_event.get_source_image() # base64 JPEG — full scene
if lpr_event.target_image_exists():
plate_crop = lpr_event.get_target_image() # base64 JPEG — plate closeup
Supported Event Types
| Source | Class | Detection |
|---|---|---|
| IPC v1.x | LPR |
License plate recognition with whitelist/blacklist |
| IPC v1.x | FaceDetection |
Face detection with crop image |
| IPC v1.x | IntrusionDetection |
Perimeter intrusion (person/vehicle) |
| IPC v1.x | IntrusionEntry |
Zone entry |
| IPC v1.x | IntrusionExit |
Zone exit |
| IPC v1.x | LoiteringDetection |
Loitering |
| IPC v1.x | VideoMetadata |
Continuous object detection |
| NVR v2.0 | VehicleLPR |
LPR with vehicle brand/color/type |
| NVR v2.0 | FaceDetectionV2 |
Face detection with age/sex/glasses/mask |
| NVR v2.0 | RegionIntrusion |
Perimeter intrusion |
| NVR v2.0 | LineCrossing |
Tripwire line crossing |
| NVR v2.0 | TargetCountingByLine |
People/vehicle counting by line |
| NVR v2.0 | TargetCountingByArea |
People/vehicle counting by area |
| NVR v2.0 | VideoMetadataV2 |
Continuous object detection |
Version detection is automatic — IPC v1.x and NVR v2.0 use different XML structures but the SDK handles both.
Outbound API — Control the Camera
from viewtron import ViewtronCamera
camera = ViewtronCamera("192.168.0.20", "admin", "password")
camera.login()
# Device info
info = camera.get_device_info()
print(info["model"]) # "LPR-IP4"
# Manage the license plate whitelist/blacklist
plates = camera.get_plates()
camera.add_plate("ABC1234", owner="Mike", list_type="whiteList")
camera.delete_plate(key_id=1775415327)
camera.logout()
# Or use as context manager
with ViewtronCamera("192.168.0.20", "admin", "password") as cam:
plates = cam.get_plates()
Projects Using This SDK
- Viewtron Home Assistant Integration — Camera events as HA sensors via MQTT auto-discovery
- IP Camera API Server — Alarm server with CSV logging and image saving
Documentation
Products
Author
Mike Haldas — CCTV Camera Pros mike@cctvcamerapros.net
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file viewtron-1.1.0.tar.gz.
File metadata
- Download URL: viewtron-1.1.0.tar.gz
- Upload date:
- Size: 12.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
696c8c99badee01b0efb34f474b004aecba5814de342fb05e6630e8d3bd7d31e
|
|
| MD5 |
47ecbabc227523c7045ee84b7f02c64e
|
|
| BLAKE2b-256 |
852e71808ecdb83b79f28a512623469f9752bbd79d86338bac7e9ca73ce305fa
|
File details
Details for the file viewtron-1.1.0-py3-none-any.whl.
File metadata
- Download URL: viewtron-1.1.0-py3-none-any.whl
- Upload date:
- Size: 11.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9c4af360b8a6ae68e72794704115bd53a6b72e25102b8a177b2e05f14b58d288
|
|
| MD5 |
befc71d30b1c8da627330e94dfbb15e4
|
|
| BLAKE2b-256 |
bd4960de5ce84cc08be650e6ed53a2eb9043d6a171b8c6cfb8e63f2b62dacd41
|