MESSAGING


Commands that allow the sending of alerts or messages:


SEND EMAIL


Send an email through SMM Server, which must be active and reachable.


Command

AT#EMAIL=<rcpt>,<subject>[,<body>][,<icon>]

Response

OK

COMMAND ACCEPTED


ERROR

COMMAND REJECTED

PARAMETERS

<rcpt>

RECIPIENT'S EMAIL ADDRESS

GROUP NAME YOU WANT TO SEND TO ALL MEMBERS


<subject>

SUBJECT OF THE MESSAGE, CAN INCLUDE TAGS


<body>

OPTIONAL BODY OF THE MESSAGE, CAN INCLUDE TAGS


<icon>

OPTIONAL ICON TO BE SHOWN WITHIN THE MESSAGE


The body field can contain free text within which the use of TAGs is allowed, or it may contain preformatted information composed by the SMM server specifying the following keywords:

  • LOG: send the log file stored in the cloud account
  • MAP: send the device map stored in the cloud account


Alternatively, you can specify the complete path of a file in the device memory to be sent as an attachment. The file must contain TEXT ONLY and will be sent with a name that represents the current date and time (e.g.: 220617_091821.txt). In this way, subsequent submissions of the same file (for example a log) will be sent with a unique name that shows the date on which it was sent.


When the device map is sent, it is possible to specify the identifier of an icon to show, selected among the available ones, see EMAIL ICON


NOTE: to prevent abuse and increase safety, email with attachments will be sent only to email addresses stored in Avior user list.


WARNING: Avior prevents the sending of duplicate messages.

A message identical to the previous one is discarded and reported in the log with the same progressive identifier. To differentiate the messages it is sufficient to insert a variable field, for example the time.

Since email messages transit from different servers it is not guaranteed their delivery in the same order in which they were sent, so it is good practice to insert a timestamp.


You can check if and when an email message has been viewed by a recipient using an API call.

SEND CHAT MESSAGE


Sends a Telegram chat message through the SMM Server, which must be active and reachable. Messages can only be sent to users stored in the device.Calls can only be made to users stored in the device.


Command

AT#TGM=<rcpt>,<text>,<type>

Response

OK

COMMAND ACCEPTED


ERROR

COMMAND REJECTED

PARAMETERS

<rcpt>

RECIPIENT'S PHONE NUMBER

GROUP NAME YOU WANT TO SEND TO ALL MEMBERS


<text>

TEXT OF THE MESSAGE, CAN INCLUDE TAGS


<type>

M : SIMPLE TEXT MESSAGE

G : TEXT MESSAGE INCLUDING GEO INFO

S : TEXT MESSAGE INCLUDING DEVICE STATUS

L : TEXT MESSAGE INCLUDING SYSTEM LOG

K : TEXT MESSAGE INCLUDING ON/OFF KEYBOARD

P : TEXT MESSAGE INCLUDING PULSE KEYBOARD

B : TEXT MESSAGE INCLUDING CUSTOM KEY 

Q : TEXT MESSAGE AS QRCODE


The recipient's number must be entered in international format.

For the chat message format options, see TELEGRAM.

MAKE A CHAT PHONE CALL


Originates a telephone call to a Telegram user through the SMM Server, which must be active and reachable. Calls can only be made to users stored in the device. Users must have a Telegram username.


Command

AT#TGM=<rcpt>,<text>,V[,<lang>,<rpt>]

Response

OK

COMMAND ACCEPTED


ERROR

COMMAND REJECTED

PARAMETERS

<rcpt>

RECIPIENT'S PHONE NUMBER


<text>

TEXT OF THE MESSAGE, CAN INCLUDE TAGS


V

VOICE MESSAGE TYPE


<lang>

THE LANGUAGE OF THE MESSAGE (OPTIONAL)


<rpt>

NUMBER OF TIMES THE MESSAGE WILL BE SPEAKED (1...4)

(OPTIONAL, DEFAULT = 1)


You can specify the language to use by simply indicating the ISO code (for example en for English), if omitted the language used in the user's chat will be used.

You can also indicate the type of voice by choosing here only standard voices (not Wavenet) eg: en-GB-Standard-C.

