[ENG] 11.8 [DKSF 70/71.5 IU] How to Control a Device Using SMS Commands?
The information in the section is related to the device UniPing server solution v3/SMS with a built-in GSM modem.
A device has a feature of a remote control using SMS commands.
Syntax of SMS Commands
General format of the text of an SMS command is:
where:
fff – is a command code, for example, Р1+ (see below).
community_w – is a password, which corresponds to an SNMP community for write. It is set at the page «SETUP» of a device web interface. It is possible to use Latin letters, numbers, _, without quotes and spaces.
kkkkk – is a request identifier (a random number from 3 to 9 numbers). It is repeated in a response to set a correspondence between a request and a report. It is an auxiliary element of a command. If there is no identifier in a command, there is no identifier in a response.
A command text is case insensitive, hence it is possible to use uppercase and lowercase letters. Elements of a command are separated by spaces. It is not acceptable to use the characters: ‘ (apostrophe), “ (quote), @. Including these characters can cause the firmware failure. Executing a command is confirmed by a response message (see below).
Command Codes
A command code is indicated together without spaces.
Command Code | Description |
---|---|
Pn+ | Switch on a relay n, where n - is a relay number |
Pn- | Switch off a relay n, where n - is a relay number |
PnR | Reboot a relay n, where n - is a relay number A polarity (direction) of switching a relay when resetting must correspond to the one specified in the settings of the module «Watchdog» (reset mode). If a relay is already reset, a reset command will not have any effect, but a sender will get a response notification about successful executing «NP DONE PnR». |
PnW | Switch a relay n to the «Watchdog» mode, where n is a relay number |
PnS | Switch a relay n to the «Schedule» mode, where n is a relay number |
PnX | Switch a relay n to the «Schedule+Watchdog» mode, where n is a relay mode |
PnL | Switch a relay n to the management mode «Logic output», where n is a relay number |
Pn? | Request a status of a relay n, where n is a relay number |
P? | Request a status of all relays in a brief form |
Lm+ | Switch a line m to the status logic 1, where m is an IO line number |
Lm- | Switch a line m to the status logic 0, where m is an IO line number |
LmP | Issue a pulse to the line m, where m is an IO line number |
Lm? | Request a status of a line m, where m is an IO line number |
L? | Request a status of all IO lines in a brief form |
N? | Request a status of a pinger |
Ka | Transfer an IR command through the module IRC-TRv2, where a is a command number |
Tb? | Request readings of a temperature sensor b, where b is a number of a temperature sensor |
Hx? | Request readings of a humidity sensor x, where x is a number of a humidity sensor |
Examples of SMS Commands
A command for switching on a relay 1 of a device:
A command for switching off a relay 2 of a device:
Response Messages to SMS Commands
Confirmation of executing a command, such as switching a relay or changing a status of a discrete output line:
where:
fff – is a code of outgoing command, executing which is confirmed by this message. For example, Р1+
kkkkk – is a request identifier (a random number from 3 to 9 numbers). It is repeated in a response to set a correspondence between a request and a response. It is an auxiliary element of a command. If there is no identifier in a command, there is no identifier in a response
An error when a device reads a command. Most probably, incorrect text of an outgoing command:
where:
Outgoing command – is a text of an outgoing command, which is quoted completely.
kkkkk – is a request identifier (a random number from 3 to 9 numbers). It is repeated in a response to set a correspondence between a request and a response. It is an auxiliary element of a command. If there is no identifier in a command, there is no identifier in a response
incorrect password (Community) in an outgoing command:
where:
kkkkk – is an identifier of a request (a random number from 3 to 9 numbers). It is repeated in a response to set a correspondence between a request and a response. It is an auxiliary element of a command. If there is no identifier in a command, there is no identifier in a response (the second command)
Response Messages to SMS Commands from Requesting a Status
A response to a request (NETPING Pn? community_w kkkkk) about a status of a relay:
where:
n – is a relay number
b – is a relay status, possible statuses of a relay are coded in characters: «M+» (manually switched on), «M-» (manually switched off), «W+» (switched on by a watchdog), «W-» (switched off by a watchdog), «S+» (switched on by a schedule), «S-» (switched off by a schedule), «X+» (switched on by a schedule+watchdog), «X-» (switched off by a schedule+watchdog), «L+» (switched on by logic), «L-» (switched off by logic).
kkkkk – is an identifier of a request (a random number from 3 to 9 numbers). It is repeated in a response to set a correspondence between a request and a response. It is an auxiliary element of a command. If there is no identifier in a command, there is no identifier in a response
A response to a request (NETPING P? community_w kkkkk) about a status of all relays:
where:
n – is a relay number
b – is a relay status, possible statuses are encoded by the characters: «M+» (switched on manually), «M-» (switched off manually), «W+» (switched on by a watchdog), «W-» (switched off by a watchdog), «S+» (switched on by a schedule), «S-» (switched off by a schedule), «X+» (switched on by a schedule-watchdog), «X-» (switched off by a schedule+watchdog), «L+» (switched on by logic), «L-» (switched off by logic).
kkkkk – is a request identifier (a random number from 3 to 9 numbers). It is repeated in a response to set a correspondence between a request and a response. It is an auxiliary element of a command. If there is no identifier in a command, there is no identifier in a response
A response to a request (NETPING Lm? community_w kkkkk) of a status of an IO line:
where:
m – is a number of an IO line
l – is a logic level of an IO line, possible values are: 0 (logic zero), 1 (logic one)
mode – is an operation mode of an IO line, possible statuses are: IN (input), OUT (output), OUT.L (logic output)
kkkkk – is a request identifier (a random number from 3 to 9 numbers). It is repeated in a response to set a correspondence between a request and report. It is an auxiliary element of a command. If there is no identifier in a command, there is no identifier in a response
A response to a request (NETPING L? community_w kkkkk) of status of all IO lines:
where:
m – is a number of an IO line
l – is a logic level of an IO line, its possible values are: 0 (logic zero), 1 (logic one)
mode – is an operation mode of an IO line, possible values are: IN (input), OUT (output), OUT.L (logic output)
kkkkk – is a request identifier (a random number from 3 to 9 numbers). It is repeated in a response to set a correspondence between a request and a response. It is an auxiliary element of a command. If there is no identifier in a command, there is no identifier in a response
A response to a request (NETPING N? community_w kkkkk) abou a status of a pinger, which is built into an SMS module:
where:
N=0 – a specified IP address is silent
N=1 – a specified IP address responds
kkkkk – is a request identifier (a random number from 3 to 9 numbers). It is repeated in a response to set a correspondence between a request and a response. It is an auxiliary element of a command. If there is no identifier in a command, there is no identifier in a response
A response to a request (NETPING Tb? community_w kkkkk) for readings of a temperature sensor. A sensor with a number b failed or is not connected:
where:
b – is a number of a temperature sensor
kkkkk – is an identifier of a request (a random number from 3 to 9 number). It is repeated in a response to set a correspondence between a request and a response. It is an auxiliary element of a command. If there is no identifier in a command, there is no identifier in a response
A response to a request (NETPING Tb? community_w kkkkk) for readings of a temperature sensor:
where:
b – is a number of a temperature sensor
t – is a current value of a temperature, °C
t1, t2 – are limits of the «normal» range of a temperature, °C
kkkkk – is a request identifier (a random number from 3 to 9 numbers). It is repeated in a response to set a correspondence between a request and a response. It is an auxiliary element of a command. If there is no identifier in a command, there is no identifier in a response
A response to a request (NETPING Hx? community_w kkkkk) for readings of a humidity sensor. A sensor failed or is not connected:
where:
x – is a number of a humidity sensor
kkkkk – is a request identifier (a random number from 3 to 9 numbers). It is repeated in a response to set a correspondence between a request and a response. It is an auxiliary element of a command. If there is no identifier in a command, there is no identifier in a response.
A response to a request (NETPING Hx? community_w kkkkk) for readings of a humidity sensor:
where:
x – is a number of a humidity sensor
h – is a current value of a relative humidity, in %
h1, h2 – are limits of a «normal» range of a relative humidity, %
t – is a current value of a temperature, in °C
kkkkk – is a request identifier (a random number from 3 to 9 numbers). It is repeated in a response to set a correspondence between a request and a response. It is an auxiliary element of a command. If there is no identifier in a command, there is no identifier in a response