Unable to decode uplink input on Tektelic Ag sensor

Greetings all. I am working with an older Tektelic Agriculture sensor and am having trouble with decoding in the codec. The sensor is connected to Chirpstack and I am able to read data without issue and send downlink commands via MQTT. When the uplink is invoked immediately following a downlink invocation, the codec is unable to process the input stating that it is unable to decode the header. It is not clear to me where the data passed into decodeUplink originates. Can anyone point me in the right direction?

Downlink invocation:

mosquitto_pub -t "application/XXXXXXXXX/device/YYYYYYYYYYYYY/command/down" \
-h localhost \
-p 1883 \
-m '{"devEui":"YYYYYYYYYYYYY, "confirmed": false, "fPort": 100, "object": { "periodic_tx_config": { "tick_per_relative_humidity": { "write": 1} } } }'

Response from encodeDownlink():

{"bytes":[163,0,1]}

Sample decodeUplink input:

{"bytes":[83,198,44,80],"fPort":100,"recvTime":"2024-07-17T19:39:32.396Z","variables":{}}

The decodeUplink function is too large to paste into the post but it was borrowed from the Tektelic Kiwi/Clover decoder on github.

Any guidance would be greatly appreciated. Thank you.

Is there actual need to decode the confirmation?

If you look at the events tab of the device. The “data” field is the value that is actually passed into the function. This is decrypted from the FRMPayload field in the encrypted packet in the gateways LoRaWAN frames which is decoded from the phyPayload in the MQTT message.

You can read more here: Manually decode PHYPayload or decrypt FRMPayload - #13 by nikospps

1 Like

Thank you very much, @Liam_Philipp. I will dig into the link.

Hi @rsebi. I was looking for confirmation that the downlink was successful and didn’t error out. Otherwise, I would have make a separate call to determine the latest settings. If there is another/better way to do so, please let me know.

Usually i see a ‘txack’ right after a downlink. You could also try ‘confirmed’ downlink while sending data to the lora node.

As i understand these ack’s cannot be decoded even with vendor provided decoder.