In this tutorial, you will see how to configure mqtt.fx software to connect and send messages to IoT Hub, and get this messages from DragonBoard.
Set Up MQTT.fxDownload MQTT.fx: http://mqttfx.jfx4ee.org/index.php/download then install, after installation, open the software and add a new mqtt profile.
- Broker address: example.azure-devices.net (IoT Hub Host name)
- Broker port: 8883
- Client ID: DeviceID
- Username: example.azure-devices.net/DeviceID
- Password: you need to generate a SAS Token to device
- Download Microsoft Device Explorer: https://github.com/Azure/azure-iot-sdks/releases/d...
- Insert your connection string
- Click on a device
- SAS Token
- Insert how much days this token will be valid
- Click on generate button
- Copy this part: SharedAccessSignature sr=example.azure-devices.net%2fdevices%2fDeviceID&sig=----------------rdLSJnZMxaQ5H7qSJeEc%3d&se=-------88894
- Put this string in password box
- Enable SSL/TLS
- Click on CA signed server certificate
Once connected, click on publish and publish a message to this topíc:
devices/<DeviceID>/messages/events/
Configure Sigfox CallbackIts very easy to set up a callback in Sigfox backend, so go to https://backend.sigfox.com and sign in your account!
- Click on Device Type button
- CALLBACKS
- New
- Select Microsoft IoT Hub
- In the next window paste your connection string and configure a custom message to send to the Hub.
Ok, your callback was successfully created!
Set Up DragonBoardInstall Nodejs and npm on DragonBoard:
- $ sudo apt-get install nodejs
- $ sudo apt-get install npm
Create a folder, and into this folder create a file named readdevicetocloudmessages.js
- $ npm init
- $ npm install azure-event-hubs --save
Copy the attached file code and past into js file.
Run the code:- $ node readdevicetocloudmessages.js
Ok, now all messages posted in your hub will be read by DragonBoard, this way you can follow all activities of yor devices.
Comments