Testing the MQTT and HTTP Alarmserver v2 API

Q: I read this article showing how to test my IN-9408 2k+ WQHD cameras alarmserver. There is an older article explaining the use of the deprecated v1 API. What do I have to change here for the version 2 API?

A: Both - the HTTP and MQTT Alarmserver - now use an encoded output that allows the differentiation of multiple simultaneous alarm triggers (before you always only received the first trigger if more then one was tripped). Both can still be tested using the MQTT or HTTP API. But now it is also possible to use the cameras webUI to check the alarmserver output for different triggers:

Alarm Trigger

Depending on whether you want to use the MQTT or HTTP alarmserver open the corresponding menu in your cameras webUI and click on the Test button in the bottom left to open the Test Menu.

In the following example I will use the HTTP alarmserver. Make sure that configured the alarmserver and you activated the appending of alarm triggers:

MQTT- und HTTP-Alarmserver v2 API

And click on the Test button to open the Test Menu:

MQTT- und HTTP-Alarmserver v2 API

Make sure that only Area1 is selected and click on Send Request. The next step will depend on the Smarthome system you are using. In this example I am going to use a simplified version of this Node-RED Flow to provide the webhook that is going to be contacted by the camera. If you are using the test tool from the MQTT menu instead of the HTTP menu connect the MQTT Explorer as debugging tool and you will see the both alarmserver topics:

  • APIv1 MQTT Alarmserver Topic: prefix/id/status/alarm/triggered { "val" : "1" }
  • APIv2 MQTT Alarmserver Topic: prefix/id/status/alarm/triggered/triggers { "val" : "1" }

MQTT- und HTTP-Alarmserver v2 API

For HTTP Webhook I can see the following in Node-RED:

MQTT- und HTTP-Alarmserver v2 API

  • APIv1 HTTP Alarmserver Query: { active: "1", object: "0" }
  • APIv2 HTTP Alarmserver Query: { trigger: "1", object: "0" }

The complete list of triggers for APIv2 is:

Single Triggers

Trigger
HTTP Query
MQTT Payload status/alarm/triggered/triggers
Alarm Area 1&trigger=1{ "val" : "1" }
Alarm Area 2&trigger=2{ "val" : "2" }
Alarm Area 3&trigger=4{ "val" : "4" }
Alarm Area 4&trigger=8{ "val" : "8" }
Alarm Area 5&trigger=256{ "val" : "256" }
Alarm Area 6&trigger=512{ "val" : "512" }
Alarm Area 7&trigger=1024{ "val" : "1024" }
Alarm Area 8&trigger=2048{ "val" : "2048" }
PIR Sensor&trigger=16{ "val" : "16" }
Alarm Input&trigger=32{ "val" : "32" }
Audio Detection&trigger=64{ "val" : "64" }
Manual trigger&trigger=128{ "val" : "128" }

Combined Triggers

If more then one trigger is tripped their corresponding numbers are added up (excerpt of all available values):

Trigger
HTTP Query
MQTT Payload status/alarm/triggered/triggers
Alarm Area 1 & PIR&trigger=17{ "val" : "17" }
Alarm Area 2 & PIR&trigger=18{ "val" : "18" }
Alarm Area 3 & PIR&trigger=20{ "val" : "20" }
Alarm Area 4 & PIR&trigger=24{ "val" : "24" }
Alarm Area 5 & PIR&trigger=272{ "val" : "272" }
Alarm Area 6 & PIR&trigger=528{ "val" : "528" }
Alarm Area 7 & PIR&trigger=1040{ "val" : "1040" }
Alarm Area 8 & PIR&trigger=2064{ "val" : "2064" }
Alarm Area 1 & Alarm Input&trigger=33{ "val" : "33" }
Alarm Area 2 & Alarm Input&trigger=34{ "val" : "34" }
Alarm Area 3 & Alarm Input&trigger=36{ "val" : "36" }
Alarm Area 4 & Alarm Input&trigger=40{ "val" : "40" }
Alarm Area 5 & Alarm Input&trigger=288{ "val" : "288" }
Alarm Area 6 & Alarm Input&trigger=544{ "val" : "544" }
Alarm Area 7 & Alarm Input&trigger=1056{ "val" : "1056" }
Alarm Area 8 & Alarm Input&trigger=2080{ "val" : "2080" }
Alarm Area 1 & Audio Detection&trigger=65{ "val" : "65" }
Alarm Area 2 & Audio Detection&trigger=66{ "val" : "66" }
Alarm Area 3 & Audio Detection&trigger=68{ "val" : "68" }
Alarm Area 4 & Audio Detection&trigger=72{ "val" : "72" }
Alarm Area 5 & Audio Detection&trigger=320{ "val" : "320" }
Alarm Area 6 & Audio Detection&trigger=567{ "val" : "567" }
Alarm Area 7 & Audio Detection&trigger=1088{ "val" : "1088" }
Alarm Area 8 & Audio Detection&trigger=2112{ "val" : "2112" }
Alarm Area 1 & 2&trigger=3{ "val" : "3" }
Alarm Area 1 & 3&trigger=5{ "val" : "5" }
Alarm Area 1 & 4&trigger=9{ "val" : "9" }
Alarm Area 1 & 5&trigger=257{ "val" : "257" }
Alarm Area 1 & 6&trigger=513{ "val" : "513" }
Alarm Area 1 & 7&trigger=1025{ "val" : "1025" }
Alarm Area 1 & 8&trigger=2049{ "val" : "2049" }
Alarm Area 2 & 3&trigger=6{ "val" : "6" }
Alarm Area 2 & 4&trigger=10{ "val" : "10" }
Alarm Area 2 & 5&trigger=258{ "val" : "258" }
Alarm Area 2 & 6&trigger=514{ "val" : "514" }
Alarm Area 2 & 7&trigger=1026{ "val" : "1026" }
Alarm Area 2 & 8&trigger=2050{ "val" : "2050" }
Alarm Area 3 & 4&trigger=12{ "val" : "12" }
Alarm Area 3 & 5&trigger=260{ "val" : "260" }
Alarm Area 3 & 6&trigger=516{ "val" : "516" }
Alarm Area 3 & 7&trigger=1028{ "val" : "1028" }
Alarm Area 3 & 8&trigger=2052{ "val" : "2052" }
Alarm Area 4 & 5&trigger=264{ "val" : "264" }
Alarm Area 4 & 6&trigger=520{ "val" : "520" }
Alarm Area 4 & 7&trigger=1032{ "val" : "1032" }
Alarm Area 4 & 8&trigger=2056{ "val" : "2056" }
Alarm Area 5 & 6&trigger=768{ "val" : "768" }
Alarm Area 5 & 7&trigger=1280{ "val" : "1280" }
Alarm Area 5 & 8&trigger=2304{ "val" : "2304" }
Alarm Area 6 & 7&trigger=1536{ "val" : "1536" }
Alarm Area 6 & 8&trigger=2560{ "val" : "2560" }
Alarm Area 7 & 8&trigger=3072{ "val" : "3072" }
Alarm Area 1 & 2 & 3 & 4&trigger=15{ "val" : "15" }
Alarm Area 5 & 6 & 7 & 8&trigger=3840{ "val" : "3840" }
Alarm Area 1 & 2 & 7 & 8&trigger=3075{ "val" : "3075" }
Alarm Area 3 & 4 & 5 & 6&trigger=780{ "val" : "780" }

ETC. ETC. ETC.