Skip to main content

Node-RED IP Camera Integration

The Viewtron AI Camera node for Node-RED receives AI detection events directly from Viewtron IP cameras and Viewtron NVRs, outputting structured JSON messages. License plate recognition, human detection, vehicle detection, face detection, and people counting — all processed on the camera with no cloud service, no middleware, and no bridge required. The camera posts events directly to your Node-RED flow.

Supports both direct camera connections (IPC v1.x) and NVR forwarding (v2.0) with automatic version detection. LPR is fully tested with the Viewtron LPR-IP4 camera and NVR. Other AI event types are supported and being documented.

Viewtron AI Camera node in Node-RED with live LPR events

Install

Install from the Node-RED palette manager or the command line.

Palette Manager: Menu > Manage palette > Install > search node-red-contrib-viewtron

Command line:

cd ~/.node-red
npm install node-red-contrib-viewtron

Requires Node.js 18+ and Node-RED 2.0+. The viewtron-sdk dependency is installed automatically.

npm: node-red-contrib-viewtron

How It Works

v2.0.0 uses a Config Node + Listener Node architecture built on the Viewtron Node.js SDK:

                                    +---> Viewtron AI Camera node ---> LPR Flow
|
Camera 1 ---+ +---> Viewtron AI Camera node ---> Intrusion Flow
\ |
Camera 2 ----+---> Viewtron Server -+
/ (Config Node) |
Camera 3 ---+ port 5050 +---> Viewtron AI Camera node ---> Dashboard
|
NVR ---------+ +---> Viewtron AI Camera node ---> MQTT Bridge

Viewtron Server (config node) — runs a shared HTTP server on a single port. All cameras and NVRs connect to this one server. Handles persistent connections, keepalive heartbeats, XML parsing, and all camera protocol requirements via the SDK. Hidden from the palette; created from the server dropdown on the Viewtron AI Camera node.

Viewtron AI Camera (listener node) — receives parsed events from the server and routes them to 5 category outputs: LPR, Intrusion, Face, Counting, and Other. Multiple listener nodes can share one server. Each listener receives every event from every connected camera. Use standard Node-RED Switch nodes after any output to filter by camera, channel, plate group, or any other field.

No middleware, no bridge, no cloud API — the cameras post directly to Node-RED.

Outputs

The node has 5 outputs, one per detection category:

OutputCategoryKey Fields
1LPRplateNumber, plateGroup (raw value from camera/NVR plate database), vehicle (brand, color, type — NVR only), carOwner (NVR only)
2IntrusiontargetType (person, car, motorcycle), eventId, status, boundary (area, tripwire — NVR only)
3Faceface.age, face.sex, face.glasses, face.mask (NVR only)
4CountingtargetType, boundary
5OtherVideo metadata and unclassified events

Wire each output to the flow logic you need — separate handling for plates vs. people vs. faces.

LPR Fields (Output 1)

FieldIPCNVRDescription
plateNumberYesYesDetected license plate text
plateGroupYesYesPlate database group — see Plate Groups
plateColorNoYesPlate color (e.g., "white")
vehicle.typeNoYesVehicle type (e.g., "sedan", "SUV")
vehicle.colorNoYesVehicle color
vehicle.brandNoYesVehicle brand (e.g., "Toyota")
vehicle.modelNoYesVehicle model
carOwnerNoYesOwner name from NVR plate database
sourceImageYesYesOverview image (base64 JPEG)
sourceImageBytesYesYesOverview image (Buffer — ready for file/dashboard/MQTT nodes)
targetImageYesYesPlate crop image (base64 JPEG)
targetImageBytesYesYesPlate crop image (Buffer)

Common Fields

Every event message includes:

