[ENG] 11.8. [DKSF 70/71.6 IU] How to Control a Device via SMS Commands?
Information in the section applies to the device UniPing server solution v3/SMS with a built-in GSM modem.
A device has a feature of remote controlling by using SMS commands.
Syntax of SMS Commands
A general format of a test of an SMS command:
where:
fff – is a code of a command, for example, Р1+ (see below).
community_w – is a password that corresponds to the SNMP community for read. It is set in the page «SETUP» of a device web interface. It is possible to use Latin letters, numbers, and some special characters
kkkkk – is a request identifier (a random number of 3 to 9 digits). It is repeated in a response for setting a correspondence between a request and a response. It is an optional command element. If there is no identifier in a command, there is no identifier in a response.
A text of a command is case insensitive. It is possible to use uppercase and lowercase letters. Elements of a command are separated by spaces. It is not acceptable to use the next characters: ‘ (apostrophe), “ (quote), @. Including these characters can cause the firmware failure. Execution of a command is confirmed by a response notification (see below).
Codes of Commands
A code of a command is specified together, with no 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 | Reset a relay n, where n is a relay number A polarity (direction) of switching a relay when resetting must correspond to the specified one in settings of the module «Watchdog» (reset mode). If a relay is already in a reset status, a reset command will have no effect. At the same time, a response notification about its successful execution «NP DONE PnR» will be sent to a sender. |
PnW | Switch a relay n to the management mode «Watchdog», where n is a relay number |
PnS | Switch a relay n to the management mode «Schedule», where n is a relay number |
PnX | Switch a relay n to the management mode «Schedule+Watchdog», where n is a relay number |
PnL | Switch a relay n to the management mode «Logic outout», 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 into the status logic 1, where m is a number of an IO line |
Lm- | Switch a line m into the status logic 0, where m is a number of an IO line |
LmP | Issue a pulse to the line m, where m is a number of an IO line |
Lm? | Request a status of a line m, where m is a number of an IO line |
L? | Request a status of all IO lines in a brief form |
N? | Request a status of a pinger on the page «SMS» |
Ka | Send an IR command through the module IRC-TR v2, 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 1 of a device:
Response Notifications to SMS Management Commands
Confirming of executing a command, such as switching a relay or changing a status of a discrete output line:
where:
fff – is a code of an outgoing command, executing which is confirmed by the notification. For example, Р1+
kkkkk – is an identifier of a request (random number from 3 to 9 digits). It is repeated in a response to establish a compliance between a request and a response. It is an optional command element. If there is no identifier in a command, there is no identifier in a response
An error when reading a command by a device. Most probably, the incorrect text of an outgoing command:
where:
Outgoing command – is a text of an outgoing command, quoted completely.
kkkkk – is a request identifier (a random number from 3 to 9 digits). It is repeated in a response to establish compliance between a request and a response. It is an optional command element. If there is no identifier in a command, there is no identifier is a response
An incorrect password (Community) in an outgoing command:
where:
kkkkk – is a request identifier (a random number from 3 to 9 digits). It is repeated in a response to establish a compliance between a request and a response. It is an optional command element. If there is no identifier in a command, there is no identifier in a response (a second command)
Response Notifications to SMS Commands of Requesting a Status/State
A response to a request (NETPING Pn? community_w kkkkk) about a relay status:
where:
n – is a relay number
b – is a relay status. Possible relay statuses are coded by the next 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 schedule+watchdog), «L+» (switched on by logic), «L-» (switched off by logic).
kkkkk – is a request identifier (a random number from 3 to 9 digits). It is repeated in a response to establish a compliance between a request and a response. It is an optional command element. 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 of a relay are encoded by the next 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 digits). It is repeated in a response to establish a compliance between a request and a response. It is an optional command element. 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. Its possible values are: 0 (logical zero), 1 (logical one)
mode – is an operation mode of an IO line. Its possible values are: IN (input), OUT (output), OUT.L (logic output)
kkkkk – is a request identifier (a random number from 3 to 9 digits). It is repeated in a response to establish a compliance between a request and a response. It is an optional command element. 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 a status of all IO lines:
where:
m – is a number of an IO line
l – is a logical level of an IO line. Its possible values are: 0 (logical zero), 1 (logical one)
mode – is an operation mode of an IO line. Its possible values are: IN (input), OUT (output), OUT.L (logical output)
kkkkk – is a request identifier (a random number from 3 to 9 digits). It is repeated in a response to establish a compliance between a request and a response. It is an optional command element. 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) about a status of a pinger, which is built into the module SMS:
where:
N=0 – a specified IP address/DNS name is silent
N=1 – a specified IP address/DNS name responds
kkkkk – is a request identifier (a random number from 3 to 9 digits). It is repeated in a response to establish a compliance between a request and a response. It is an optional command element. 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) of 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 a request identifier (a random number from 3 to 9 digits). It is repeated in a response to establish a compliance between a request and a response. It is an optional command element. 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) of readings of a temperature sensor:
where:
b – is a number of a temperature sensor
t – is a current reading of a temperature, °C
t1, t2 – is the thresholds of a normal temperature, °C
kkkkk – is a request identifier (a random number from 3 to 9 digits). It is repeated in a response to establish a compliance between a request and a response. It is an optional command element. 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) of 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 digits). It is repeated in a response to establish a compliance between a request and a response. It is an optional command element. 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) of readings of a humidity sensor:
where:
x – is a number of a humidity sensor
h – is a current reading of a relative humidity, in %
h1, h2 – is the thresholds of a normal relative humidity, %
t – is a current reading of a temperature, in °C
kkkkk – is a request identifier (a random number from 3 to 9 digits). It is repeated in a response to establish a compliance between a request and a response. It is an optional command element. If there is no identifier in a command, there is no identifier in a response