[ENG] 8.8. [DKSF 52/202.10 IU] How to Control a Device Using SMS Commands

Information in the section applies to a device NetPing 2/PWR-220 v2/SMS with a built-in GSM modem.

A device has a feature of remote management using SMS commands.

Syntax of SMS Commands

A general format of a text of an SMS command:

NETPING fff community_w kkkkk

where:

fff – is a code of a command, for example, Р1+ (see below).

community_w – is a password that corresponds to SNMP community for write. It is specified on the page «SETUP» of a device web interface. It is possible to use Latin letters, numbers, character «_» without quotes and spaces.

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 auxiliary element of a command. If there is no identifier in a command, there is no identifier in a response.

A text of a command is case-insensitive, therefore 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 to fail. Execution of a command is confirmed by a response notification (see below).

Command Codes

A command code is indicated together, without spaces.

Command CodeDescription
Pn+Switch on a relay n, where n is a relay number
Pn-Switch off a relay n, where n is a relay number
PnRt

Reboot a relay n, where n is a relay number, t is the time of resetting a relay in seconds

Polarity (direction) of switching a relay when performing a reset must correspond to the specified one in the settings of the module «Watchdog» (reset mode). If a relay is already in the reset state, then a reset command will not have any effect, however, a response notification about a successful completion of «NP DONE PnR» will be sent to the sender.

PnWSwitch a relay n to the management mode «Wathdog», where n is a relay number
PnSSwitch a relay n to the management mode «Schedule», where n is a relay number
PnXSwitch a relay n to the management mode «Schedule+Watchdog», where n is a relay number
PnLSwitch 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 a number of an IO line (1..8)
Lm-Switch a line m to the status logic 0, where m is a number of an IO line (1..8)
LmPIssue a pulse to the line m, where m is a number of an IO line (1..8)
Lm?Request a status of a line m, where m is a number of an IO line (1..8)
L?Request a status of all IO lines in a brief form
N?Request a status of pingers on the page «SMS»
KaSend an IR command through the module IRC-TR v2, where a is a number of a command
Tb?Request readings of a temperature sensor b, where b is a number of a temperature sensor
H?Request readings of a humidity sensor
A?Request a battery status (for a device NetPing 2/PWR-220 v2/SMS with a built-in battery).
URequest a balance of a SIM card

Examples of SMS Commands

A command to switch on a relay 1 of a device:

NETPING P1+ SWITCH

A command to switch on a relay 2 of a device:

NETPING P2- SWITCH

Response Notifications to Controlling SMS Commands

Confirmation of a command execution, such as switching a relay or changing a status of a discrete output line:

NP DONE fff kkkkk

where:

fff – is a code of an outcoming command, execution of which is confirmed by this notification. For example, Р1+

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 auxiliary element of a command. If there is no identifier in a command, there is no identifier in a response.


Error when a command is read by a device. Most probably, an incorrect text of an outgoing command:

NP WRONG CMD: "outgoing command kkkkk"

where:

Outgoing command  is a text of an outgoing command, completely quoted.

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 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 outcoming command:

NP WRONG PASSWD IN kkkkk

NP WRONG PASSWD

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 auxiliary element of a command. If there is no identifier in a command, there is no identifier in a response. (the 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:

NP REPLY Pnb kkkkk

where:

n  is a relay number

b  is a relay management mode, possible relay statuses are coded with the next characters: «M+» (manual on), «M-» (manual off), «W» (watchdog), «S» (schedule), «X» (schedule+watchdog), «L» (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 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:

NP REPLY P1bP2b kkkkk

where:

b  is a relay management mode, possible statuses of a relay are coded with the characters: «M+» (manual on), «M-» (manual off), «W» (watchdog), «S» (schedule), «X» (schedule+watchdog), «L» (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 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) about a status of an IO line:

NP REPLY L1=0(IN|OUT|OUT.L) kkkkk

where:

A value L1=0 is provided as an example. Before a symbol «=» there is a number of a line, after a symbol «=» there is a logic level of a line.

IN|OUT|OUT.L – is an operation mode of an IO line, where IN is the «input», OUT is the «output», OUT.L is the «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 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) about a status of all IO lines:

NP REPLY L1=0(IN|OUT|OUT.L) L2=1(IN|OUT|OUT.L) L3=0(IN|OUT|OUT.L) L4=1(IN|OUT|OUT.L) kkkkk

where:

Values L1=0 L2=1 L3=0 L4=1 are provided as an example. Before the symbol «=» there is a number of a line, after the symbol «=» there is a logic level on a line.

IN|OUT|OUT.L – is the operation mode of an IO line, where IN is the «inout», OUT is the «output», OUT.L is the «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 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) about a status of pingers, built into the module SMS:

NP REPLY N1(IP|DNS name)=OK|FAILED N2(IP|DNS name)=OK|FAILED kkkkk

where:

OK – a specified IP address/DNS name responds

FAILED – a specified IP address/DNS name is silent

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 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) about readings of a temperature sensor. A sensor with the number b failed or is not connected:

NP REPLY Tb=? SENSOR FAILED kkkkk

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 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) on the readings of a temperature sensor. A sensor with the number b is in the status «below normal», «normal», «above normal» accordingly:

NP REPLY Tb=tC BELOW|IN|ABOVE SAFE RANGE (t1..t2C) kkkkk

where:

b  is a number of a temperature sensor

t – is a current reading of a temperature, in °C

t1, t2 – are the thresholds of the «normal» temperature range, 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 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 H? community_w kkkkk) on the readings of a humidity sensor. A sensor failed or is not connected:

NP REPLY H=? SENSOR FAILED kkkkk

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 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 H? community_w kkkkk) about readings of a humidity sensor. A sensor is in the status «below normal», «normal», «above normal» accordingly:

NP REPLY H=h% BELOW|IN|ABOVE SAFE RANGE (h1..h2%) T= tC kkkkk

where:

– is a current reading of a relative humidity, in %

h1, h2 – are the thresholds of the «normal» range of a relative humidity, in %

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 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 A? community_w kkkkk) about a battery status (for a NetPing 2/PWR-220 v2/SMS device with a built-in battery):

NP REPLY A? POWER SCR: V, CHARGING: C

where:

– is a power source of a device, can take the next values: «220V» (powering from 220 grid), «BATTERY» (powering from a battery)

С – is a battery charge status, can take the next values: «YES» (a battery is charging), «LOW» (a battery charge is less than 10% of its total capacity)


Requesting a balance of a SIM card (NETPING U community_w kkkkk). A command runs the USSD request. The next SMS notification is sent in a response to a command:

NP DONE U - USSD STARTED, WAIT FOR REPLY BY SMS

Less than in a minute after a device receives a response of its balance, a balance is sent as an individual SMS notification to a sender's number.