Schedule a downlink via MQTT does not work in V4?

Hi all,
I used to schedule a downlink by publishing into MQTT in V3 and it worked well.

Topic: application/1234/device/aXXXX41c161832b12/command/down
Data: {"fPort":2,"confirmed":true,"object":{"method":"setAL2Value","id":0,"params":true}}

However, in V4, publishing into the topic doesnt work any more.
The documentation seems no change compared to V3: MQTT - ChirpStack open-source LoRaWAN® Network Server documentation
There is no queue at Application > Device.
And the gateway doesn’t receive the data.

Topic: application/XXXX8bd18-01d8-44ed-ba31-67d0b53456e1/device/a84041c161832b12/command/down
Data: {"fPort":2,"confirmed":true,"object":{"method":"setAL2Value","id":0,"params":true}}

When I put {“method”:“setAL2Value”,“id”:0,“params”:true} at the Application > Device > Queue, the gateway and node can receive the downlink.

It seems the chirpstack server doesn’t subcribe to the downlink topic anymore?
Please help to advise me.
Thanks a lot.

The format in v4 seems to change.

sudo journalctl -f --unit=chirpstack | grep down

Sep 20 12:53:40 ip-10-0-11-149 chirpstack[97102]: Sep 20 12:53:40.381 ERROR chirpstack::integration::mqtt: Processing command error: unknown field `abc`, expected one of `id`, `devEui`, `confirmed`, `fPort`, `data`, `object` at line 1 column 6 topic="application/xxxxxxx-01d8-44ed-ba31-67d0b53456e1/device/xxxxxx1c161832b12/command/down" qos=0

Still have error on the format of “devEui”. No idea what is the first “id” used for.

Sep 20 13:20:20 ip-10-0-11-149 chirpstack[97102]: Sep 20 13:20:20.873 ERROR chirpstack::integration: Handling downlink command error dev_eui=xxxxxxc161832b12 error=invalid length: expected length 32 for simple format, found 1

{"id":"1", "devEui":"xxxxxxc161832b12", "fPort":2,"confirmed":true,"object":{"method":"setAL2Value","id":0,"params":false}}

Downlink enqueue with MQTT seems to be working for me. I’m not using downlink encoder tho. I did not provide any “id” but I had to provide “devEui” as opposed to what doc says:

The Application ID and DevEUI of the device will be taken from the topic.

chirpstack[1329]: Sep 20 10:38:08.657 ERROR chirpstack::integration::mqtt: Processing command error: Payload dev_eui  does not match topic dev_eui 0123456789abcdef topic="application/00000000-0000-0000-0000-000000000001/device/0123456789abcdef/command/down" qos=0

Example:

mosquitto_pub -t "application/00000000-0000-0000-0000-000000000001/device/0123456789abcdef/command/down" -u mqttuser -P mqttpass  -h localhost -p 1883 -m "{\"devEui\":\"0123456789abcdef\", \"confirmed\": false, \"fPort\": 1, \"data\": \"base64encodedData\" }"
1 Like

@martin Let me try again. Thanks a lot.

It works now for json!
v4 requires devEui.

{“devEui”:“xxxxxxc161832b12”, “fPort”:2,“confirmed”:true,“object”:{“method”:“setAL2Value”,“id”:0,“params”:false}}

Thanks a lot. :smiley:

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.