ONVIF to KNX Integration: Triggering Automation from Camera Events
ONVIF Profile T cameras publish motion detection, line crossing and object detection events via a standardised event service. Bridging these events to KNX group addresses enables camera-triggered building automation — entrance lighting on doorbell detection, DALI scene changes on perimeter breach, alarm horn activation — without relay wiring or proprietary APIs.
Use case overview
The three most common ONVIF-to-KNX automation scenarios in smart buildings and secure facilities are direct event bridging without relay hardware:
Entrance lighting on arrival
Trigger: Doorbell camera detects person approaching
KNX action: KNX DALI scene 3 (entrance 100%, warm white) — auto-off after 5 min via staircase timer
Perimeter breach alarm
Trigger: Outdoor camera line-crossing event (north fence zone)
KNX action: KNX binary output → alarm horn 30s + DALI exterior flood lights to 100% + BewO email alert
Car park presence detection
Trigger: ONVIF motion event from overhead parking camera
KNX action: KNX DALI zone 4 (car park) dim from 20% standby to 100% for 10 min
ONVIF-to-KNX is a software bridge — no relay wiring, no hardware modification to the camera required. The camera needs Profile T or Profile M certification for standardised event delivery. Profile S cameras have no standardised event service and require manufacturer-specific APIs instead.
ONVIF Profile T event service
Profile T mandates implementation of the ONVIF Event Service with two delivery mechanisms: pull-point subscription (polling) and the newer EventBroker (push via MQTT, introduced in ONVIF specification release 21.12).
| Mechanism | Protocol | How it works | Min latency |
|---|---|---|---|
| PullMessages | SOAP/HTTP polling | Client creates pull-point subscription, then calls PullMessages at intervals — camera returns queued events on each call | = poll interval (min 500ms) |
| WS-BaseNotification | SOAP/HTTP push | Camera pushes Notify message to client HTTP endpoint when event fires — requires client to expose HTTP server | ~100ms (push, no poll delay) |
| EventBroker (MQTT) | MQTT 3.1.1/5.0 (21.12+) | Camera publishes ONVIF events to external MQTT broker on topic pattern onvif/events/<topic>. Client subscribes. Broker decouples camera from KNX bridge | ~50ms (MQTT broker latency) |
The ONVIF event topic for motion detection is tns1:VideoAnalytics/tnsaxis:MotionDetection on Axis cameras and tns1:RuleEngine/CellMotionDetector/Motion on Hikvision. Topic paths vary by manufacturer even within Profile T — always query GetEventProperties on the specific device to enumerate available topics.
Method 1: Home Assistant ONVIF + KNX integration
Home Assistant provides a native ONVIF integration and a native KNX integration. Running both integrations in the same HA instance allows ONVIF camera events to trigger KNX group address writes via HA automations — no custom code required.
Home Assistant configuration.yaml — ONVIF + KNX automation
# configuration.yaml
knx:
# KNX/IP interface on the network
tunneling:
host: 192.168.1.10 # KNX/IP gateway IP (e.g. MDT SCN-IP000.03)
port: 3671
# ONVIF camera added via UI: Settings → Devices → Add Integration → ONVIF
# HA creates binary_sensor.camera_entrance_motion automatically
# automations.yaml
- alias: "ONVIF Entrance Motion → KNX DALI Scene 3"
trigger:
- platform: state
entity_id: binary_sensor.camera_entrance_motion
to: "on"
action:
- service: knx.send
data:
address: "3/0/3" # DALI scene GA — scene 3 (entrance full)
payload: 3 # DPT 5.001 scene number
response: false
- service: knx.send
data:
address: "3/0/10" # DALI brightness GA
payload: 255 # 100% brightness
response: false
- alias: "ONVIF Motion OFF → KNX DALI return to standby (5 min)"
trigger:
- platform: state
entity_id: binary_sensor.camera_entrance_motion
to: "off"
for: "00:05:00"
action:
- service: knx.send
data:
address: "3/0/10"
payload: 77 # 30% brightness (standby)Home Assistant ONVIF integration uses WS-BaseNotification push by default on supported cameras, falling back to PullMessages polling (default 10-second interval). For sub-second KNX response, set the ONVIF integration scan interval to 1s or use a camera that supports EventBroker MQTT so HA can subscribe via the MQTT integration.
Method 2: NVR with native KNX output
Enterprise VMS platforms support KNX integration via dedicated plugins, enabling direct event-to-KNX forwarding without a separate middleware server.
Milestone XProtect + KNX plugin
Milestone XProtect Corporate and Expert support third-party integrations via the MIP SDK. The KNX MIP plugin (available from Milestone Marketplace) maps XProtect alarm events to KNX group address writes via a KNX/IP gateway. Supports DPT 1.001 trigger telegrams and scene recall commands.
XProtect Management Client → Rules and Events → Add Rule → Alarm fired → Execute Command → KNX plugin → write GA 3/0/3 = 3 (scene recall)
Genetec Security Center + KNX connector
Genetec Security Center 5.10+ supports custom event connectors. The KNX connector for Genetec (available from certified Genetec integrators) maps Security Center event categories to KNX group address telegrams. Supports video analytics events, access denied events, and alarm acknowledgement.
Genetec Config Tool → System → General Settings → Extensions → Add KNX Connector → configure GA mapping table per event type
Method 3: Ajax Systems with ONVIF camera feed
Ajax Hub 2 Plus supports ONVIF camera integration directly — up to 25 IP cameras per hub in the Ajax app. Ajax can receive ONVIF motion events from connected cameras and forward them as Ajax alarm events. If the Ajax system is connected to a KNX system via the Integreat or IQ Home gateway, Ajax alarms translate to KNX telegrams.
Ajax Hub 2 Plus — ONVIF camera chain to KNX
- Add ONVIF camera to Ajax Hub 2 Plus in Ajax PRO app (Camera menu → + → ONVIF)
- Enable motion detection alerts on the camera channel in Ajax
- Ajax Hub fires alarm event when camera motion is detected
- Ajax system connected to Integreat gateway (RS-485 or IP) → KNX group address write on alarm
- KNX logic module reacts: DALI scene, horn output, BewO notification
Python integration: onvif-zeep + xknx
For custom deployments, a Python script using the onvif-zeep library (ONVIF SOAP client) and xknx (KNX/IP Python library) provides a direct bridge with full control over event filtering and KNX telegram construction.
Python — ONVIF motion event to KNX telegram
import asyncio
from onvif import ONVIFCamera
from xknx import XKNX
from xknx.dpt import DPTBinary
CAMERA_IP = "192.168.1.64"
CAMERA_PORT = 80
CAMERA_USER = "admin"
CAMERA_PASS = "yourpassword"
KNX_GATEWAY_IP = "192.168.1.10"
KNX_MOTION_GA = "8/0/1" # Motion alarm group address (DPT 1.001)
KNX_SCENE_GA = "3/0/3" # DALI scene recall GA
async def main():
# Connect to ONVIF camera
cam = ONVIFCamera(CAMERA_IP, CAMERA_PORT, CAMERA_USER, CAMERA_PASS)
await cam.update_xaddrs()
events_service = cam.create_events_service()
# Create pull-point subscription
pullpoint = await events_service.CreatePullPointSubscription()
manager = cam.create_pullpoint_service(pullpoint)
# Connect to KNX/IP gateway
xknx = XKNX(address_format="3/3/4")
xknx.knx_ip_interface.gateway_ip = KNX_GATEWAY_IP
await xknx.start()
print(f"Polling ONVIF events from {CAMERA_IP}...")
while True:
try:
messages = await manager.PullMessages({
"MessageLimit": 100,
"Timeout": "PT1S", # 1-second long-poll timeout
})
for msg in messages.NotificationMessage or []:
topic = str(msg.Topic._value_1)
# Filter for motion detection topic
if "MotionDetection" in topic or "CellMotionDetector" in topic:
data = msg.Message._value_1.Data
simple_items = data.SimpleItem or []
for item in simple_items:
if item.Name in ("IsMotion", "State", "Value"):
is_active = str(item.Value).lower() in ("true", "1")
# Send KNX telegram
await xknx.telegrams.put(
xknx.telegram_queue.telegram_received_cb
)
# Write DPT 1.001 to motion alarm GA
from xknx.telegram import Telegram, TelegramDirection
from xknx.telegram.address import GroupAddress
t = Telegram(
destination_address=GroupAddress(KNX_MOTION_GA),
payload=DPTBinary(1 if is_active else 0),
)
await xknx.telegrams.put(t)
print(f"KNX {KNX_MOTION_GA} = {1 if is_active else 0}")
except Exception as e:
print(f"Poll error: {e}")
await asyncio.sleep(2)
asyncio.run(main())Install dependencies: pip install onvif-zeep xknx. The onvif-zeep library uses the official ONVIF WSDL files — download them once withpython -m onvif.generate_wsdl. Run this script as a systemd service on a Raspberry Pi 4 or small Linux server on the building automation network segment.
Latency considerations
The total latency from physical motion to KNX telegram delivery depends on the event delivery method. For security-critical automation, choose push or MQTT delivery over pull-point polling.
| Segment | PullMessages (500ms poll) | MQTT EventBroker | WS-BaseNotification push |
|---|---|---|---|
| Camera video analysis | 50–200ms | 50–200ms | 50–200ms |
| Event delivery to bridge | 0–500ms (poll interval) | ~20ms (MQTT broker) | ~30ms (HTTP push) |
| Bridge processing (Python) | ~5ms | ~5ms | ~5ms |
| KNX/IP telegram to bus | ~20ms | ~20ms | ~20ms |
| Total typical | ~600ms | ~295ms | ~255ms |
For intrusion alarm use cases, 600ms total latency is acceptable — KNX alarm horn activation within 1 second of motion detection is standard in EN 50131 Grade 2 systems. For lighting comfort automation (presence detection), 600ms is imperceptible. ONVIF-to-KNX is not suitable for life-safety fire detection — use dedicated fire alarm panels with certified interfaces for that purpose.
Need ONVIF camera events wired into your KNX building automation?
We design KNX panels with ONVIF middleware integration, Home Assistant or Python bridge deployment, and full ETS6 alarm logic — commissioned and tested on-site.
Request a quote →