Ajax API Integration: Connecting Ajax to KNX, Home Assistant and Third-Party Systems
Ajax provides a cloud-based REST API with OAuth 2.0 authentication for partner integrations. This guide covers the API capabilities, Home Assistant HACS integration, KNX binding patterns via xknx, webhook event handling, and the limitations of the cloud-only architecture.
Ajax API overview
The Ajax API is a RESTful cloud API hosted on Ajax Systems infrastructure. All communication goes through the Ajax Cloud — there is no local API on the Hub 2 Plus itself. Authentication uses OAuth 2.0 Authorization Code flow, requiring a registered partner application in the Ajax developer portal.
The API is available to Ajax Partners (Certified Integrators and above). Consumer accounts do not have direct API access — the integration is always broker through a partner-registered application. The Home Assistant HACS integration abstracts this by using a pre-registered application token.
No local API: Ajax Hub 2 Plus does not expose a local REST or WebSocket endpoint. All API calls go to api.ajax.systems via HTTPS. This means internet connectivity is required for any third-party integration — including Home Assistant, even if it runs on the same local network as the hub.
API capabilities
| Endpoint category | Operations available | Notes |
|---|---|---|
| Hubs | List hubs, hub state (armed/disarmed) | Hub online/offline status included |
| Devices | List devices, device state, battery level | Signal strength, tamper state |
| Groups | List groups, group arm/disarm | Partition-level control |
| Arm/Disarm | POST arm, POST disarm, POST night-mode | Requires user-level auth token |
| Users | List users, manage user access | Partner admin only |
| Event stream | Webhook push events (alarm, tamper, arm) | Subscribe per-hub in portal |
| Cameras | List cameras, request snapshot | Ajax NVR and IP cam integration |
Home Assistant integration
The official Ajax Security integration for Home Assistant is available via HACS (Home Assistant Community Store). It uses the Ajax Partner API under the hood and creates standard HA entities for all Ajax devices on the connected hub.
Home Assistant Ajax integration — setup
Prerequisites: - Ajax account with hub registered - Partner API token (from Ajax PRO Desktop → API Keys) - Home Assistant 2024.1+ with HACS installed Installation: 1. HACS → Integrations → Search "Ajax Security" 2. Install integration, restart HA 3. Settings → Integrations → Add Integration → Ajax Security 4. Enter API token and select hub(s) Entities created per hub: alarm_control_panel.ajax_hub_[id] — arm/disarm/night mode binary_sensor.[device_name]_motion — PIR detectors binary_sensor.[device_name]_door — door/window contacts binary_sensor.[device_name]_glass — glass break detectors binary_sensor.[device_name]_tamper — tamper on all devices sensor.[device_name]_battery — battery level (%) sensor.[device_name]_signal — signal strength (%) Polling interval: 30 seconds (HA polls Ajax Cloud) Alarm events via webhook: real-time push (see below)
KNX integration via Home Assistant
With Ajax entities available in Home Assistant, KNX group address bindings are created using the KNX integration (xknx library). Motion triggers from Ajax detectors write DPT 1.001 telegrams to KNX group addresses; the Ajax alarm panel entity maps to a KNX general alarm group address.
configuration.yaml — Ajax motion to KNX telegram
# Home Assistant configuration.yaml (KNX integration)
knx:
tunnel:
host: 192.168.1.10 # KNX IP Interface address
port: 3671
# automations.yaml — Ajax motion detector → KNX
automation:
- alias: "Ajax MotionCam hallway → KNX lights"
trigger:
platform: state
entity_id: binary_sensor.ajax_motioncam_hallway_motion
to: "on"
action:
service: knx.send
data:
address: "3/0/5" # KNX hallway lights GA
payload: true
type: "1byte"
- alias: "Ajax MotionCam hallway OFF → KNX lights off"
trigger:
platform: state
entity_id: binary_sensor.ajax_motioncam_hallway_motion
to: "off"
for: "00:02:00" # 2-minute hold-off
action:
service: knx.send
data:
address: "3/0/5"
payload: false
type: "1byte"
- alias: "Ajax alarm → KNX general alarm"
trigger:
platform: state
entity_id: alarm_control_panel.ajax_hub_main
to: "triggered"
action:
service: knx.send
data:
address: "8/0/1" # KNX general alarm GA
payload: true
type: "1byte"Ajax + KNX scenario examples
The Ajax-HA-KNX bridge enables scenarios where physical security state drives building automation. A common pattern is arming Ajax when a "leaving" KNX scene activates, and disarming on arrival with a specific keypad code.
KNX "I'm leaving" scene → Ajax arm
# KNX "I'm leaving" button press (GA 1/0/10 = true)
# triggers HA automation → arms Ajax
automation:
- alias: "KNX leaving scene → Ajax arm away"
trigger:
platform: event
event_type: knx_event
event_data:
address: "1/0/10" # KNX leaving button GA
value: true
action:
- service: knx.send
data:
address: "3/0/0" # Lights off (all zones)
payload: false
type: "1byte"
- service: knx.send
data:
address: "4/0/0" # HVAC setback mode
payload: false
type: "1byte"
- delay: "00:00:30" # 30-second exit delay
- service: alarm_control_panel.alarm_arm_away
target:
entity_id: alarm_control_panel.ajax_hub_main
data:
code: "1234" # Master code
- alias: "Ajax armed → KNX confirmation"
trigger:
platform: state
entity_id: alarm_control_panel.ajax_hub_main
to: "armed_away"
action:
service: knx.send
data:
address: "1/0/11" # KNX armed indicator LED
payload: true
type: "1byte"Webhook events
Ajax supports webhook push events for real-time alarm notifications. Webhooks are configured in the Ajax PRO portal per hub and deliver JSON payloads to a public HTTPS endpoint. For Home Assistant, the HA webhook trigger URL is used.
Ajax webhook JSON payload — alarm event
// Ajax webhook POST body (alarm event)
{
"hubId": "HUB-XXXXXXXX",
"eventType": "ALARM",
"deviceId": "DEV-12345678",
"deviceName": "MotionCam Hallway",
"deviceType": "MotionCam",
"zoneId": 3,
"zoneName": "Ground Floor",
"timestamp": "2025-04-15T14:32:10Z",
"alarmReason": "MOTION_DETECTED"
}
// Event types:
// ALARM — motion, door open, glass break
// TAMPER — device opened or removed
// ARM — system or group armed
// DISARM — system or group disarmed
// POWER_LOSS — hub external power lost
// BATTERY_LOW — device battery below 10%
// SIGNAL_LOSS — device communication lost
// Test webhook (curl):
curl -X POST https://your-ha-instance.duckdns.org/api/webhook/ajax_test -H "Content-Type: application/json" -d '{"eventType":"ALARM","deviceName":"Test","alarmReason":"TEST"}'Ajax Partner API access
Access to the Ajax REST API requires a Partner account. Consumer Ajax accounts cannot generate API tokens. Partners are categorized by tier, with API capabilities expanding at higher tiers.
| Partner tier | API access | Rate limit |
|---|---|---|
| Certified Installer | Basic — device list, state polling | 60 requests/min |
| Certified Integrator | Full — arm/disarm, webhooks, cameras | 300 requests/min |
| Technology Partner | Full + bulk multi-hub management | Custom SLA |
To apply for Partner API access, register at ajax.systems/partners. The approval process takes 3–10 business days. For Home Assistant personal use, the HACS integration uses a shared application token — no personal API registration is required.
Limitations and considerations
The cloud-only API architecture has important implications for reliability and data handling. Security professionals should evaluate these before committing to API-based automation in critical installations.
| Limitation | Detail | Mitigation |
|---|---|---|
| No local API | Hub 2 Plus has no LAN endpoint | Accept cloud dependency; use reliable internet with UPS on router |
| State polling latency | 30-second default polling in HA | Use webhooks for alarm events; polling for status display only |
| Internet outage | API unavailable during outage | Ajax standalone security continues; only automation bridge fails |
| GDPR data handling | Event data processed on Ajax EU servers | Confirm data processing agreement with Ajax for commercial projects |
| OAuth token refresh | Access token expires, needs refresh | HACS integration handles refresh; custom integrations must implement |
Ajax standalone security is unaffected by API/internet outage. The Hub 2 Plus continues to detect, alarm, and notify via GSM even when the cloud API is unreachable. The API integration layer is supplementary — do not design a building automation system that relies on the Ajax API for life-safety functions.
Ajax + KNX + Home Assistant — integrated and tested
We configure Ajax Hub 2 Plus with Home Assistant KNX bridge, webhook automation, and building scene integration — delivered as a working system with full documentation.
Request a quote →