Calls are queued to be made sequentially, typically within 1 minute of being requested. Greater delays are possible if a large number of calls are in progress.

SEND TO COM PORT


Send a text to the com port.


Command

AT#COM=<text>

Response

OK

COMMAND ACCEPTED


ERROR

COMMAND REJECTED

PARAMETERS

<text>

TEXT TO SEND TO LOCAL COM PORT (CAN INCLUDE TAGS)

%0A new line

%0D carriage return

HTTP REQUEST


Make an HTTP request to the specified address, a data connection must be available.


Command

AT#HTTP=<method>,<url>[,<data>]

Response

OK

COMMAND ACCEPTED


ERROR

COMMAND REJECTED

PARAMETER

<method>

GET | POST | PUT | DELETE


<url>

DESTINATION URL


<data>

TEXT TO POST, CAN INCLUDE TAGS or

COMPLETE PATH AND FILE NAME TO SEND CONTENT


The response returned by the server is always ignored.

It is possible to include a custom tag X-command within the header of the response, any command found in its value will be executed.


It is possible to specify custom destination port at the end of URL using the canonical format: https://mysite.com:1234


NOTE: The use of TAGs that refer to variables within the URL can cause errors or crashes of the device due to improper or not yet available content (processing in progress).


NOTE: It is possible to execute HTTPS (HTTP Secure) only via WiFi network (firmware version 02.28 or above) and via 4G modem (firmware version 01.21 or above). 

HTTPS may not be supported on some WiFi networks. 2G modem doesn't support HTTPS request: they will be made as HTTP request.


A SWAP AREA is made available for each unit to upload/download free content. Available size is limited to 200k. 

For each unit a SWAP AREA is available to upload / download free content (up to 200 k) made available also as RSS Feed / Alexa.


Example to append the text  abc...  to the  gxl0  SWAP AREA: 

AT#HTTP=POST,https://www.mobikey.eu/swap/gxl0/pwd/0000,"abc..."

CLOSE THE BLE CONNECTION


Close the connection with the BLE device.

The command has no effect if no BLE device is connected.


Command

AT#BTH

Response

OK

COMMAND ACCEPTED


ERROR

COMMAND REJECTED


The connection to the BLE device is automatically closed, anyway,  after 20 seconds of inactivity.

SEND UDP MESSAGE


Send a message using UDP protocol to specified IP address and port.

Available for 4G units only.


Command

AT#UDP=<ipaddress>,<port>,<text>

Response

OK

COMMAND ACCEPTED


ERROR

COMMAND REJECTED

PARAMETERs

<ipaddress>

DESTINATION IP ADDRESS


<port>

DESTINATION UDP PORT


<text>

MESSAGE TO BE SENT (CAN INCLUDE TAGS)


Send message "Hello Avior" to IP address 123.130.140.150 port 1234:

AT#UDP=123.130.140.150,1234,"Hello Avior"

OK


PUBLISH MQTT MESSAGE


Publish an MQTT message to broker, specifying topic, payload and QoS.


Command

AT#MQTT=<topic>,"<payload>",<qos>[,<retain>]

Response

OK

COMMAND ACCEPTED


ERROR

COMMAND REJECTED

PARAMETERs

<topic>

MESSAGE TOPIC, CAN INCLUDE TAGS


<payload>

MESSAGE PAYLOAD, CAN INCLUDE TAGS

OR COMPLETE PATH AND FILE NAME TO SEND CONTENT


<qos>

QUALITY OF SERVICE


<retain>

KEEP THE LAST MESSAGE 1

(FORWARD TO EACH NEW SUBSCRIBER)


If a message is successfully published an MQT event is triggered.


Publish text "gate is open" to topic "mytopic/home/garage" with QoS=1:

AT#MQTT=mytopic/home/garage,"gate is open",1


Publish text with tags ($D01 is the device identifier, $I12 is the status of digital input 1 and $O42 is the status of output 4) with QoS=0:

AT#MQTT=mydevice/$D01,"in1=$I12 and out4=$O42",0


Publish file located in SDcard S:LOGS/data.log to topic "system/file:

