[ENG] 14.8. [DKSF 54.3 IU] How to Control a Device Using SMS Commands

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

The syntax of SMS Commands

A common format of the text of an SMS command:

NETPING fff community_w kkkkk

where:

  • fff – is a command code, for example, Р1+ (see below);
  • community_w – is a password that corresponds to the SNMP community write. It is set 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 (random number). It is repeated in a response for setting 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 text of a command is insensitive to the case, it is possible to use both uppercase and lowercase letters. Command elements are separated by spacesIt is not acceptable to use the next characters: ‘ (apostrophe), “ (quote), @. Including these characters may cause the firmware to fail. Executing a command is confirmed by a response message (see below).

Command Codes

A command code is specified together, without spaces.

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

Reboot relay n, where n - is a relay number

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

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
N?Request a pinger status
Tb?Request readings of a temperature sensor b, where b - is a number of a temperature sensor
T?Request a status of all connected temperature sensors in a brief form
Hx?Request a status of a humidity sensor x, where x - is a number of a humidity sensor
A?Request a battery status
RB20Reboot a device

Examples of SMS Commands

A command of switching on a relay 1 of a device:

NETPING P1+ SWITCH

A command for switching off a relay 2 of a device:

NETPING P2- SWITCH

Response Notifications to SMS Commands

Confirmation of executing a command, such as switching a relay:

NP DONE fff kkkkk

where:

  • fff – is an original command execution of which is confirmed by this notification. For example, Р1+
  • kkkkk – is a request identifier (random 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


An error when a device read a command. Most probably, incorrect text of an original command:

NP WRONG CMD: "original command kkkkk"

where:

  • Original command  is a text of an original command that is quoted entirely;
  • kkkkk – is a request identifier (random 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

 

Incorrect password (Community) in an original command:

NP WRONG PASSWD IN kkkkk

NP WRONG PASSWD

where:

kkkkk – is a request identifier (random 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 second command).

Response Notifications for SMS Commands of Requesting a Status/a State

A response to a request (NETPING Pn? community_w kkkkk) on a relay status:

NP REPLY Pnb kkkkk

where:

  • n – is a relay number;
  • b is a relay status, possible statuses of a relay are coded by characters: «+» (on), «-» (off);
  • kkkkk – is a request identifier (random 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 P? community_w kkkkk) about a status of all relays:

NP REPLY P1b P2b P3b P4b kkkkk

where:

  • b – is a status of a relay, possible statuses of a relay are coded by characters: «+» (on), «-» (off).
  • kkkkk – is a request identifier (random 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 reponse to a request (NETPING N? community_w kkkkk) about a status of a pinger built in the SMS module:

NP REPLY N=1 kkkkk

NP REPLY N=0 kkkkk

where:

  • N=1 – a specified address responds;
  • N=0 – a specified address is silent;
  • kkkkk – is a request identifier (random 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) about values of a temperature sensor. A sensor with a 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 (random 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) about values of a temperature sensor. A sensor with a number b has a status «below safe», «safe», «above safe» correspondingly:

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

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

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

where:

  • b – is a number of a temperature sensor;
  • t – is a current reading of temperature, in °C;
  • t1, t2 – limits of a «safe range» of temperature, in °C;
  • kkkkk – is a request identifier (random 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 T? community_w kkkkk) about a status of all connected temperature sensors in a brief form:

NP REPLY T2=21C SAFE (10..30C) T5=? T6=39C ABOVE (10..30C) kkkkk

where:

  • BELOW / SAFE / ABOVE – is a status of a temperature sensor;
  • ? – failed or disconnected (with a specified address though) sensors are displayed as T5=? without a status and showing the limits of a «safe range» of temperature, in °C;
  • kkkkk – is a request identifier (random 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;
  • Not used sensors with empty 1W addresses are missed.


A response to a request (NETPING Hx? community_w kkkkk) about the readings of a humidity sensor. A sensor with a number x failed or is not connected:

NP REPLY Hx=? SENSOR FAILED kkkkk

where:

  • x – is a number of a humidity sensor;
  • kkkkk – is a request identifier (random 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 Hx? community_w kkkkk) about the readings of a humidity sensor. A sensor with a number x has a status «below safe», «safe», «above safe» correspondingly:

NP REPLY Hx=h% BELOW SAFE RANGE (h1..h2%) T= tC kkkkk

NP REPLY Hx=h% IN SAFE RANGE (h1..h2%) T= tC kkkkk

NP REPLY Hx=h% ABOVE SAFE RANGE (h1..h2%) T= tC kkkkk

where:

  • h – is a current reading of relative humidity, in %;
  • h1, h2 – are limits of a «safe range» of relative humidity, in %;
  • t – is a  current reading of temperature, in °C;
  • kkkkk – is a request identifier (random 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 A? community_w kkkkk) about a battery status:

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

where:

  • V – is a power supply source for a device, it can take the next values: «220V» (power from 220V), «BATTERY» (power from the battery);
  • С – is a battery status, it can take the next values: «OK» (reaching a full charge of a battery), «LOW» (low battery), «NO» (not charging);
  • kkkkk – is a request identifier (random 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.