FieldTypeDescription
msg.payload.sourcestringIPC (direct from camera) or NVR (via NVR)
msg.payload.categorystringlpr, intrusion, face, counting, metadata
msg.payload.eventTypestringRaw alarm type from camera (e.g., VEHICE, PEA, regionIntrusion)
msg.payload.eventDescriptionstringHuman-readable description of the event type
msg.payload.cameraIpstringCamera IP (direct connection) or NVR IP (NVR connection)
msg.payload.cameraNamestringDevice name configured on the camera or NVR
msg.payload.cameraMacstringMAC address of the camera or NVR
msg.payload.channelIdstringNVR channel number (intrusion, face, counting only — not present on NVR LPR events)
msg.payload.timestampstringEvent timestamp from the camera
msg.payload.hasImagesbooleantrue when images are present
msg.topicstringviewtron/{category} for easy MQTT republishing

Images

When Original picture and Target picture are enabled on the camera, events include both base64 strings and decoded Buffer bytes:

FieldTypeDescription
sourceImagestringFull scene image as base64 JPEG
sourceImageBytesBufferFull scene image as decoded JPEG bytes
targetImagestringCropped target (plate, face) as base64 JPEG
targetImageBytesBufferCropped target as decoded JPEG bytes

The Buffer fields are ready to pipe directly to file nodes, dashboard image widgets, or MQTT nodes. The base64 fields are useful for embedding in HTML or sending via API.

Viewtron LPR camera dashboard in Node-RED

To display plate images in a Node-RED dashboard, wire the LPR output (output 1) to a ui-template node (requires Dashboard 2.0):

<div v-if="msg?.payload?.plateNumber">
<h3>{{ msg.payload.plateNumber }} — {{ msg.payload.plateGroup || "unknown" }}</h3>
</div>
<div v-if="msg?.payload?.sourceImage" style="margin-bottom:10px">
<img :src="'data:image/jpeg;base64,' + msg.payload.sourceImage" style="width:100%" />
</div>
<div v-if="msg?.payload?.targetImage">
<img :src="'data:image/jpeg;base64,' + msg.payload.targetImage" style="width:100%" />
</div>

Direct Connection vs NVR

For the easiest filtering, connect IP cameras directly to your network and configure each camera's HTTP POST to send events to the Viewtron Server. Each camera connects from its own IP address, so you can filter events using msg.payload.cameraIp in a Switch node.

When cameras are connected to an NVR's PoE ports and the NVR forwards events, all events arrive from the NVR's IP address. Intrusion, face, and counting events include a msg.payload.channelId that identifies which camera on the NVR triggered the event. However, NVR license plate events do not include a channel ID, so there is no way to determine which LPR camera behind the NVR detected the plate.

LPR Camera Connection

For LPR cameras, always connect directly to the network so each camera has its own IP address for filtering. NVR-forwarded LPR events do not include a channel ID.

IPC (Direct)NVR (Forwarded)
ConnectionCamera -> Node-REDCamera -> NVR -> Node-RED
XML Versionv1.xv2.0
Plate detectionYesYes
Plate database groupsFixed: whiteList, blackList, temporaryListUser-defined: any group name
Vehicle attributesNoYes (brand, color, type, model)
Owner from databaseNoYes
Channel IDNoYes (intrusion, face, counting only — not LPR)
ImagesYes (both)Yes (both)

Filtering by Camera

The node itself does not filter — it outputs every event from every connected camera. Use standard Node-RED Switch nodes after any output to route events.

Common filter fields:

FieldUse Case
msg.payload.cameraIpFilter by camera IP address (best for direct connections)
msg.payload.channelIdFilter by NVR channel number (intrusion, face, counting events only)
msg.payload.sourceFilter by IPC (direct) or NVR
msg.payload.plateGroupRoute LPR events by plate database group
msg.payload.targetTypeFilter by person, car, motorcycle

Example: filter LPR events from a specific camera. Wire the LPR output to a Switch node with property msg.payload.cameraIp equals 192.168.1.100.

