This guide will walk you though integrating a LWM2M device to Azure IoT Hub using an available solution template.
If you already have an IoT Hub, you can skip this step.
For a detailed walkthrough from Microsoft, check out the following link:
If you have a LWM2M device, you will need to save the following information for later:
If you don't have a LWM2M device, you can use the Anjay open source client from AVSystem. If you already have a LWM2M device, you can skip this step.
Go to https://github.com/AVSystem/Anjay to find the instructions to build and run the Anjay client on your PC. We will cover the required command line arguments in a later step.
You can choose your own endpoint, identity and pre-shared key at this point, or use the randomly generated values as part of the import.
Follow the steps below to import the solution template:
Click Solution Templates at the bottom of any page.
Find the LWM2M to Microsoft Azure IoT Hub template and click Import.
Follow the instructions below to import the template:
You should receive an import result like this:
Now that everything has been imported, you can connect your first LWM2M device.
If you have your own device and entered the credentials in step #4, then you can connect it now.
If you are using the Anjay client, run the client with the credentials generated during the import phase, or that you manually entered. Remember that the identity must be hex encoded.
./output/bin/demo --endpoint-name <endpoint> --server-uri coaps://bs.tartabit.com:5684 --security-mode psk --identity <hex encoded identity> --key <pre-shared key>
You should see that your client reports connected.
Verify that the client is connected by navigating to Endpoints -> List and checking the status.
With the device connected, you should now see it connected in the IoT Hub, and data being updated in the device twin.