Versions Compared

Key

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

...

To save the settings press "Save".  In order to avoid repeating the procedure every time you connect monitoring system, the settings should be saved in the flash memory of the system.  Press "  " and then confirm.

SMS notifications

 

Info

For more information on creating SMS see section Setting up GSM modem .

...

To add recipient of SMS notification go to "System tree" or "Group tree" menu and press "  ", then choose "SMS".

...

Info

For each new recipient you have to repeat the procedure of adding SMS notification.   

...

Before messages are sent they are queued up,  which means you do not have to wait until the previous message is sent. The information on all SMS sent is displayed in the log of monitoring system.

...

  • “get 1034” - to obtain information about the sensor with number 1034;

  • ”Get Analog-1” - to obtain information about the state of the element with the name of Analog-1;

  • “GET Relay-2” - to obtain information about the state of the element with the name of Relay-2.
      
    See section "Macros in the notification text" in Setting up GSM modem for further information.

...

You can use an external program to send SMS directly from your PC, cURL for example.  An example of such program and example of code in C can be found here:

...

Script example of sending SMS

 

Code Block
languagebash
titleСкрипт для отправки SMS
#!/bin/bash

#
SMS script ver.
 Скрипт отправки SMS для версии 2.4.x
SkyControl
 


usage()

{

cat
 
 << EOF

usage: $0 options
 


OPTIONS:
   

   -?,-
h  
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 
 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) Hash
HASH=`echo -n ${PASSWORD} | openssl dgst -sha1 | awk '{print $NF}'`
 
# 2) Autorisation
RESPONSE=`curl -s -d 

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) хеш пароля
HASH=`echo -n ${PASSWORD} | openssl dgst -sha1 | awk '{print $NF}'`

# 2) авторизация
RESPONSE=`curl -s -d "querytype=auth&name=${USERNAME}&h=${HASH}"
 
 "${HOSTIP}/engine.htm"`
 


# 3)
Session key
 ключ сессии
KEY=
`echo -n 
`echo -n  ${RESPONSE} |
 
 awk
 
 -F"\""
 
 '{print $4}'`
 


# 4)
send
 отправить SMS

curl
 -d 

 -d "querytype=send_sms_message&k=${KEY}"
 
 --data-urlencode
 
"to_phone=${TOPHONE}"
 
 --data-
urlencode 
urlencode "message=${MESSAGE}"
 
${HOSTIP}/engine.htm
 > /dev/null
 
 2>&1
Section "Setting up GSM modem" for driver v2.0.1 - v2.2.5 can be found here:

Child pages (Children Display)

 

developer notes: linkchange

...