Ajax alarm system

You need a token for make the requests

Hi,

I have SIA integration, and if I have activated in armed mode and HA restarts, after this restart SIa alarms become unknown if I deactivate the alarm

I have to activate armed mode to go back SIA status to the right situation.

It’s only , when I have activate SIa and I restart the HA and after taht deactivate the alar
m. any idea how to fix this behaviour ?

Thanks.

That’s expected behaviour, SIA doesn’t update ever check in, just when the state changes. If your worried you may have to use MQTT alarm as that can retain the state.

It would be amazing if the newer API allows access to things like door sensors, it’s such a pity to have all of that data and not be able to use it!

1 Like

I know, spam Ajax about it, would love to build it especially if they provide a python sdk!


UPDATE: i have obtained the X API token from ajax, now i can use the api documentation for compile a node red automation for manage the ajax hub! I’ve tried to get the status, arm and disarm and it works :slightly_smiling_face:

2 Likes

Could you please tell us what is the process to get a token and how to access to the api documentation ?

For get the token the process is this:

REST API USAGE
A simple document with the most-wanted Ajax APIs


To integrate Ajax Systems API is strongly recommended to use the following subset of method in order to:
Arm the system
Disarm the system
Zone bypass / unbypass
Enable / Disable system integrity checks


Login
Before doing your job you need to login on the API server. You need :
X-Api-Key ( form Ajax Systems)
Login (the email used during registration )
passwordHash (the corresponding password )

curl -X POST “https://api.ajax.systems/api/login” -H “accept: application/json” -H "X-Api-Key: " -H “Content-Type: application/json” -d “{ “login”: “”, “passwordHash”: “”, “userRole”: “USER”}”

The system responds with:
Sessiontoken
usedId (fixed for the specific user)
refreshToken
Like in the following…

{
“sessionToken” : “k3XRd0fP3Muka8Sliy89ZIfIs3c”,
“userId” : “3344FF96”,
“refreshToken” : “FOKPH0JeJL1DSXSbvYuVicH5YIc”
}


REFRESH
Every 15 minutes you have to refresh the session

curl -X POST “https://api.ajax.systems/api/refresh” -H “accept: application/json” -H "X-Api-Key: -H “Content-Type: application/json” -d “{ “userId”: “3344FF96”, “refreshToken”: “FOKPH0JeJL1DSXSbvYuVicH5YIc”}”

{
“sessionToken” : “B_vbg5SCEzPc1GCma2Xhvk8vS98”,
“userId” : “3344FF96”,
“refreshToken” : “hUjTAoaEhOPcUor4fVtNZm2VXiQ”
}


GET USER INFO
Just to get back the user infos

curl -X GET “https://api.ajax.systems/api/user/3344FF96” -H “accept: application/json” -H "X-Api-Key: " -H “X-Session-Token: B_vbg5SCEzPc1GCma2Xhvk8vS98”

{
“phone” : “+…”,
“firstName” : “…”,
“language” : “it”,
“agreementVersion” : 101,
“login” : “”,
“imageUrls” : null,
“attachedCompanyId” : “”
}


GET LIST OF HUBS ACCOUNTED BY SPECIFIC USER

This request returns the list of hubs accounted on a specific user

curl -X GET “https://api.ajax.systems/api/user/3344FF96/hubs” -H “accept: application/json” -H "X-Api-Key: " -H “X-Session-Token: B_vbg5SCEzPc1GCma2Xhvk8vS98”

[ {
“hubId” : “…”,
“hubBindingRole” : “MASTER”
}, {
“hubId” : “…”,
“hubBindingRole” : “MASTER”
} ]

MASTER stands for an Admin user type.


GET HUB STATUS

This request returns the status of a specific hub.
It contains also the arming status…

curl -X GET “https://api.ajax.systems/api/user/3344FF96/hubs/” -H “accept: application/json” -H "X-Api-Key: " -H “X-Session-Token: bJNybWMquPQsWn32p8yYnn_KtTA”

{
“state” : “DISARMED”, <------ ARMED, DISARMED, NIGHT_MODE
“color” : “WHITE”,
“timeZone” : “EUROPE_ROME”,
“name” : “Valigetta Demo”,
“id” : “…”,
“warnings” : {
“hub” : 3,
“allDevices” : 3
},
…
}


ARM / DISARM COMMAND

To arm or disarm the system

curl -X PUT “https://api.ajax.systems/api/user/3344FF96/hubs/000BF55D/commands/arming” -H “accept: application/json” -H "X-Api-Key: " -H “X-Session-Token: bJNybWMquPQsWn32p8yYnn_KtTA” -H “Content-Type: application/json” -d “{ “command”: “DISARM”, “ignoreProblems”: true}”

The response is 200 in case of success, 40x otherwise


RESTORE ALARMS

curl -X PUT “https://api.ajax.systems/api/user/3344FF96/hubs/000BF55D/commands/requestRestoreAfterAlarmCondition” -H “accept: application/json” -H “X-Session-Token: jBAQTkbOlQEFxmXc_XSfEiR61k4” -H "X-Api-Key: "

The response is 200 in case of success, 40x otherwise


GET DEVICES LIST

Requests the list of the devices currently linked on the hub

