Error when sending message to device


Our device needs to have it’s time set, so that the timestamps of events are recorded properly.

The manufacture’s instructions are:
3.Packet with time correction request, sent every seven days on LoRaWAN port 4
Size in bytes Field description
1 byte Packet type, this packet == 255
4 bytes Time of the modem at the moment of the packet transmission
(unixtime UTC)
After receiving this type of package, the application can send to modem the packet with time correction.

So I have been trying to send the necessary message to the device.

So far, from reading the documentation, I have changed the lora-app-server.toml file to accept mqtt integration using the config file shown in the documentation (we are running Lora Server OS on a Lorix One).

I then sent a mqtt message from the command line as follows:
mosquitto_pub -t application/4/device/303138336D385301/tx -f time_update.json -d

where the time_update.json file has this internal data:
{“confirmed”: true,“fPort”: 4,"data:“w78=XYDnSg==”}

The message seems to be accepted when I subscribe via mosquitto_sub -v -t “application/#” as per the feedback below:

application/4/device/303138336D385301/tx {
?“confirmed”: true,
?“fPort”: 4,

application/4/device/303138336D385301/tx {“confirmed”: true,“fPort”: 4,"data:“w78=XYDnSg==”}

but when monitoring the lora-app-server using /opt/lora-app-server/lora-app-server

I see the following error
ERRO[0487] integration/mqtt: tx payload unmarshal error: invalid character ‘w’ after object key data_base64=“eyJjb25maXJtZWQiOiB0cnVlLCJmUG9ydCI6IDQsImRhdGE6Inc3OD1YWURuU2c9PSJ9Cg==”

Can anyone point out what I am doing wrong?

I found an error in my JSON file, it should have been {“confirmed”: true,“fPort”: 4,“data”:"w78=XYDnSg==”} (missing inverted comma)

So now it appears that the message gets sent, but sadly still not getting the time changed on the device. But that is probably just due to my not understanding the complexities of sending bytes - so will keep digging.

Your data field is suspect. The = is used for padding in base64, which shouldn’t be in the middle of the value.

$ echo w78=XYDnSg==|base64 -D|hexdump -C
00000000  c3 bf                                             |..|
$ echo w78=|base64 -D|hexdump -C
00000000  c3 bf                                             |..|

Thanks, will look into that