AT#MQTT=system/file,S:LOGS/data.log,1


1        To delete a retained message send a blank message with retain = 1 :
       AT#MQTT=mytopic/home/garage,"",1,1

MODBUS RTU READ REQUEST


Read Modbus RTU data from COM port.


ComMAnd

AT#RTUR=<slaveAddr>,<functCode>,<startReg>,

<numReg>,<dataType>,[<options>],<dest>

Response

OK

COMMAND ACCEPTED


ERROR

COMMAND REJECTED

PARAMETERS

<slaveAddr>

ADDRESS OF MODBUS SLAVE

1 ... 247


<functCode>

MODBUS FUNCTION CODE

1 : READ COILS

2 : READ DISCRETE INPUTS

3 : READ HOLDING REGISTER

4 : READ INPUT REGISTERS


<startReg>

STARTING REGISTER

0 ... 65535


<numReg>

NUMBER OF DATA TO BE READ

1 ... 32


<dataType>

DATA TYPE

B: BIT (for function code 1 e 2)

W: WORD - 16 bit (for function code 3 e 4)

D: DOUBLE - 32 bit (for function code 3 e 4)

F: FLOAT - IEEE754 (for function code 3 e 4)


<options>

READ OPTONS (CAN BE EMPTY)

S: data interpreted as a signed numbers (dataType W and D)

I: endianess inversiom (dataType D)

SI: both options above


<dest>

DESTINATION OF READ DATA (WHERE TO SAVE)

E01 ... E32


<dest> indicates the position of the first read data, following data are saved in next positions. Thus, if 4 data are read and destination is E06, the data are saved in E06, E07, E08, E09.

Returns ERROR if number of data to be read exceed E32 position.


AT#RTUR=8,1,5,2,B,,E04

Read request with following parameters:

- slave address: 8

- function code: 1 (lettura di coils)

- starting modbus register: 5

- number of coils to read: 2

- data type: BIT

- options: none

- destination: E04 (stored in E04, E05, E06, E07, E08)


AT#RTUR=9,3,6,1,W,S,E01

Read request with following parameters:

- slave address: 9

- function code: 3 (lettura di holding register)

- starting modbus register: 6

- number of register to read: 1

- data type: WORD (16bit)

- options: S data to be treated as signed number

- destination: E01


AT#RTUR=123,4,8,3,D,,E14

Read request with following parameters:

- slave address: 123

- function code: 4 (lettura di input register)

- starting modbus register: 8

- number of data to read: 3

- data type: DOUBLEWORD (32bit = 6 registri modbus da16bit)

- options: none, data composed taking two registers

- destination: E14 (saved in E14, E15, E16)

MODBUS RTU WRITE REQUEST


Write Modbus RTU data to COM port.


ComMand

AT#RTUW=<slaveAddr>,<functCode>,<Reg>,<data>

Response

OK

COMMAND ACCEPTED


ERROR

COMMAND REJECTED

PARAMETERS

<slaveAddr>

ADDRESS OF MODBUS SLAVE

1 ... 247


<functCode>

MODBUS FUNCTION CODE

5  : WRITE COIL

6  : WRITE 1 HOLDING REGISTER

16 : WRITE 2 HOLDING REGISTERS



<Reg>

STARTING REGISTER (TO BE WROTE)

0 ... 65535


<data>

VALUE TO BE WRITTEN, CAN INCLUDE TAG

0|1: FOR COIL

0...65535: FOR WORD

0...4294967294: FOR DOUBLE


AT#RTUW=3,5,2,1

Write request with following parameters:

- slave address: 3

- function code: 5 (write single coil)

- modbus register to be written: 2

- data to be written: 1 (set coil)


AT#RTUW=77,6,3456,$V11

Write request with following parameters:

- slave address: 77

- function code: 6 (write holding register)

- modbus register to be written: 3456

- data to be written: value of variabile "var1" ($V11)


AT#RTUW=207,16,521,$E30

Write request with following parameters:

- slave address: 207

- function code: 16 (write 2 holding registers, 32 bit)

- modbus register to be written: 521

- data to be written: content of E30 ($E30)