# Associate DEVICE\_ID from mqtt device

**URL:** <https://forums.losant.com/t/associate-device-id-from-mqtt-device/1372>\
**Category:** Help\
**Created:** [December 21, 2018, 9:19pm UTC](https://forums.losant.com/t/associate-device-id-from-mqtt-device/1372 "2018-12-21T21:19:04Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![paul\_wareham](https://avatars.discourse-cdn.com/v4/letter/p/ed8c4c/32.png) [@paul\_wareham](https://forums.losant.com/u/paul_wareham)\
**Post date:** [December 21, 2018, 9:19pm UTC](https://forums.losant.com/t/associate-device-id-from-mqtt-device/1372/1 "2018-12-21T21:19:04Z")

</div>

I’m wondering if there are any best practice suggestions on matching Losant DEVICE\_IDs with the native identification of mqtt devices in the field? The built-in Losant mqtt state update assumes the DEVICE\_ID is in the topic name which makes it really seamless because a workflow is not even needed. However, I need to figure out how the field device will know the Losant device ID or the way around.

Seems to me there are two options?

1. Have the field device use the API to lookup the DEVICE\_ID before publishing to mqtt.
2. Send another identifier from the field device and use a Workflow to looking a tag to associate the DEVICE\_ID.

Are there any other ways outside of this?

Thanks!

Paul

---

<div class="post-metadata">

**Author:** ![Brandon\_Cannaday](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.losant.com/brandon_cannaday/32/14_2.png) [@Brandon\_Cannaday](https://forums.losant.com/u/Brandon_Cannaday)\
**Post date:** [December 21, 2018, 9:34pm UTC](https://forums.losant.com/t/associate-device-id-from-mqtt-device/1372/2 "2018-12-21T21:34:37Z")

</div>

This article describes a common process that’s been successfully implemented. Essentially it uses something similar to what you outlined in #1. The device does a round-trip to a Endpoint to register and receive its MQTT authentication details.

> **[How Devices Can Register Themselves in Losant](https://www.losant.com/blog/how-devices-can-register-themselves-in-losant)**
>
> An example of how devices can perform self-registration in the Losant IoT Platform.
