0
votes

I'm trying to play with AWS IoT to communicate with multiple identical devices.

So far, so good, all my devices are connected to it, and the only difference between them could be a single device ID (like a mac address or a serial number)

Now I'd like to send a message to a single specific device using its device ID and I don't know if there is a good way to do that?

I could make each device to subscribe to a topic like /<DEVICE_ID>, however it doesn't seem like a good practice especially if I have thousands of devices.

Plus, AWS discourages it as stated in the AWS IoT documentation:

Note

We do not recommend using personally identifiable information in your topics.

Is there a good way to handle this use case? Or is AWS IoT only useful to manage multiple devices at once?

1
did you find any information?GeorgeGeorgitsis

1 Answers

1
votes

Here is the best practice for creating an MQTT topic.

https://www.hivemq.com/blog/mqtt-essentials-part-5-mqtt-topics-best-practices/

Talking about your specific case

  • Each device needs to have a unique identity to send a command to a particular device. In this case, you need to have device_id into your MQTT topic.
  • You can use the following pattern to send a message for a destination device
  • protocol_prefix / type_of_message / dest_id / message_id
  • hexaiot/controldevice/d12345/x123
  • Use wild card character at the time of device subscription to subscribe to the topic