Working with Alarmserver Headers

Q: I use the alarm server of my 9408 2K+ to send an HTTPS request to my local ntfy server (see ntfy.sh). This in turn sends the message to all mobile devices that have subscribed to the topic. The request works fine so far.

Unfortunately, it is currently only possible to edit the parameters in the request (body) itself. However, ntfy uses information in the header to transfer certain parameters (e.g. the title, a priority, etc.). Is there a way to edit the header data of the requests in order to transfer individual parameters?

A: Our 2K+ WQHD models now allow you to set custom headers for Alarmserver Request. Those can be configured directly through the webUI or dynamically set through the HTTP (CGI) Interface or the MQTT Interface.

See also Debugging the HTTP Alarmserver in Node-RED

Basic Setup

Open your cameras WebUI and navigate to the Smarthome/Alarmserver Menu. Click on the + icon next to Request Header to add up to 5 custom headers:

Working with Alarmserver Headers

You can now add your custom headers as per ntfy documentation - e.g.:

  • Setting the message title: X-Title: Notification from my camera
  • Adding tags: X-Tags: warning,skull
  • Setting the message priority: X-Priority: 5
  • Adding a link that opens your cameras webUI: X-Click: http://192.168.2.125/
  • Attaching a link to your cameras snapshot: X-Attach: http://192.168.2.125/snap.cgi?user=admin&pwd=instar
  • Using a snapshot from your camera as message Icon: X-Icon: http://192.168.2.125/snap.cgi?user=admin&pwd=instar

Note: That the examples above use the local IP address of your camera. This will only be accessible if the ntfy server and your smartphone - that you are using with the ntfy app - are on the same local network as your camera. Or you are using a VPN to connect to your local network. Otherwise you will have to swap the local IP with your DDNS Address and forward your camera's web port to be able to access the address from the internet.

Dynamic Configuration

In case you are use a smarthome system you might want to adjust those headers dynamically using CGI or MQTT commands. An example would be - your smarthome knows that nobody is at home right now, thus you want the priority of a message notifying you about a detected motion to increase.

HTTP (CGI) Interface

To increase the priority simply send the following command to your camera:

  • http://192.168.2.168/param.cgi?cmd=setasattr&as_index=1&as_header1=1&as_headerattr1=X-Priority&as_headerval1=5

Please click on the link above to see the entire API documentation.

MQTT Interface

The same can be accomplish through the MQTT interface using the following commands:

  • smarthome/alarmserver/header1: Payload: {"val": "1"}
  • smarthome/alarmserver/headerkey1: Payload: {"val": "X-Priority"}
  • smarthome/alarmserver/headerval1: Payload: {"val": "5"}