[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:
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 Code | Description |
---|---|
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 |
RB20 | Reboot a device |
Examples of SMS Commands
A command of switching on a relay 1 of a device:
A command for switching off a relay 2 of a device:
Response Notifications to SMS Commands
Confirmation of executing a command, such as switching a relay:
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:
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:
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:
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:
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:
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:
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:
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:
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:
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:
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:
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.