What You Can Build

  • Gate and parking access control — use plate groups to control access: "Residents" opens the gate, "Delivery" opens during business hours, "Banned" triggers security alerts
  • Unknown vehicle alerts — send Telegram, email, or push notifications when a plate with no group (not in the database) is detected
  • Person detection lighting — trigger smart lighting when a person is detected in a zone
  • Intrusion alarms — wire to siren or alarm panel nodes when someone enters a restricted area
  • LPR dashboards — display live plate reads with images using Dashboard 2.0 template widgets
  • Vehicle counting dashboards — feed counting data to InfluxDB + Grafana for parking or traffic analytics
  • MQTT republishing — forward structured events to an MQTT broker for consumption by Home Assistant, AWS IoT, or other subscribers
  • Multi-camera routing — use Switch nodes to route events by camera IP, detection type, or plate group

Camera Setup

1. Add the Node to Your Flow

Drag the Viewtron AI Camera node from the palette onto the canvas. Select a Viewtron Server from the dropdown (or create one with the pencil icon). The default port is 5050.

2. Configure HTTP POST on the Camera

Open your camera's web interface and navigate to Network > Advanced > HTTP Notification.

Viewtron camera HTTP POST settings

Set the Push Protocol Version to V1, then click Add to create a server entry.

Push Protocol Version

The camera's HTTP POST settings have a Push Protocol Version dropdown. You must select V1. The V2 protocol sends alarm status events but images don't come through reliably.

3. Configure the Server Connection

HTTP POST server configuration

SettingValue
EnableChecked
Domain/IPYour Node-RED machine's IP address
Server PortPort configured in the Viewtron Server config node (default: 5050)
Path/API
Connection TypePersistent connection
Send HeartbeatChecked
Heartbeat Interval30 seconds
Smart Alarm DataCheck Smart event data
Original pictureCheck to include full scene image in events
Target pictureCheck to include cropped target image in events
Smart Alarm TypeSelect the detection types you want (e.g., License Plate Detection)

Click Save, then reboot the camera — required after changing HTTP POST settings. Deploy your flow in Node-RED and events will start arriving immediately.

Connection Status

The camera maintains a persistent HTTP connection and sends heartbeats to confirm the server is reachable. The node status shows a green ring when listening and updates with a green dot and the latest event data (e.g., plate number and group).

Plate Groups

The plateGroup field contains the raw value from the camera or NVR plate database. Your flow decides what each group means — this is how you implement access control policies with different actions for different groups.

IPC cameras use fixed group names (these are the raw XML values):

plateGroupCamera UI Label
whiteListAllow list
blackListBlock list
temporaryListTemporary vehicle
(empty)Not in database

NVRs use user-defined group names — you create groups and name them whatever you want (e.g., "Residents", "Delivery", "Banned", "Temporary Visitor"). The plateGroup field shows the group name, or empty if the plate is not in the database.

Access control example: A gated community could set up NVR plate groups like "Residents", "Management", and "Delivery". In Node-RED, a Switch node routes each group to a different action — residents open the main gate, delivery opens the service entrance during business hours, and unrecognized plates trigger a notification to security.

Date Range Validation

Date range validation applies to all list types — not just temporary plates. An allow list or block list plate with an expired end date will have an empty plateGroup. The camera validates dates internally.

Plates are added to the camera's database through its web interface or programmatically via the Viewtron Python SDK or the Viewtron API.

Example: LPR Gate Access

Import this flow to get started with license plate gate access control. The Viewtron AI Camera node reads plates, and a Switch node routes plates based on their group.

[
{
"id": "server1",
"type": "viewtron-server",
"name": "Camera Server",
"port": "5050"
},
{
"id": "viewtron1",
"type": "viewtron-camera",
"name": "Gate Camera",
"server": "server1",
"wires": [["switch1"], [], [], [], []]
},
{
"id": "switch1",
"type": "switch",
"name": "Check Group",
"property": "payload.plateGroup",
"rules": [
{"t": "eq", "v": "whiteList"},
{"t": "else"}
],
"outputs": 2,
"wires": [["gate_open"], ["notify"]]
},
{
"id": "gate_open",
"type": "debug",
"name": "Open Gate"
},
{
"id": "notify",
"type": "debug",
"name": "Alert: Unknown Vehicle"
}
]

Replace the debug nodes with your actual gate control and notification nodes. For NVR setups, change "whiteList" to your group name (e.g., "Residents").

Supported Event Types

