Downlink data from bridge to tag

Hello everyone,
a question regarding the new PANS2 firmware came up and after digging through the documentation I still didn’t have an answer. So I’m trying it here.

Is there an api call to send data to a specific node from the bridge node? Currently the only way to send data seems to be through the Gateway Web Interface.

Thanks in advance,
Thorsten

Hi Tofu,

If you wish to do that, you need to write to the mqtt topic corresponding to the node.

The idea is to communicate with nodes through MQTT, but not with low levels API.

Thanks
Yves

1 Like

Hi Thorsten,

yes, as Yves has written, you can send it easily by publishing a MQTT message to the MQTT broker on your gateway.

If you subscribe to the broker using e.g. mosquitto_sub, you can see the format of data. E.g. run this on your Raspberry PI:

$ mosquitto_sub -h localhost -t ‘dwm/node/+/downlink/#’

and then send some user data via the Web Manager. You should see something like:

dwm/node/11cb/downlink/data {“data”:“ASNFZ4mrze8=”,“overwrite”:false}

Similarily you can publish using mosquitto_pub or other MQTT client so the data would be forwarded to the module. E.g.:
echo ‘{“data”:“ASNFZ4mrze8=”,“overwrite”:false}’ | mosquitto_pub -h localhost -p 1883 -t ‘dwm/node/11cb/downlink/data’ -l

Cheers,
TDK

3 Likes

Hi TDK,

I am trying the commands in Rpi
mosquitto_sub -h localhost -t ‘dwm/node/8E31/downlink/data’

Later I opened message of my 8E31 tag and try to send message as 0xAA. But, No response. Could you please explain little bit detail.

I can upload IOT data from Webapp to TAG node successfully. But i am not able to do it via MQTT.

I see webapp also uses MqTT. May I know details of the topics?

Thanks,
Nav

Hi there,

in order to send data via MQTT to the node, you should publish to topic

dwm/node/<node_id>/downlink/data

The format of data must be

{“data”:“ASNFZ4mrze8=”,“overwrite”:false}

Where “ASNFZ4mrze8=” is the data in base64 format.

A simple shell function to send data can look like this:

mqtt_data_pub()
{
    if [ "$#" -ne 4 ]
    then
        echo "mqtt_data_pub: missing argument"
        return 1
    fi

    ARGC=$#
    MQTT_HOST=$1
    MQTT_PORT=$2
    NODEID=$3
    MSG=$4
    MQTT_PUB=mosquitto_pub

    MSG_BASE64=`echo -n $MSG | base64`
    MSG_JSON="{\"data\":\"$MSG_BASE64\"}"

    echo $MSG_JSON | \
        $MQTT_PUB \
            -h $MQTT_HOST \
            -p $MQTT_PORT \
            -t "dwm/node/$NODEID/downlink/data" \
            -l
}

Cheers,
TDK

2 Likes

Hello again,

thank you all for the great help. Something like MQTT is perfect for the task and I’m happy one does not have to go too lowlevel to send some data around.

Best regards,
Thorsten

Awesome. It worked.

Thanks a Lot

Nav

hi
is it only way bridge send downlink message to specific node Using mqtt

Is there any way to send non-location data between nodes aside from via MQTT? I have multiple different devices in the field which I want to use the DWM1001C on and am trying to use the distance between 2 nodes, one of which needs to be a tag, to trigger an RF transmission. Each of these different device types has different behavior for starting an RF transmission, as well as different channel limitations so I was hoping to be able to send something like the device label as a unique identifier to say what type of device it is and to undergo a process to translate it into a channel number within these limitations.