I have a RAK7243C gateway and a RAK7431 end device which sends data that it collects from local RS485 devices.
Gateway runs Raspberry Pi OS which I completely updated and enabled the NTP:
pi@rak-gateway:~ $ sudo timedatectl
Local time: Tue 2021-02-23 08:41:18 CET
Universal time: Tue 2021-02-23 07:41:18 UTC
RTC time: n/a
Time zone: Europe/Ljubljana (CET, +0100)
System clock synchronized: no
NTP service: active
RTC in local TZ: no
With the update I also got the Chirpstack components:
pi@rak-gateway:~ $ apt show chirpstack-application-server
Package: chirpstack-application-server
Version: 3.14.0
...
pi@rak-gateway:~ $ apt show chirpstack-gateway-bridge
Package: chirpstack-gateway-bridge
...
pi@rak-gateway:~ $ apt show chirpstack-network-server
Package: chirpstack-network-server
Version: 3.12.1
...
Now I am inside the chirpstack-application-server
web interface where I can’t seem to find a way to include timestamp in the MQTT messages. I want the timestamp from the NTP because in my case GPS might not work in the end.
I choose Service-profiles and click + CREATE to create a new service profile like this:
When the messages come from the end device I can see them in the web interface where I press Applications on the left side menu. Then I select application from the applications list and then the end device from the devices list. If I navigate to the tab DEVICE DATA data I can see event types as described here and they look like this:
If I check the MQTT messages using an external MQTT client they look like this:
{
"applicationID": "9",
"applicationName": "Kynerion--application--001",
"deviceName": "RAK7431--001",
"devEUI": "ac1f09fffe03b4AA",
"txInfo": {
"frequency": 868100000,
"dr": 0
},
"adr": true,
"fCnt": 47271,
"fPort": 2,
"data": "gbmwAAgCAQMCAZC5uA=="
}
- Observation A: Data that is sent over MQTT and what is shown in the web interface don’t match!
- Observation B: There is no time stamp values.
This is even more obvious if I want to add GPS timestamp (I only figured how to add a GPS timestamp but not NTP). In order to add the GPS timestamp I change the service profile like this:
Now web interface shows event types like this:
If I check the MQTT messages using an external MQTT client they look like this:
{
"applicationID": "9",
"applicationName": "Kynerion--application--001",
"deviceName": "RAK7431--001",
"devEUI": "ac1f09fffe03b4d5",
"rxInfo": [
{
"gatewayID": "b827ebfffe17d1bb",
"uplinkID": "429665eb-10dd-4445-9322-c2a134b0db38",
"name": "RAK7243C--001",
"rssi": -31,
"loRaSNR": 8.8,
"location": {
"latitude": 46.03743,
"longitude": 14.51215,
"altitude": 299
}
}
],
"txInfo": {
"frequency": 868500000,
"dr": 0
},
"adr": true,
"fCnt": 47342,
"fPort": 1,
"data": "gbn3AAgBAQMCAGi5qg=="
}
- Observation C: Data that is sent over MQTT and what is shown in the web interface don’t match!
-
Observation D: There are timestamp values i.e.
time
&timeSinceGPSEpoch
(they arenull
because GPS is not exposed to the clear sky at the time of writting) present in the web interface but not in the MQTT messages!
Questions:
- How can I add timestamp values i.e.
time
&timeSinceGPSEpoch
to MQTT messages? - How do I add NTP timestamp instead of the GPS timestamp values?