BetterFrame/nodered/src/bf-trigger-motion.html
Mitchell R 82ef29a23d
feat(nodered): motion + ANPR + generic ONVIF event trigger nodes
Three new Node-RED trigger nodes in BetterFrame Triggers palette:

bf-trigger-motion (red) — fires on MotionAlarm, CellMotionDetector,
VideoAnalytics/Motion, FieldDetector topics. Outputs msg.active
(true/false) for motion start/stop. Camera ID filter optional.

bf-trigger-anpr (blue) — fires on LicensePlateRecognition, Plate,
ANPR, LPR, NumberPlate topics. Extracts msg.plate (string) and
msg.confidence (number) from vendor-specific payload fields
(Hikvision PlateNumber, Dahua plateNumber, etc.). Camera ID filter.

bf-trigger-event (green) — generic catch-all. Topic substring filter
+ camera ID filter. Outputs msg.source + msg.data as key-value objects
parsed from ONVIF SimpleItems. Use for line crossing, intrusion,
digital input, tamper, audio detection, or any unknown topic.

Server side: ONVIF events (source_type=onvif) now additionally forward
to the fixed onvif.event route so all three nodes receive events without
needing per-topic Node-RED route registration.
2026-05-23 02:17:05 +02:00

41 lines
1.5 KiB
HTML

<script type="text/javascript">
RED.nodes.registerType("bf-trigger-motion", {
category: "BetterFrame Triggers",
color: "#ff9999",
defaults: {
name: { value: "" },
camera_id: { value: "" },
},
inputs: 0,
outputs: 1,
icon: "betterframe.svg",
label: function () {
return this.name || "Motion Trigger";
},
paletteLabel: "Motion Trigger",
});
</script>
<script type="text/html" data-template-name="bf-trigger-motion">
<div class="form-row">
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
<input type="text" id="node-input-name" placeholder="(optional)" />
</div>
<div class="form-row">
<label for="node-input-camera_id"><i class="fa fa-video-camera"></i> Camera ID</label>
<input type="number" id="node-input-camera_id" placeholder="(blank = all cameras)" />
</div>
<div class="form-tips">
Fires on ONVIF motion detection events (MotionAlarm, CellMotionDetector,
VideoAnalytics/Motion, FieldDetector). Outputs <code>msg.active</code>
(true/false) for motion start/stop. Leave Camera ID blank for all cameras.
</div>
</script>
<script type="text/html" data-help-name="bf-trigger-motion">
<p>Triggers on ONVIF motion events from cameras connected via BetterFrame kiosks.</p>
<p>Matches event topics containing: MotionAlarm, CellMotionDetector,
VideoAnalytics, FieldDetector.</p>
<p><b>msg.active</b> is <code>true</code> when motion starts, <code>false</code>
when it clears. Use a switch node downstream to filter on active only.</p>
</script>