How to distinguish between gateway device and peripheral device in MQTT communication

I have a question about identifying gateway devices and peripheral devices in MQTT communication.

In the documentation,

・losant/my-gateway-id/state

・losant/my-peripheral-device/state

It says that the devices are identified by my-gateway-id and my-peripheral-device in the above topic, but could you tell me if there are any other ways to identify them?

Hi @Rei_Naraoka and welcome to the Losant Forums!

my-gateway-id and my-peripheral-device are just placeholders; what is actually in that spot is the ID of the device.

So, given a gateway device whose ID is 111122223333444455556666, it will publish state on the topic losant/111122223333444455556666/state.

You can also write an application workflow with a Device: State Trigger targeting one or more devices, and identifying information about the device that published a message on that topic - including its ID, name, and meta tags - will be on the initial payload.

Let us know if you have any more questions!

Thank you for your reply.
Am I correct in understanding that if you want to publish information about multiple peripheral devices at once, you should use the workflow function?

The Device State Node can only publish data about a single device in one invocation, but you may invoke that node multiple times in a single workflow run - such as within a Loop Node.

So yes, if you have telemetry data for multiple devices in hand in a workflow environment, that is how you would publish data for those devices.