Tutorial: Querx and SMS

Alerting by SMS message with the HWg-SMS-GW3

Gateway setup

The company HW group offers a Gateway, which can be used to send SMS messages from the local network. This tutorial describes how to use this functionality with egnite Querx.

Initially, the SMS gateway is set up. It is assumed that you have commissioned the gateway with the help of the manual and that the web interface of the gateway is accessible with a browser.

Under General Setup two users with passwords can be set up. The user under WWW Security is used to protect the web interface. The user under NetGSM (SOAP) security will subsequently be used by Querx to send SMS.

After making changes, click on Apply Changes on the left. Then a new button Restart appears at the top, which you have to press to reboot the gateway and make the changes active.

On the GSM Modem page you will find settings regarding the SIM card. You may also test the sending of an SMS here.

Querx setup

The Querx should have at least firmware 7 installed. The template alongside has to be uploaded to the Querx first.

For this purpose, copy the text into an empty text file and save it under an arbitrary name with the extension .tpl on your computer, for example "hwg-sms-v1.tpl". In the configuration area on the Firmware page under Install Content, you can then select the file and upload it. It should then appear in the list as "/tpl/j/hwg-sms.tpl".

add=/tpl/j/hwg-sms.tpl

{%escape html-%}
{%option method%}POST{%endoption-%}
{%option title1%}Phone number{%endoption-%}
{%option title2%}Username{%endoption-%}
{%option title3%}Password{%endoption-%}
{%option num_variables%}3{%endoption-%}
Content-Type: application/xml; charset=utf-8
{%if actiontab_var2%}Authorization: Basic {{base64(actiontab_var2, ":", actiontab_var3)}}
{%endif-%}
{# #}




GsmOut

SMS
{{actiontab_var1}}
{%if arg(event_id) != ""%}{%use sensortab[eventtab_sensor]-%}
Sensor alarm for {{hostname}}: {{eventtab_sensorname}} {{eventtab_event}} {{eventtab_value_raw}} {{sensortab_unit_utf8-}}
{%enduse%}{%else%}Test{%endif%}



After that a new action with action type HTTP Push and event type Alarm is created. For the template the previously uploaded file "hwg-sms.tpl" is selected. After the selection some fields will change.

The URL has to contain the IP or the domain name of the gateway with the path "/service.xml". Afterwards one enters the desired recipient phone number into the first variable of the template with the name "Phone number". The next two variables are given the user name and password as set in the gateway under NetGSM (SOAP) security.

You can send a test SMS using the test button.

The action can be activated via the Activate button at the top. Then, when an alert occurs, an SMS is sent. Also, when the alarm is over, there will be another SMS sent. In the settings of the action under Alarm-Event you can also set when an SMS should be sent. For testing, you can also change the threshold values of a sensor temporarily. To avoid that too many SMS are sent, you can increase the alert delay or the dead-band for the sensors.