Sphensor
–
User manual
LSI LASTEM SRL
INSTUM_04291
Pag. 29 / 32
9
Application protocol
Sensors communicate with Sphensor Gateway via binary protocol to save on transmission and hence on bat-
tery. Sphensor Gateway is now able to deserialize some of these messages and forward them to one or more
MQTT brokers as per configuration. These messages are converted from binary format to JSON format to
allow modern integration systems to read and interpret them simplifying the development phase.
The MQTT topics used in publish and subscribe by Sphensor Gateway are composed by the following pream-
ble:
sphensor/<serial>/<subject>/<action>
where:
•
sphensor
: distinguishes the message related to the Sphensor system.
•
serial
: is the Sphensor Gateway serial that radio sent/received the message to/from the sensor and
received/sent it via MQTT. The same serial can be found on the Sphensor Gateway label.
•
subject
: the value of this parameter can be
hub
if the message is generated or intended for Sphensor
Gateway otherwise it is the native sensor serial that is the generator or recipient of the message.
•
action:
the rest of the MQTT topic represents the action taken by the target or sent to it.
9.1
Instanteous data snapshots
One of the most important messages sent by Sphensor Gateway is the message of the grouped snapshots: in
this message, the values of all the measurements configured in the sensor are sent with the updated value
at the most recent sampling.
The topic of the message is as follows:
sphensor/<seriale_border_router>/<seriale_sensore>/grouped_inst
The format of this message is an array of JSON objects, such as the following:
[
{
"timestamp": "2020-01-03 06:03:27",
"sensor_type": "opt3001_4",
"value": 2.2177724838256836,
"result": "ok",
"channel_index": 0
},
….....
]
where:
•
The
timestamp
field contains the data recording time, in UTC, stored in the sensor. If the sensor has
not yet obtained the current time from Sphensor Gateway then the transmitted time will be equal
to the sensor’s turn on time from the date 2020
-01-01 00:00:00. NOTE: Sensors are currently not
enabled to receive time from Sphensor Gateway.
•
The
sensor_type
field contains the name of the measurement cell that produced the measurement
and its index when there is more than one measurement cell of that type.