Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. Install the SIM card in the mobile phone and make sure that it is functional, check PIN-code;
  2. Insert the SIM card in modem;
  3. Turn on the power of the monitoring system;
  4. Configure the modem;
  5. Add SMS notifications and configure the logic or group notifications.

Configuring the modem for sending and receiving SMS

To configure the modem, use the modem settings tab (Main Menu→SMS messages):

...

Warning

If an error occurs during the operation of the modem, or the SIM card is not installed, or the PIN code is not correct, the message written into the log queue ("GSM modem: Error, check your SIM card and PIN code" or "GSM modem: modem error, restart smsd"). The message is displayed only 5 times in order not to overflow the log.

SMS messages

To add an SMS notification recipient, first, open the System Tree menu, further open window SMS:

...

If these items do not fit your situation, try to restart the monitoring system. Also, check the sending of messages from your mobile phone.

SMS commands

SMS commands are used for remote management by the monitoring system. Using these commands, you can read the system status, the status, and the measured value of individual sensors and a group of sensors, as well as control the relay switches (outlets). The phone numbers from which the remote control will be made must be added to the list of allowed numbers in the modem parameters editing window (Main menu → SMS messages → List of allowed phone numbers).

...

In response to each SMS command, an SMS response message arrives, in case of an erroneous command, SMS with an error description and an example of the command comes. In one SMS message, there can be only one command for one element.

System, sensor, relays (outlets) status reading commands

Syntax. get [ID] or get [name], where ID is the "ID" number of the element, "name" is the name of the element. The get field is not case sensitive, you can use Get, GET. The name field is case-sensitive and must be enclosed in quotesAlso, the name of the requested sensor must be unique, otherwise, the answer may be incorrect.

...

Code Block
languagexml
titleget element
Element: Temperature-1 [201003]
State: normal
Value: 27.5 C


Commands for setting the status of the relay (sockets)

Syntax. set [ID] [state] or set [name] [state], where ID - the "ID" number of the element, "name" is the name of the element, "state" is the state to which you want to switch.  The set and state fields are not case-sensitive. The name field is case-sensitive. The state field takes one of the following states: on - enable, off - disable.

...

Response. In this case the response message looks like this: The element (element name) was switched on or The element (element name) was switched off.

Relay (Socket) pulse setting commands

Syntax. set [ID]  pulse {duration} or set [name] pulse {duration}, where ID is the "ID" number of the element, "name" is the name of the element, duration is the delay time in seconds. The name field is case-sensitive. The value range of the duration field is from 1 to 120. The duration field does not need to be specified, the previously set value is applied.

...

Response. In this case the response message looks like this: The element (element name) was switched.

Logic control commands (logic)

Syntaxlogic [id] [state] {duration},  logic * [state], where ID – the "Logic number" of the logic (the symbol '*' for all logics), state - the state into which the logic goes ("off", "on"), duration - the time of logic shutdown in seconds. All fields are case insensitive.

...

Response. In this case the response message looks like this: OK.

Sending SMS using third-party programs

To send SMS, you can use, for example, the cURL utility. Either other programs with similar functionality.

To send SMS, use the following command in the console:

gcc -O2 -o sendsms sendsms.c

Script for sending SMS


#!/bin/bash
# SMS sending script for version 2.4.x and higher
 
usage()
{
cat << EOF
usage: $0 options
 
OPTIONS:
   -?,-h   Show this message
   -H      Hostname or IP address
   -u      User name
   -p      Password
   -P      Phone for sending
   -m      Message for sending
EOF
}
 
HOSTIP=
USERNAME=
PASSWORD=
TOPHONE=
MESSAGE='Test'
 
while getopts “hH:u:p:P:m:” OPTION
do
     case $OPTION in
         h)
             usage
             exit 1
             ;;
         H)
             HOSTIP=$OPTARG
             ;;
         u)
             USERNAME=$OPTARG
             ;;
         p)
             PASSWORD=$OPTARG
             ;;
         P)
             TOPHONE=$OPTARG
             ;;
         m)
             MESSAGE=$OPTARG
             ;;
         ?)
             usage
             exit
             ;;
     esac
done
 
if [[ -z $HOSTIP ]] || [[ -z $USERNAME ]] || [[ -z $PASSWORD ]] || [[ -z $TOPHONE ]] || [[ -z $MESSAGE ]]
then
     usage
     exit 1
fi
 
# 1) password hash
HASH=`echo -n ${PASSWORD} | openssl dgst -sha1 | awk '{print $NF}'`
 
# 2) authorization
RESPONSE=`curl -s -d "querytype=auth&name=${USERNAME}&h=${HASH}" "${HOSTIP}/engine.htm"`
# or for HTTPS case
#RESPONSE=`curl -s -d "querytype=auth&name=${USERNAME}&h=${HASH}" -k "https://${HOSTIP}/engine.htm"`
 
# 3) session key
KEY=`echo -n  ${RESPONSE} | awk -F"\"" '{print $4}'`
 
# 4) send SMS
curl -d "querytype=send_sms_message&k=${KEY}" --data-urlencode "to_phone=${TOPHONE}" --data-urlencode "message=${MESSAGE}" ${HOSTIP}/engine.htm > /dev/null 2>&1
# or for HTTPS case
#curl -d "querytype=send_sms_message&k=${KEY}" --data-urlencode "to_phone=${TOPHONE}" --data-urlencode "message=${MESSAGE}" -k https://${HOSTIP}/engine.htm > /dev/null 2>&1


In case of errors, leave comments below on the page or at our forum. Please indicate in the message the current version of the firmware of the monitoring system (System menu→About this system→Firmware version).

...