curl -X GET “https://api.ajax.systems/api/user/3344FF96/hubs/000BF55D/devices” -H “accept: application/json” -H “X-Session-Token: jBAQTkbOlQEFxmXc_XSfEiR61k4” -H "X-Api-Key: "

Returns some thing like:

[ {
“id” : “004CA307”,
“deviceType” : “HomeSiren”,
“deviceName” : “Sirena da Interno”,
“roomId” : “00000001”,
“groupId” : “00000002”,
“color” : “WHITE”,
“online” : true
},
…
]


BYPASS / UNBYPASS of one zone

curl -X POST “https://api.ajax.systems/api/user/3344FF96/hubs//devices//command” -H “accept: application/json” -H "X-Session-Token: " -H "X-Api-Key: " -H “Content-Type: application/json” -d “{ “command”: “”, “deviceType”: “LeaksProtect”}”

in case of Bypass of the zone → ENABLE_ENGINEER_BYPASS
in case of Unbypass of the zone → DISABLE_BYPASS

This is the complete list of the commands:
CONNECTION_TEST_START, CONNECTION_TEST_STOP, DETECTION_TEST_START, DETECTION_TEST_STOP, MUTE, SWITCH_ON, SWITCH_OFF, SOUND_TEST_START, UNLOCK_DEVICE, FIRE_SENSOR_TEST, MOTION_OUTDOOR_DETECTION_TEST_START, MOTION_OUTDOOR_UPPER_MOTION_SENSOR_DETECTION_TEST_START, MOTION_OUTDOOR_LOWER_MOTION_SENSOR_DETECTION_TEST_START, MOTION_OUTDOOR_ANTIMASKING_MOTION_SENSOR_DETECTION_TEST_START, MULTI_TRANSMITTER_POWER_RESET, DISABLE_BYPASS, ENABLE_ENGINEER_BYPASS, ENABLE_TAMPER_BYPASS, RESET_PASSWORD, RESET_FORCE_DISARM_PASSWORD


GET DEVICE INFO

curl -X GET “https://api.ajax.systems/api/user//hubs//devices/{deviceId}” -H “accept: application/json” -H “X-Api-Key: <>” -H “Content-Type: application/json” -H “X-Session-Token: <>”

Returns something like
{
“id” : “00472DA9”,
“deviceName” : “Contatto Magnetico”,
“roomId” : “00000001”,
“groupId” : “00000001”,
“deviceType” : “DoorProtectPlus”,
“color” : “WHITE”,
“temperature” : 20,
“signalLevel” : “STRONG”,
“tampered” : false,
“batteryChargeLevelPercentage” : 100,
“firmwareVersion” : “5.55.2.0”,
“online” : true,
“issuesCount” : 0,
“assignedExtender” : 0,
“cmsDeviceIndex” : 5,
“deviceTransmissionPowerMode” : 0,
“deviceTransmissionPowerModeValue” : “DEFAULT”,
“nightModeArm” : true,
“imageId” : 0,
“armDelaySeconds” : 0,
“alarmDelaySeconds” : 0,
“applyDelaysToNightMode” : false,
“verifiesAlarm” : true,
“confirmsAlarm” : “ENABLED”,
“state” : “PASSIVE”,
“malfunctions” : [ ],
“bypassState” : [ “ENGINEER_BYPASS_ACTIVE” ],
“alwaysActive” : false,
“extraContactAware” : false,
“reedContactAware” : true,
“shockSensorAware” : false,
“shockSensorSensitivity” : 7,
“ignoreSimpleImpact” : false,
“accelerometerAware” : false,
“accelerometerTiltDegrees” : 15,
“accelerometerTiltAlarmDelaySeconds” : 2,
“sirenTriggers” : [ “REED”, “EXTRA_CONTACT”, “TILT”, “SHOCK”, “SHUTTER_ALARM”, “SHUTTER_ONLINE” ],
“reedClosed” : true,
“extraContactClosed” : false,
“extraContactType” : null,
“rollerShutterSettings” : null,
“indicatorLightMode” : “STANDARD”,
“twoStageArmingRole” : null,
“rollerShutterSupported” : true,
“indicatorLightModeSupported” : true
}


API TOKEN MUST TO BE REQUIRED TO AJAX

2 Likes

do you need to pay for an enterprise subscription to get the X-API token? Or can you do it as a private user?
thanks!

is it from this page you got your token and access to the documentation? Ajax API request? It seems to me it is dedicated to large companies?

No, i’ve just asked to ajax to have the xapi code fo develop

Is the api online or did you get it after registration ?
Could tell us at what email address you sent your request? Thank you

I have got it from ajax after registration to the ajax developer portal.

Api are Public but for use it u need the “x api code” that’s a token for have the access to the ajax cloud.

The token is required instead as username and password (only users account, not PRO) for make the http requests

Do you confirm you registered here: ajax registration?
Thanks

Yes! Correct

so I will give a shot, thanks



First sensor……

What information did you fill in the form?

A simple login request, and the response is:

Session token, user id

Then i’ve used an api GET request for obtain the serial of the hub qnd then i have done an htttp request for get get status of the alarm armed/disarmed. I’ve read the state and with a simple read of the msg.paylod:state and put a switch for this with a sensor.

The next project is to arm/disarm using home assistant

I mean the Ajax registration form Application for access to the Enterprise API of the Ajax system

1 Like