IPC v1.x (Direct from Camera)

Alarm TypeCategoryDetection
VEHICE / VEHICLElprLicense plate recognition
VFDfaceFace detection
PEAintrusionPerimeter intrusion
AOIENTRYzone_entryZone entry
AOILEAVEzone_exitZone exit
LOITERloiteringLoitering detection
VSDmetadataVideo metadata
PASSLINECOUNTcountingPeople/vehicle counting

NVR v2.0 (Forwarded via NVR)

Alarm TypeCategoryDetection
vehiclelprLPR with vehicle brand, color, type, model
videoFaceDetectfaceFace with age, sex, glasses, mask attributes
regionIntrusionintrusionPerimeter intrusion
lineCrossingline_crossingTripwire line crossing
targetCountingByLinecountingCounting by line
targetCountingByAreacountingCounting by area
videoMetadatametadataContinuous object detection

Version detection is automatic — the SDK handles both formats.

Breaking Changes from v1

v2.0.0 is a full rewrite. Existing flows will need to be updated.

Changev1v2
ArchitectureSingle node with embedded HTTP serverConfig Node (Viewtron Server) + Listener Node (Viewtron AI Camera)
ServerEach node runs its own serverShared server via config node — one port for all cameras
SDKXML parsing built into the nodeUses viewtron-sdk npm package
Default port50025050
Field namessnake_case (plate_number, plate_group, car_owner, camera_ip, event_type, source_image)camelCase (plateNumber, plateGroup, carOwner, cameraIp, eventType, sourceImage)
Image BuffersNot availablesourceImageBytes and targetImageBytes (decoded Buffer objects)
source fieldNot availableIPC or NVR — identifies connection type
Image toggleincludeImages checkbox on nodeAlways included when camera sends them (enable/disable on the camera)
FilteringNot availableUse Switch nodes on cameraIp, channelId, plateGroup, targetType
Node settingsPort + Include imagesServer dropdown only (port is on the config node)

To migrate: Delete the old Viewtron AI Camera node, add a new one from the updated palette, create a Viewtron Server config node, and update any downstream nodes that reference payload field names from snake_case to camelCase.

Troubleshooting

Camera shows "Online" but no events appear: The camera's persistent connection is alive (heartbeats work) but alarm events may not be flowing. Try:

  1. Reboot the camera — required after changing HTTP POST settings
  2. Check that Smart event data and the correct Smart Alarm Type are enabled
  3. For NVR: ensure License Plate Detection is enabled in the HTTP Post settings

Port conflict ("port in use" status): Another process is already listening on the configured port. Either stop the other process or change the port in the Viewtron Server config node. Only one Viewtron Server config node should use a given port.

Debug tool: A standalone debug server is included in the GitHub repo for diagnosing connection issues:

node debug-server.js 5050

This logs every HTTP POST with full headers, body preview, and post classification (keepalive, alarm data, etc.) — no filtering. Raw XML is saved to raw_posts/ for inspection.

Node-RED vs. Home Assistant

Both integrations receive the same camera events. Choose based on your use case:

Node-REDHome Assistant
ArchitectureCamera -> Node-RED (direct)Camera -> Bridge -> MQTT -> HA
Best forCustom logic, industrial automation, dashboards, multi-system integrationSmart home automations, mobile notifications, device control
Setupnpm install, drag nodeDocker container + MQTT broker
ProgrammingVisual flow editorYAML automations or HA UI
MQTTOptional (can republish)Required

You can run both — point the camera's HTTP POST at Node-RED, then use Node-RED's MQTT output to also feed events into Home Assistant.

Compatible Cameras

Any Viewtron IP camera or NVR with HTTP POST support works with this node. Recommended models:

ModelDetection TypesBest For
LPR-IP4License plate recognitionDriveways, gates, parking entrances
AI security camerasHuman, vehicle, face detectionPerimeter security, access control
NVRsAll types (forwarded from cameras)Multi-camera systems

All Viewtron products are NDAA compliant.

Resources

Video Guides & Blog Posts

Questions & Development Inquiries

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.