Changes

no edit summary
Line 283: Line 283:  
[[File:Azure25_RUTX.png|border|class=tlt-border|600px]]
 
[[File:Azure25_RUTX.png|border|class=tlt-border|600px]]
   −
==Setting router to Forward MQTT messages/commands to Azure IoT Hub==
+
==Sending data with "Data to Server" feature==
<div>First you will need MQTT broker to subscribe to, for testing purposes we will set MQTT Broker in same router, and will use PC from LAN to sent MQTT messages.</div>
+
The Data to Server feature allows you to set up data senders that collect data from various sources and periodically send it to remote servers. We can configure this feature to send data from the router to Azure.
   −
<li>Go to Services > MQTT > Broker </li>
+
===Data to server configurations===
<div>1. Click '''Enable'''</div>
  −
<div>2. Use same port in MQTT Broker and Azure IoT Hub settings.</div>
  −
<div>3. Press '''Save'''</div>
  −
[[File:Azure26-1_RUTX.png]]
     −
<li>Go to '''Services > Cloud solutions > Azure IoT Hub'''</li>
+
To configure the "Data to Server" service on RUT devices, please navigate to '''Services -> Data to Server''' on the WebUI and add a new instance. In the pop-up window, you will need to perform the following steps:
<div>1. Enable monitoring </div>
  −
<div>2. Use same Connection string as before (GSM values configuration) </div>
  −
<div>3. Messages Type choose '''MQTT messages''' </div>
  −
<div>4. Enter MQTT Host address, we are using 127.0.0.1 since our broker is set up on same router.</div>
  −
<div>5. Port '''Same as MQTT Broker'''</div>
  −
<div>6. And Topic under which router will subscribe to MQTT Broker</div>
  −
<div>7. Press '''Save''', we will not need username or password.</div>
  −
[[File:Azure27-2_RUTX.png]]
     −
</ul>
+
<ul>
==Checking if MQTT messages are being forwarded to Azure IoT Hub==
+
<li> In the "Name" field, specify any name that you want; </li>
 +
<li> In the "Type" field, we will leave "Base" option for this example; </li>
 +
<li> In the "Format type" field, choose JSON; </li>
 +
<li> Press "Next: Collection edit"" button; </li>
 +
 
 +
[[File:Azure RutOSconf 26.png|border|class=tlt-border]]
 +
 
 +
<li> In the collection configuration window, leave "Format type" as JSON, set the period to your preferred value, and press the "Next: Server configuration" button.;</li>
 +
 
 +
[[File:Azure RutOSconf 27.png|border|class=tlt-border]]
 +
 
 +
<li> In the server configuration configuration window, choose "Type" as a "Azure IoT Hub" option; </li>
 +
In the "Configuration type" field, you can choose whether to use an existing Azure IoT Hub configuration or configure a new, unique Azure IoT Hub configuration. In this example, we will stick with the previously created, existing Azure IoT Hub instance configuration.
 +
 
 +
If you choose to create a new unique Azure IoT Hub configuration on the Data to Server instance, you will be able to choose connection types, upload certificates, connection strings, and more, just as we did previously on the '''Cloud Solutions -> Azure IoT Hub''' WebUI page.
 +
 
 +
<li> Select your preferred Azure IoT Hub instance; </li>
 +
<li> Press "Save & Apply" button. </li>
 +
 
 +
If you are following this guide, after saving, your configurations should resemble the screenshot below.
   −
===Linux===
+
[[File:Azure RutOSconf 28.png|border|class=tlt-border]]
<ul>
  −
<div>Connect to router with SSH, in logread you should see Router establishing connection to Azure IoT Hub: </div>
  −
[[File:Azure27-1.png|border|class=tlt-border]]
  −
<li>Open terminal and publish to MQTT Broker message with previously chosen topic.<br>
  −
For our example we are using example: '''mosquito_pub -h 192.168.1.1 -p 8883 -m ‘testing Azure MQTT messages’ -t test''' </li>
  −
<br><div>If everything was configured correctly in Device Explorer Data tab you should receive message like: </div>
  −
[[File:Azure28_RUTX.png|border|class=tlt-border|1000px]]
  −
<div>This means our router Forwards MQTT messages to Azure IoT Hub. </div>
   
</ul>
 
</ul>
   −
===Windows===
+
====Checking if data reaches IoT Hub on Azure====
<ul>
  −
<li>Install a MQTT client software to do the test, for this example we used MQTT.fx</li>
  −
<div>1. Setup your Router IP Address</div>
  −
<div>2. Use the '''same broker port'''</div>
  −
<div>3. Paste your '''Connection string – primary key''' and click '''Apply'''</div>
  −
[[File:Azure29-1_RUTX.png|border|class=tlt-border|800px]]
     −
<div>1. Connect to the server broker</div>
+
To determine whether data successfully reaches Azure IoT Hub, select your device and navigate to the "Telemetry" tab on the Azure IoT Explorer. Ensure that "Use built-in event hub" option is enabled and press the "Start" button. After a few seconds, you should see that a response was received from the device.
<div>2. Use the created topic. For this example '''test'''</div>
  −
<div>3. Send a message</div>
  −
[[File:Azure30_RUTX.png|border|class=tlt-border|1000px]]
     −
<li>If you did everything right this message will be shown in the device explorer</li>
+
[[File:Azure RutOSconf 29.png|border|class=tlt-border]]
</ul>