Adding variables to MQTT topic urls in Routes

Hi, I’m trying to integrate our product with a third party whose API requires us to insert a unique token into the MQTT topic URL.

Is there a way to dynamically insert this in a similar way to how JSONata works, I.E. “body.deviceToken” ?

Apologies if this has been covered or is lurking somewhere in the docs that I have not seen.

Hi @ptbkt ,

Yes, you can substitute DeviceUID, ProductUID, or device serial number in the topic URL. It’s actually documented in the MQTT route guide.

1 Like

Thank you @RobLauer, I knew there was probably something I’d not ready properly :slight_smile:

1 Like

@RobLauer , @tjvantoll - this will send the NoteCard device ID to the route. Is it possible for me to send the ID of the END LORA device in the MQTT topic?

Also, it would be nice if I didn’t have to pick each individual #air.qo file for the route rather than list air.qo as the file time and having ALL of them routed. As it works now I would have to modify the route every time I added another sensor even if nothing has changed other than just adding a sensor!

Hey @jlandgrave62,

Is it possible for me to send the ID of the END LORA device in the MQTT topic?

You can do this by manually including the identifier in the topic (aka providing the 2037335832365003004e001d in 2037335832365003004e001d#motion.qo), but there’s no built-in substitution shorthand like [device].

Also, it would be nice if I didn’t have to pick each individual #air.qo file for the route rather than list air.qo as the file time and having ALL of them routed. As it works now I would have to modify the route every time I added another sensor even if nothing has changed other than just adding a sensor!

Ah, interesting. Just so I understand your desired behavior—you’d like to be able to select a file on a route (e.g. air.qo) and have it automatically route all air.qo events on that gateway regardless of which sensor they came from?

And thanks for all this feedback :slightly_smiling_face:

TJ