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!
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
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
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
Yes! Correct
so I will give a shot, thanks
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